Merged changes in the trunk up to revision 54802.
[blender.git] / source / blender / editors / animation / anim_channels_defines.c
index da253ea6d2d1f481748c15617a1ae2b1d199198c..bc7b62df1858e84da07a611e5c03ae02714abb55 100644 (file)
@@ -47,6 +47,9 @@
 #include "DNA_key_types.h"
 #include "DNA_lamp_types.h"
 #include "DNA_lattice_types.h"
+#ifdef WITH_FREESTYLE
+#  include "DNA_linestyle_types.h"
+#endif
 #include "DNA_mesh_types.h"
 #include "DNA_material_types.h"
 #include "DNA_meta_types.h"
@@ -2010,6 +2013,85 @@ static bAnimChannelType ACF_DSNTREE =
        acf_dsntree_setting_ptr                 /* pointer for setting */
 };
 
+#ifdef WITH_FREESTYLE
+/* LineStyle Expander  ------------------------------------------- */
+
+/* TODO: just get this from RNA? */
+static int acf_dslinestyle_icon(bAnimListElem *UNUSED(ale))
+{
+       return ICON_BRUSH_DATA; /* FIXME */
+}
+
+/* get the appropriate flag(s) for the setting when it is valid  */
+static int acf_dslinestyle_setting_flag(bAnimContext *UNUSED(ac), int setting, short *neg)
+{
+       /* clear extra return data first */
+       *neg = 0;
+       
+       switch (setting) {
+               case ACHANNEL_SETTING_EXPAND: /* expanded */
+                       return LS_DS_EXPAND;
+                       
+               case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
+                       return ADT_NLA_EVAL_OFF;
+                       
+               case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
+                       *neg = 1;
+                       return ADT_CURVES_NOT_VISIBLE;
+                       
+               case ACHANNEL_SETTING_SELECT: /* selected */
+                       return ADT_UI_SELECTED;
+                       
+               default: /* unsupported */
+                       return 0;
+       }
+}
+
+/* get pointer to the setting */
+static void *acf_dslinestyle_setting_ptr(bAnimListElem *ale, int setting, short *type)
+{
+       FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ale->data;
+       
+       /* clear extra return data first */
+       *type = 0;
+       
+       switch (setting) {
+               case ACHANNEL_SETTING_EXPAND: /* expanded */
+                       return GET_ACF_FLAG_PTR(linestyle->flag, type);
+                       
+               case ACHANNEL_SETTING_SELECT: /* selected */
+               case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
+               case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
+                       if (linestyle->adt)
+                               return GET_ACF_FLAG_PTR(linestyle->adt->flag, type);
+                       else
+                               return NULL;
+                       
+               default: /* unsupported */
+                       return NULL;
+       }
+}
+
+/* node tree expander type define */
+static bAnimChannelType ACF_DSLINESTYLE= 
+{
+       "Line Style Expander",                  /* type name */
+       
+       acf_generic_dataexpand_color,   /* backdrop color */
+       acf_generic_dataexpand_backdrop,/* backdrop */
+       acf_generic_indention_1,                /* indent level */
+       acf_generic_basic_offset,               /* offset */
+       
+       acf_generic_idblock_name,               /* name */
+       acf_generic_idblock_nameprop,   /* name prop */
+       acf_dslinestyle_icon,                   /* icon */
+       
+       acf_generic_dataexpand_setting_valid,   /* has setting */
+       acf_dslinestyle_setting_flag,                   /* flag for setting */
+       acf_dslinestyle_setting_ptr                             /* pointer for setting */
+};
+#endif
+
 /* Mesh Expander  ------------------------------------------- */
 
 // TODO: just get this from RNA?
@@ -2722,6 +2804,9 @@ static void ANIM_init_channel_typeinfo_data(void)
                animchannelTypeInfo[type++] = &ACF_DSTEX;        /* Texture Channel */
                animchannelTypeInfo[type++] = &ACF_DSLAT;        /* Lattice Channel */
                animchannelTypeInfo[type++] = &ACF_DSSPK;        /* Speaker Channel */
+#ifdef WITH_FREESTYLE
+               animchannelTypeInfo[type++] = &ACF_DSLINESTYLE;  /* LineStyle Channel */
+#endif
                
                animchannelTypeInfo[type++] = &ACF_SHAPEKEY;     /* ShapeKey */