diff options
Diffstat (limited to 'source/blender/editors/animation/anim_channels_defines.c')
-rw-r--r-- | source/blender/editors/animation/anim_channels_defines.c | 436 |
1 files changed, 343 insertions, 93 deletions
diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 44ac78ed358..1cd1a26678d 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -365,14 +365,14 @@ static bool acf_generic_idfill_name_prop(bAnimListElem *ale, PointerRNA *ptr, Pr #if 0 /* channel type has no settings */ -static bool acf_generic_none_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static bool acf_generic_none_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting) { return false; } #endif /* check if some setting exists for this object-based data-expander (datablock only) */ -static bool acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting) +static bool acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting) { switch (setting) { /* expand is always supported */ @@ -438,14 +438,14 @@ static int acf_summary_icon(bAnimListElem *UNUSED(ale)) } /* check if some setting exists for this channel */ -static bool acf_summary_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) +static bool acf_summary_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting) { /* only expanded is supported, as it is used for hiding all stuff which the summary covers */ return (setting == ACHANNEL_SETTING_EXPAND); } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_summary_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_summary_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { if (setting == ACHANNEL_SETTING_EXPAND) { /* expanded */ @@ -460,7 +460,7 @@ static int acf_summary_setting_flag(bAnimContext *UNUSED(ac), int setting, bool } /* get pointer to the setting */ -static void *acf_summary_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_summary_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { bAnimContext *ac = (bAnimContext *)ale->data; @@ -485,6 +485,7 @@ static void *acf_summary_setting_ptr(bAnimListElem *ale, int setting, short *typ static bAnimChannelType ACF_SUMMARY = { "Summary", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_summary_color, /* backdrop color */ acf_summary_backdrop, /* backdrop */ @@ -509,7 +510,7 @@ static int acf_scene_icon(bAnimListElem *UNUSED(ale)) } /* check if some setting exists for this channel */ -static bool acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting) +static bool acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting) { switch (setting) { /* muted only in NLA */ @@ -531,7 +532,7 @@ static bool acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_scene_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_scene_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -557,7 +558,7 @@ static int acf_scene_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *n } /* get pointer to the setting */ -static void *acf_scene_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_scene_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { Scene *scene = (Scene *)ale->data; @@ -586,6 +587,7 @@ static void *acf_scene_setting_ptr(bAnimListElem *ale, int setting, short *type) static bAnimChannelType ACF_SCENE = { "Scene", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_root_color, /* backdrop color */ acf_generic_root_backdrop, /* backdrop */ @@ -649,7 +651,7 @@ static void acf_object_name(bAnimListElem *ale, char *name) } /* check if some setting exists for this channel */ -static bool acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static bool acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting) { Base *base = (Base *)ale->data; Object *ob = base->object; @@ -674,7 +676,7 @@ static bool acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, int s } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_object_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_object_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -700,7 +702,7 @@ static int acf_object_setting_flag(bAnimContext *UNUSED(ac), int setting, bool * } /* get pointer to the setting */ -static void *acf_object_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_object_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { Base *base = (Base *)ale->data; Object *ob = base->object; @@ -730,6 +732,7 @@ static void *acf_object_setting_ptr(bAnimListElem *ale, int setting, short *type static bAnimChannelType ACF_OBJECT = { "Object", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_root_color, /* backdrop color */ acf_generic_root_backdrop, /* backdrop */ @@ -812,7 +815,7 @@ static bool acf_group_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA } /* check if some setting exists for this channel */ -static bool acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), int setting) +static bool acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting) { /* for now, all settings are supported, though some are only conditionally */ switch (setting) { @@ -830,7 +833,7 @@ static bool acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_group_setting_flag(bAnimContext *ac, int setting, bool *neg) +static int acf_group_setting_flag(bAnimContext *ac, eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -859,14 +862,15 @@ static int acf_group_setting_flag(bAnimContext *ac, int setting, bool *neg) case ACHANNEL_SETTING_VISIBLE: /* visibility - graph editor */ *neg = 1; return AGRP_NOTVISIBLE; + + default: + /* this shouldn't happen */ + return 0; } - - /* this shouldn't happen */ - return 0; } /* get pointer to the setting */ -static void *acf_group_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type) +static void *acf_group_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type) { bActionGroup *agrp = (bActionGroup *)ale->data; @@ -878,6 +882,7 @@ static void *acf_group_setting_ptr(bAnimListElem *ale, int UNUSED(setting), shor static bAnimChannelType ACF_GROUP = { "Group", /* type name */ + ACHANNEL_ROLE_CHANNEL, /* role */ acf_group_color, /* backdrop color */ acf_group_backdrop, /* backdrop */ @@ -923,7 +928,7 @@ static bool acf_fcurve_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRN } /* check if some setting exists for this channel */ -static bool acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, int setting) +static bool acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting) { FCurve *fcu = (FCurve *)ale->data; @@ -950,7 +955,7 @@ static bool acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, int s } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -974,7 +979,7 @@ static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), int setting, bool * } /* get pointer to the setting */ -static void *acf_fcurve_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type) +static void *acf_fcurve_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type) { FCurve *fcu = (FCurve *)ale->data; @@ -986,6 +991,7 @@ static void *acf_fcurve_setting_ptr(bAnimListElem *ale, int UNUSED(setting), sho static bAnimChannelType ACF_FCURVE = { "F-Curve", /* type name */ + ACHANNEL_ROLE_CHANNEL, /* role */ acf_generic_channel_color, /* backdrop color */ acf_generic_channel_backdrop, /* backdrop */ @@ -1010,7 +1016,7 @@ static int acf_fillactd_icon(bAnimListElem *UNUSED(ale)) } /* check if some setting exists for this channel */ -static bool acf_fillactd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) +static bool acf_fillactd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting) { switch (setting) { /* only select and expand supported */ @@ -1024,7 +1030,7 @@ static bool acf_fillactd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem * } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_fillactd_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_fillactd_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -1043,7 +1049,7 @@ static int acf_fillactd_setting_flag(bAnimContext *UNUSED(ac), int setting, bool } /* get pointer to the setting */ -static void *acf_fillactd_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_fillactd_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { bAction *act = (bAction *)ale->data; AnimData *adt = ale->adt; @@ -1070,6 +1076,7 @@ static void *acf_fillactd_setting_ptr(bAnimListElem *ale, int setting, short *ty static bAnimChannelType ACF_FILLACTD = { "Ob-Action Filler", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -1100,7 +1107,7 @@ static void acf_filldrivers_name(bAnimListElem *UNUSED(ale), char *name) /* check if some setting exists for this channel */ // TODO: this could be made more generic -static bool acf_filldrivers_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) +static bool acf_filldrivers_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting) { switch (setting) { /* only expand supported */ @@ -1113,7 +1120,7 @@ static bool acf_filldrivers_setting_valid(bAnimContext *UNUSED(ac), bAnimListEle } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_filldrivers_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_filldrivers_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -1129,7 +1136,7 @@ static int acf_filldrivers_setting_flag(bAnimContext *UNUSED(ac), int setting, b } /* get pointer to the setting */ -static void *acf_filldrivers_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_filldrivers_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { AnimData *adt = (AnimData *)ale->data; @@ -1149,6 +1156,7 @@ static void *acf_filldrivers_setting_ptr(bAnimListElem *ale, int setting, short static bAnimChannelType ACF_FILLDRIVERS = { "Drivers Filler", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -1174,7 +1182,7 @@ static int acf_dsmat_icon(bAnimListElem *UNUSED(ale)) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -1199,7 +1207,7 @@ static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *n } /* get pointer to the setting */ -static void *acf_dsmat_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_dsmat_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { Material *ma = (Material *)ale->data; @@ -1226,6 +1234,7 @@ static void *acf_dsmat_setting_ptr(bAnimListElem *ale, int setting, short *type) static bAnimChannelType ACF_DSMAT = { "Material Data Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -1250,7 +1259,7 @@ static int acf_dslam_icon(bAnimListElem *UNUSED(ale)) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -1275,7 +1284,7 @@ static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *n } /* get pointer to the setting */ -static void *acf_dslam_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_dslam_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { Lamp *la = (Lamp *)ale->data; @@ -1302,6 +1311,7 @@ static void *acf_dslam_setting_ptr(bAnimListElem *ale, int setting, short *type) static bAnimChannelType ACF_DSLAM = { "Lamp Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -1333,7 +1343,7 @@ static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(al } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -1358,7 +1368,7 @@ static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *n } /* get pointer to the setting */ -static void *acf_dstex_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_dstex_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { Tex *tex = (Tex *)ale->data; @@ -1385,6 +1395,7 @@ static void *acf_dstex_setting_ptr(bAnimListElem *ale, int setting, short *type) static bAnimChannelType ACF_DSTEX = { "Texture Data Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -1409,7 +1420,7 @@ static int acf_dscam_icon(bAnimListElem *UNUSED(ale)) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -1434,7 +1445,7 @@ static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *n } /* get pointer to the setting */ -static void *acf_dscam_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_dscam_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { Camera *ca = (Camera *)ale->data; @@ -1461,6 +1472,7 @@ static void *acf_dscam_setting_ptr(bAnimListElem *ale, int setting, short *type) static bAnimChannelType ACF_DSCAM = { "Camera Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -1495,7 +1507,7 @@ static int acf_dscur_icon(bAnimListElem *ale) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -1520,7 +1532,7 @@ static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *n } /* get pointer to the setting */ -static void *acf_dscur_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_dscur_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { Curve *cu = (Curve *)ale->data; @@ -1547,6 +1559,7 @@ static void *acf_dscur_setting_ptr(bAnimListElem *ale, int setting, short *type) static bAnimChannelType ACF_DSCUR = { "Curve Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -1571,7 +1584,7 @@ static int acf_dsskey_icon(bAnimListElem *UNUSED(ale)) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -1596,7 +1609,7 @@ static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), int setting, bool * } /* get pointer to the setting */ -static void *acf_dsskey_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_dsskey_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { Key *key = (Key *)ale->data; @@ -1623,6 +1636,7 @@ static void *acf_dsskey_setting_ptr(bAnimListElem *ale, int setting, short *type static bAnimChannelType ACF_DSSKEY = { "Shape Key Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -1647,7 +1661,7 @@ static int acf_dswor_icon(bAnimListElem *UNUSED(ale)) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -1672,7 +1686,7 @@ static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *n } /* get pointer to the setting */ -static void *acf_dswor_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_dswor_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { World *wo = (World *)ale->data; @@ -1699,6 +1713,7 @@ static void *acf_dswor_setting_ptr(bAnimListElem *ale, int setting, short *type) static bAnimChannelType ACF_DSWOR = { "World Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -1723,7 +1738,7 @@ static int acf_dspart_icon(bAnimListElem *UNUSED(ale)) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -1748,7 +1763,7 @@ static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), int setting, bool * } /* get pointer to the setting */ -static void *acf_dspart_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_dspart_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { ParticleSettings *part = (ParticleSettings *)ale->data; @@ -1775,6 +1790,7 @@ static void *acf_dspart_setting_ptr(bAnimListElem *ale, int setting, short *type static bAnimChannelType ACF_DSPART = { "Particle Data Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -1799,7 +1815,7 @@ static int acf_dsmball_icon(bAnimListElem *UNUSED(ale)) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -1824,7 +1840,7 @@ static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), int setting, bool } /* get pointer to the setting */ -static void *acf_dsmball_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_dsmball_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { MetaBall *mb = (MetaBall *)ale->data; @@ -1851,6 +1867,7 @@ static void *acf_dsmball_setting_ptr(bAnimListElem *ale, int setting, short *typ static bAnimChannelType ACF_DSMBALL = { "Metaball Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -1875,7 +1892,7 @@ static int acf_dsarm_icon(bAnimListElem *UNUSED(ale)) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -1900,7 +1917,7 @@ static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *n } /* get pointer to the setting */ -static void *acf_dsarm_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_dsarm_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { bArmature *arm = (bArmature *)ale->data; @@ -1927,6 +1944,7 @@ static void *acf_dsarm_setting_ptr(bAnimListElem *ale, int setting, short *type) static bAnimChannelType ACF_DSARM = { "Armature Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -1962,7 +1980,7 @@ static short acf_dsntree_offset(bAnimContext *ac, bAnimListElem *ale) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -1987,7 +2005,7 @@ static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), int setting, bool } /* get pointer to the setting */ -static void *acf_dsntree_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_dsntree_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { bNodeTree *ntree = (bNodeTree *)ale->data; @@ -2014,6 +2032,7 @@ static void *acf_dsntree_setting_ptr(bAnimListElem *ale, int setting, short *typ static bAnimChannelType ACF_DSNTREE = { "Node Tree Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -2038,7 +2057,7 @@ static int acf_dslinestyle_icon(bAnimListElem *UNUSED(ale)) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dslinestyle_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_dslinestyle_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -2063,7 +2082,7 @@ static int acf_dslinestyle_setting_flag(bAnimContext *UNUSED(ac), int setting, b } /* get pointer to the setting */ -static void *acf_dslinestyle_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_dslinestyle_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ale->data; @@ -2090,6 +2109,7 @@ static void *acf_dslinestyle_setting_ptr(bAnimListElem *ale, int setting, short static bAnimChannelType ACF_DSLINESTYLE = { "Line Style Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop,/* backdrop */ @@ -2114,7 +2134,7 @@ static int acf_dsmesh_icon(bAnimListElem *UNUSED(ale)) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -2139,7 +2159,7 @@ static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), int setting, bool * } /* get pointer to the setting */ -static void *acf_dsmesh_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_dsmesh_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { Mesh *me = (Mesh *)ale->data; @@ -2166,6 +2186,7 @@ static void *acf_dsmesh_setting_ptr(bAnimListElem *ale, int setting, short *type static bAnimChannelType ACF_DSMESH = { "Mesh Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -2190,7 +2211,7 @@ static int acf_dslat_icon(bAnimListElem *UNUSED(ale)) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dslat_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_dslat_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -2215,7 +2236,7 @@ static int acf_dslat_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *n } /* get pointer to the setting */ -static void *acf_dslat_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_dslat_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { Lattice *lt = (Lattice *)ale->data; @@ -2242,6 +2263,7 @@ static void *acf_dslat_setting_ptr(bAnimListElem *ale, int setting, short *type) static bAnimChannelType ACF_DSLAT = { "Lattice Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -2266,7 +2288,7 @@ static int acf_dsspk_icon(bAnimListElem *UNUSED(ale)) } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_dsspk_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_dsspk_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -2291,7 +2313,7 @@ static int acf_dsspk_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *n } /* get pointer to the setting */ -static void *acf_dsspk_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_dsspk_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { Speaker *spk = (Speaker *)ale->data; @@ -2318,6 +2340,7 @@ static void *acf_dsspk_setting_ptr(bAnimListElem *ale, int setting, short *type) static bAnimChannelType ACF_DSSPK = { "Speaker Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_generic_dataexpand_color, /* backdrop color */ acf_generic_dataexpand_backdrop, /* backdrop */ @@ -2367,7 +2390,7 @@ static bool acf_shapekey_name_prop(bAnimListElem *ale, PointerRNA *ptr, Property } /* check if some setting exists for this channel */ -static bool acf_shapekey_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) +static bool acf_shapekey_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting) { switch (setting) { case ACHANNEL_SETTING_SELECT: /* selected */ @@ -2382,7 +2405,7 @@ static bool acf_shapekey_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem * } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_shapekey_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_shapekey_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -2403,7 +2426,7 @@ static int acf_shapekey_setting_flag(bAnimContext *UNUSED(ac), int setting, bool } /* get pointer to the setting */ -static void *acf_shapekey_setting_ptr(bAnimListElem *ale, int setting, short *type) +static void *acf_shapekey_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) { KeyBlock *kb = (KeyBlock *)ale->data; @@ -2425,6 +2448,7 @@ static void *acf_shapekey_setting_ptr(bAnimListElem *ale, int setting, short *ty static bAnimChannelType ACF_SHAPEKEY = { "Shape Key", /* type name */ + ACHANNEL_ROLE_CHANNEL, /* role */ acf_generic_channel_color, /* backdrop color */ acf_generic_channel_backdrop, /* backdrop */ @@ -2456,7 +2480,7 @@ static int acf_gpd_icon(bAnimListElem *UNUSED(ale)) } /* check if some setting exists for this channel */ -static bool acf_gpd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) +static bool acf_gpd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting) { switch (setting) { /* only select and expand supported */ @@ -2470,7 +2494,7 @@ static bool acf_gpd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSE } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_gpd_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_gpd_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -2481,14 +2505,15 @@ static int acf_gpd_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg case ACHANNEL_SETTING_EXPAND: /* expanded */ return GP_DATA_EXPAND; + + default: + /* these shouldn't happen */ + return 0; } - - /* this shouldn't happen */ - return 0; } /* get pointer to the setting */ -static void *acf_gpd_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type) +static void *acf_gpd_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type) { bGPdata *gpd = (bGPdata *)ale->data; @@ -2500,6 +2525,7 @@ static void *acf_gpd_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short static bAnimChannelType ACF_GPD = { "GPencil Datablock", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_gpd_color, /* backdrop color */ acf_group_backdrop, /* backdrop */ @@ -2540,7 +2566,7 @@ static bool acf_gpl_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA * } /* check if some setting exists for this channel */ -static bool acf_gpl_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) +static bool acf_gpl_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting) { switch (setting) { /* unsupported */ @@ -2556,7 +2582,7 @@ static bool acf_gpl_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSE } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_gpl_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_gpl_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -2577,11 +2603,11 @@ static int acf_gpl_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg } /* get pointer to the setting */ -static void *acf_gpl_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type) +static void *acf_gpl_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type) { bGPDlayer *gpl = (bGPDlayer *)ale->data; - /* all flags are just in agrp->flag for now... */ + /* all flags are just in gpl->flag for now... */ return GET_ACF_FLAG_PTR(gpl->flag, type); } @@ -2589,6 +2615,7 @@ static void *acf_gpl_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short static bAnimChannelType ACF_GPL = { "GPencil Layer", /* type name */ + ACHANNEL_ROLE_CHANNEL, /* role */ acf_generic_channel_color, /* backdrop color */ acf_generic_channel_backdrop, /* backdrop */ @@ -2621,7 +2648,7 @@ static int acf_mask_icon(bAnimListElem *UNUSED(ale)) } /* check if some setting exists for this channel */ -static bool acf_mask_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) +static bool acf_mask_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting) { switch (setting) { /* only select and expand supported */ @@ -2635,7 +2662,7 @@ static bool acf_mask_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUS } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_mask_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_mask_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -2646,14 +2673,15 @@ static int acf_mask_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *ne case ACHANNEL_SETTING_EXPAND: /* expanded */ return MASK_ANIMF_EXPAND; + + default: + /* this shouldn't happen */ + return 0; } - - /* this shouldn't happen */ - return 0; } /* get pointer to the setting */ -static void *acf_mask_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type) +static void *acf_mask_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type) { Mask *mask = (Mask *)ale->data; @@ -2665,6 +2693,7 @@ static void *acf_mask_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short static bAnimChannelType ACF_MASKDATA = { "Mask Datablock", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ acf_mask_color, /* backdrop color */ acf_group_backdrop, /* backdrop */ @@ -2705,7 +2734,7 @@ static bool acf_masklay_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyR } /* check if some setting exists for this channel */ -static bool acf_masklay_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), int setting) +static bool acf_masklay_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting) { switch (setting) { /* unsupported */ @@ -2721,7 +2750,7 @@ static bool acf_masklay_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *U } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_masklay_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_masklay_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -2739,11 +2768,11 @@ static int acf_masklay_setting_flag(bAnimContext *UNUSED(ac), int setting, bool } /* get pointer to the setting */ -static void *acf_masklay_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type) +static void *acf_masklay_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type) { MaskLayer *masklay = (MaskLayer *)ale->data; - /* all flags are just in agrp->flag for now... */ + /* all flags are just in masklay->flag for now... */ return GET_ACF_FLAG_PTR(masklay->flag, type); } @@ -2751,6 +2780,7 @@ static void *acf_masklay_setting_ptr(bAnimListElem *ale, int UNUSED(setting), sh static bAnimChannelType ACF_MASKLAYER = { "Mask Layer", /* type name */ + ACHANNEL_ROLE_CHANNEL, /* role */ acf_generic_channel_color, /* backdrop color */ acf_generic_channel_backdrop, /* backdrop */ @@ -2810,7 +2840,7 @@ static bool acf_nlatrack_name_prop(bAnimListElem *ale, PointerRNA *ptr, Property } /* check if some setting exists for this channel */ -static bool acf_nlatrack_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *ale, int setting) +static bool acf_nlatrack_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *ale, eAnimChannel_Settings setting) { NlaTrack *nlt = (NlaTrack *)ale->data; AnimData *adt = ale->adt; @@ -2855,7 +2885,7 @@ static bool acf_nlatrack_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem * } /* get the appropriate flag(s) for the setting when it is valid */ -static int acf_nlatrack_setting_flag(bAnimContext *UNUSED(ac), int setting, bool *neg) +static int acf_nlatrack_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) { /* clear extra return data first */ *neg = false; @@ -2879,7 +2909,7 @@ static int acf_nlatrack_setting_flag(bAnimContext *UNUSED(ac), int setting, bool } /* get pointer to the setting */ -static void *acf_nlatrack_setting_ptr(bAnimListElem *ale, int UNUSED(setting), short *type) +static void *acf_nlatrack_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type) { NlaTrack *nlt = (NlaTrack *)ale->data; return GET_ACF_FLAG_PTR(nlt->flag, type); @@ -2889,6 +2919,7 @@ static void *acf_nlatrack_setting_ptr(bAnimListElem *ale, int UNUSED(setting), s static bAnimChannelType ACF_NLATRACK = { "NLA Track", /* type name */ + ACHANNEL_ROLE_CHANNEL, /* role */ acf_nlatrack_color, /* backdrop color */ acf_generic_channel_backdrop, /* backdrop */ @@ -2904,7 +2935,174 @@ static bAnimChannelType ACF_NLATRACK = acf_nlatrack_setting_ptr /* pointer for setting */ }; +/* NLA Action ----------------------------------------------- */ + +/* icon for action depends on whether it's in tweaking mode */ +static int acf_nlaaction_icon(bAnimListElem *ale) +{ + AnimData *adt = ale->adt; + + /* indicate tweaking-action state by changing the icon... */ + if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) { + return ICON_ACTION_TWEAK; + } + else { + return ICON_ACTION; + } +} + +/* Backdrop color for nla action channel + * Although this can't be used directly for NLA Action drawing, + * it is still needed for use behind the RHS toggles + */ +static void acf_nlaaction_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float r_color[3]) +{ + float color[4]; + + /* Action Line + * The alpha values action_get_color returns are only useful for drawing + * strips backgrounds but here we're doing channel list backgrounds instead + * so we ignore that and use our own when needed + */ + nla_action_get_color(ale->adt, (bAction *)ale->data, color); + + /* NOTE: since the return types only allow rgb, we cannot do the alpha-blending we'd + * like for the solo-drawing case. Hence, this method isn't actually used for drawing + * most of the channel... + */ + copy_v3_v3(r_color, color); +} + +/* backdrop for nla action channel */ +static void acf_nlaaction_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc) +{ + bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale); + View2D *v2d = &ac->ar->v2d; + AnimData *adt = ale->adt; + short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0; + float color[4]; + + /* Action Line + * The alpha values action_get_color returns are only useful for drawing + * strips backgrounds but here we're doing channel list backgrounds instead + * so we ignore that and use our own when needed + */ + nla_action_get_color(adt, (bAction *)ale->data, color); + + if (adt && (adt->flag & ADT_NLA_EDIT_ON)) { + /* Yes, the color vector has 4 components, BUT we only want to be using 3 of them! */ + glColor3fv(color); + } + else { + float alpha = (adt && (adt->flag & ADT_NLA_SOLO_TRACK)) ? 0.3f : 1.0f; + glColor4f(color[0], color[1], color[2], alpha); + } + + /* only on top left corner, to show that this channel sits on top of the preceding ones + * while still linking into the action line strip to the right + */ + uiSetRoundBox(UI_CNR_TOP_LEFT); + + /* draw slightly shifted up vertically to look like it has more separation from other channels, + * but we then need to slightly shorten it so that it doesn't look like it overlaps + */ + uiDrawBox(GL_POLYGON, offset, yminc + NLACHANNEL_SKIP, (float)v2d->cur.xmax, ymaxc + NLACHANNEL_SKIP - 1, 8); +} + +/* name for nla action entries */ +static void acf_nlaaction_name(bAnimListElem *ale, char *name) +{ + bAction *act = (bAction *)ale->data; + + if (name) { + if (act) { + // TODO: add special decoration when doing this in tweaking mode? + BLI_strncpy(name, act->id.name + 2, ANIM_CHAN_NAME_SIZE); + } + else { + BLI_strncpy(name, "<No Action>", ANIM_CHAN_NAME_SIZE); + } + } +} + +/* name property for nla action entries */ +static bool acf_nlaaction_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop) +{ + if (ale->data) { + RNA_pointer_create(ale->id, &RNA_Action, ale->data, ptr); + *prop = RNA_struct_name_property(ptr->type); + + return (*prop != NULL); + } + + return false; +} + +/* check if some setting exists for this channel */ +static bool acf_nlaaction_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *ale, eAnimChannel_Settings setting) +{ + AnimData *adt = ale->adt; + + /* visibility of settings depends on various states... */ + switch (setting) { + /* conditionally supported */ + case ACHANNEL_SETTING_PINNED: /* pinned - map/unmap */ + if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) { + /* this should only appear in tweakmode */ + return true; + } + else { + return false; + } + + /* unsupported */ + default: + return false; + } +} + +/* get the appropriate flag(s) for the setting when it is valid */ +static int acf_nlaaction_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) +{ + /* clear extra return data first */ + *neg = false; + + switch (setting) { + case ACHANNEL_SETTING_PINNED: /* pinned - map/unmap */ + *neg = true; // XXX + return ADT_NLA_EDIT_NOMAP; + + default: /* unsupported */ + return 0; + } +} + +/* get pointer to the setting */ +static void *acf_nlaaction_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type) +{ + AnimData *adt = ale->adt; + return GET_ACF_FLAG_PTR(adt->flag, type); +} +/* nla action type define */ +static bAnimChannelType ACF_NLAACTION = +{ + "NLA Active Action", /* type name */ + ACHANNEL_ROLE_CHANNEL, /* role */ + + acf_nlaaction_color, /* backdrop color (NOTE: the backdrop handles this too, since it needs special hacks) */ + acf_nlaaction_backdrop, /* backdrop */ + acf_generic_indention_flexible, /* indent level */ + acf_generic_group_offset, /* offset */ // XXX? + + acf_nlaaction_name, /* name */ + acf_nlaaction_name_prop, /* name prop */ + acf_nlaaction_icon, /* icon */ + + acf_nlaaction_setting_valid, /* has setting */ + acf_nlaaction_setting_flag, /* flag for setting */ + acf_nlaaction_setting_ptr /* pointer for setting */ +}; /* *********************************************** */ @@ -2965,9 +3163,7 @@ static void ANIM_init_channel_typeinfo_data(void) animchannelTypeInfo[type++] = &ACF_MASKLAYER; /* Mask Layer */ animchannelTypeInfo[type++] = &ACF_NLATRACK; /* NLA Track */ - - // TODO: this channel type still hasn't been ported over yet, since it requires special attention - animchannelTypeInfo[type++] = NULL; /* NLA Action */ + animchannelTypeInfo[type++] = &ACF_NLAACTION; /* NLA Action */ } } @@ -3043,7 +3239,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting switch (ptrsize) { case sizeof(int): /* integer pointer for setting */ { - int *val = (int *)ptr; + const int *val = (int *)ptr; if (negflag) return ((*val) & flag) == 0; @@ -3052,7 +3248,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting } case sizeof(short): /* short pointer for setting */ { - short *val = (short *)ptr; + const short *val = (short *)ptr; if (negflag) return ((*val) & flag) == 0; @@ -3061,7 +3257,7 @@ short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, int setting } case sizeof(char): /* char pointer for setting */ { - char *val = (char *)ptr; + const char *val = (char *)ptr; if (negflag) return ((*val) & flag) == 0; @@ -3257,7 +3453,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float } } - /* step 6) draw backdrops behidn mute+protection toggles + (sliders) ....................... */ + /* step 6) draw backdrops behind mute+protection toggles + (sliders) ....................... */ /* reset offset - now goes from RHS of panel */ offset = 0; @@ -3265,6 +3461,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float if (v2d) { short draw_sliders = 0; + float ymin_ofs = 0.0f; float color[3]; /* get and set backdrop color */ @@ -3297,6 +3494,15 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float /* mute... */ if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) offset += ICON_WIDTH; + /* pinned... */ + if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PINNED)) + offset += ICON_WIDTH; + + /* NOTE: technically, NLA Action "pushdown" should be here too, but there are no sliders there */ + + /* NLA action channels have slightly different spacing requirements... */ + if (ale->type == ANIMTYPE_NLAACTION) + ymin_ofs = NLACHANNEL_SKIP; } /* draw slider @@ -3314,7 +3520,7 @@ void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float * - starts from the point where the first toggle/slider starts, * - ends past the space that might be reserved for a scroller */ - glRectf(v2d->cur.xmax - (float)offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc); + glRectf(v2d->cur.xmax - (float)offset, yminc + ymin_ofs, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc); } } @@ -3541,10 +3747,28 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann //icon = ((enabled) ? ICON_MUTE_IPO_ON : ICON_MUTE_IPO_OFF); icon = ICON_MUTE_IPO_OFF; - if (ale->type == ANIMTYPE_FCURVE) + if (ale->type == ANIMTYPE_FCURVE) { tooltip = TIP_("Does F-Curve contribute to result"); - else - tooltip = TIP_("Do channels contribute to result"); + } + else if ((ac) && (ac->spacetype == SPACE_NLA) && (ale->type != ANIMTYPE_NLATRACK)) { + tooltip = TIP_("Temporarily disable NLA stack evaluation (i.e. only the active action is evaluated)"); + } + else { + tooltip = TIP_("Do channels contribute to result (toggle channel muting)"); + } + break; + + case ACHANNEL_SETTING_PINNED: /* pin icon */ + //icon = ((enabled) ? ICON_PINNED : ICON_UNPINNED); + icon = ICON_UNPINNED; + + if (ale->type == ANIMTYPE_NLAACTION) { + tooltip = TIP_("Display action without any time remapping (when unpinned)"); + } + else { + /* TODO: there are no other tools which require the 'pinning' concept yet */ + tooltip = NULL; + } break; default: @@ -3585,6 +3809,7 @@ static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, bAnimChann case ACHANNEL_SETTING_VISIBLE: /* Graph Editor - 'visibility' toggles */ case ACHANNEL_SETTING_PROTECT: /* General - protection flags */ case ACHANNEL_SETTING_MUTE: /* General - muting flags */ + case ACHANNEL_SETTING_PINNED: /* NLA Actions - 'map/nomap' */ uiButSetNFunc(but, achannel_setting_flush_widget_cb, MEM_dupallocN(ale), SET_INT_IN_POINTER(setting)); break; @@ -3724,6 +3949,31 @@ void ANIM_channel_draw_widgets(bContext *C, bAnimContext *ac, bAnimListElem *ale offset += ICON_WIDTH; draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax - offset, ymid, ACHANNEL_SETTING_MUTE); } + + /* ----------- */ + + /* pinned... */ + if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PINNED)) { + offset += ICON_WIDTH; + draw_setting_widget(ac, ale, acf, block, (int)v2d->cur.xmax - offset, ymid, ACHANNEL_SETTING_PINNED); + } + + /* NLA Action "pushdown" */ + if ((ale->type == ANIMTYPE_NLAACTION) && (ale->adt && ale->adt->action) && !(ale->adt->flag & ADT_NLA_EDIT_ON)) { + uiBut *but; + PointerRNA *opptr_b; + + uiBlockSetEmboss(block, UI_EMBOSS); + + offset += UI_UNIT_X; + but = uiDefIconButO(block, BUT, "NLA_OT_action_pushdown", WM_OP_INVOKE_DEFAULT, ICON_NLA_PUSHDOWN, + (int)v2d->cur.xmax - offset, ymid, UI_UNIT_X, UI_UNIT_X, NULL); + + opptr_b = uiButGetOperatorPtrRNA(but); + RNA_int_set(opptr_b, "channel_index", channel_index); + + uiBlockSetEmboss(block, UI_EMBOSSN); + } } /* draw slider |