From 8e80d2741deaa919a62e6e1677c0520332792698 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Fri, 14 Oct 2016 17:22:57 +0200 Subject: Fix T49571: 2d stabilize keys not visible in the Graph Editor and Dope Sheet --- .../editors/animation/anim_channels_defines.c | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) (limited to 'source/blender/editors/animation/anim_channels_defines.c') diff --git a/source/blender/editors/animation/anim_channels_defines.c b/source/blender/editors/animation/anim_channels_defines.c index 5e131435a7a..57302c18a88 100644 --- a/source/blender/editors/animation/anim_channels_defines.c +++ b/source/blender/editors/animation/anim_channels_defines.c @@ -2706,6 +2706,84 @@ static bAnimChannelType ACF_DSGPENCIL = acf_dsgpencil_setting_ptr /* pointer for setting */ }; +/* World Expander ------------------------------------------- */ + +// TODO: just get this from RNA? +static int acf_dsmclip_icon(bAnimListElem *UNUSED(ale)) +{ + return ICON_SEQUENCE; +} + +/* get the appropriate flag(s) for the setting when it is valid */ +static int acf_dsmclip_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg) +{ + /* clear extra return data first */ + *neg = false; + + switch (setting) { + case ACHANNEL_SETTING_EXPAND: /* expanded */ + return MCLIP_DATA_EXPAND; + + case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */ + return ADT_NLA_EVAL_OFF; + + case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */ + *neg = true; + 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_dsmclip_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) +{ + MovieClip *clip = (MovieClip *)ale->data; + + /* clear extra return data first */ + *type = 0; + + switch (setting) { + case ACHANNEL_SETTING_EXPAND: /* expanded */ + return GET_ACF_FLAG_PTR(clip->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 (clip->adt != NULL) { + return GET_ACF_FLAG_PTR(clip->adt->flag, type); + } + return NULL; + + default: /* unsupported */ + return NULL; + } +} + +/* world expander type define */ +static bAnimChannelType ACF_DSMCLIP = +{ + "Movieclip Expander", /* type name */ + ACHANNEL_ROLE_EXPANDER, /* role */ + + 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_idfill_name_prop, /* name prop */ + acf_dsmclip_icon, /* icon */ + + acf_generic_dataexpand_setting_valid, /* has setting */ + acf_dsmclip_setting_flag, /* flag for setting */ + acf_dsmclip_setting_ptr /* pointer for setting */ +}; + /* ShapeKey Entry ------------------------------------------- */ /* name for ShapeKey */ @@ -3511,6 +3589,7 @@ static void ANIM_init_channel_typeinfo_data(void) animchannelTypeInfo[type++] = &ACF_DSLINESTYLE; /* LineStyle Channel */ animchannelTypeInfo[type++] = &ACF_DSSPK; /* Speaker Channel */ animchannelTypeInfo[type++] = &ACF_DSGPENCIL; /* GreasePencil Channel */ + animchannelTypeInfo[type++] = &ACF_DSMCLIP; /* MovieClip Channel */ animchannelTypeInfo[type++] = &ACF_SHAPEKEY; /* ShapeKey */ -- cgit v1.2.3