Fix T49571: 2d stabilize keys not visible in the Graph Editor and Dope Sheet

This commit is contained in:
Sergey Sharybin 2016-10-14 17:22:57 +02:00
parent 0ddb8d9b13
commit 8e80d2741d
Notes: blender-bot 2023-02-14 08:28:46 +01:00
Referenced by issue #49571, 2d stabilize keys not visible in the Graph Editor and Dope Sheet
5 changed files with 150 additions and 1 deletions

View File

@ -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 */

View File

@ -133,6 +133,7 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datat
case ANIMTYPE_DSLINESTYLE:
case ANIMTYPE_DSSPK:
case ANIMTYPE_DSGPENCIL:
case ANIMTYPE_DSMCLIP:
{
/* need to verify that this data is valid for now */
if (ale->adt) {
@ -190,6 +191,7 @@ void ANIM_set_active_channel(bAnimContext *ac, void *data, eAnimCont_Types datat
case ANIMTYPE_DSNTREE:
case ANIMTYPE_DSTEX:
case ANIMTYPE_DSGPENCIL:
case ANIMTYPE_DSMCLIP:
{
/* need to verify that this data is valid for now */
if (ale && ale->adt) {
@ -291,6 +293,7 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types d
case ANIMTYPE_DSLINESTYLE:
case ANIMTYPE_DSSPK:
case ANIMTYPE_DSGPENCIL:
case ANIMTYPE_DSMCLIP:
{
if ((ale->adt) && (ale->adt->flag & ADT_UI_SELECTED))
sel = ACHANNEL_SETFLAG_CLEAR;
@ -387,6 +390,7 @@ void ANIM_deselect_anim_channels(bAnimContext *ac, void *data, eAnimCont_Types d
case ANIMTYPE_DSLINESTYLE:
case ANIMTYPE_DSSPK:
case ANIMTYPE_DSGPENCIL:
case ANIMTYPE_DSMCLIP:
{
/* need to verify that this data is valid for now */
if (ale->adt) {
@ -2738,6 +2742,7 @@ static int mouse_anim_channels(bContext *C, bAnimContext *ac, int channel_index,
case ANIMTYPE_DSLINESTYLE:
case ANIMTYPE_DSSPK:
case ANIMTYPE_DSGPENCIL:
case ANIMTYPE_DSMCLIP:
{
/* sanity checking... */
if (ale->adt) {

View File

@ -62,6 +62,7 @@
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meta_types.h"
#include "DNA_movieclip_types.h"
#include "DNA_node_types.h"
#include "DNA_particle_types.h"
#include "DNA_space_types.h"
@ -842,6 +843,19 @@ static bAnimListElem *make_new_animlistelem(void *data, short datatype, ID *owne
ale->adt = BKE_animdata_from_id(data);
break;
}
case ANIMTYPE_DSMCLIP:
{
MovieClip *clip = (MovieClip *)data;
AnimData *adt = clip->adt;
ale->flag = EXPANDED_MCLIP(clip);
ale->key_data = (adt) ? adt->action : NULL;
ale->datatype = ALE_ACT;
ale->adt = BKE_animdata_from_id(data);
break;
}
case ANIMTYPE_NLACONTROLS:
{
AnimData *adt = (AnimData *)data;
@ -2793,6 +2807,50 @@ static size_t animdata_filter_dopesheet_scene(bAnimContext *ac, ListBase *anim_d
return items;
}
static size_t animdata_filter_ds_movieclip(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, MovieClip *clip, int filter_mode)
{
ListBase tmp_data = {NULL, NULL};
size_t tmp_items = 0;
size_t items = 0;
/* add world animation channels */
BEGIN_ANIMFILTER_SUBCHANNELS(EXPANDED_MCLIP(clip))
{
/* animation data filtering */
tmp_items += animfilter_block_data(ac, &tmp_data, ads, (ID *)clip, filter_mode);
}
END_ANIMFILTER_SUBCHANNELS;
/* did we find anything? */
if (tmp_items) {
/* include data-expand widget first */
if (filter_mode & ANIMFILTER_LIST_CHANNELS) {
/* check if filtering by active status */
if (ANIMCHANNEL_ACTIVEOK(clip)) {
ANIMCHANNEL_NEW_CHANNEL(clip, ANIMTYPE_DSMCLIP, clip);
}
}
/* now add the list of collected channels */
BLI_movelisttolist(anim_data, &tmp_data);
BLI_assert(BLI_listbase_is_empty(&tmp_data));
items += tmp_items;
}
/* return the number of items added to the list */
return items;
}
static size_t animdata_filter_dopesheet_movieclips(bAnimContext *ac, ListBase *anim_data, bDopeSheet *ads, int filter_mode)
{
size_t items = 0;
MovieClip *clip;
for (clip = G.main->movieclip.first; clip != NULL; clip = clip->id.next) {
/* only show if gpd is used by something... */
if (ID_REAL_USERS(clip) < 1) {
continue;
}
items += animdata_filter_ds_movieclip(ac, anim_data, ads, clip, filter_mode);
}
/* return the number of items added to the list */
return items;
}
/* Helper for animdata_filter_dopesheet() - For checking if an object should be included or not */
static bool animdata_filter_base_is_ok(bDopeSheet *ads, Scene *scene, Base *base, int filter_mode)
@ -2926,9 +2984,12 @@ static size_t animdata_filter_dopesheet(bAnimContext *ac, ListBase *anim_data, b
items += animdata_filter_ds_cachefile(ac, anim_data, ads, cache_file, filter_mode);
}
/* movie clip's animation */
items += animdata_filter_dopesheet_movieclips(ac, anim_data, ads, filter_mode);
/* scene-linked animation - e.g. world, compositing nodes, scene anim (including sequencer currently) */
items += animdata_filter_dopesheet_scene(ac, anim_data, ads, scene, filter_mode);
/* If filtering for channel drawing, we want the objects in alphabetical order,
* to make it easier to predict where items are in the hierarchy
* - This order only really matters if we need to show all channels in the list (e.g. for drawing)

View File

@ -170,6 +170,7 @@ typedef enum eAnim_ChannelType {
ANIMTYPE_DSLINESTYLE,
ANIMTYPE_DSSPK,
ANIMTYPE_DSGPENCIL,
ANIMTYPE_DSMCLIP,
ANIMTYPE_SHAPEKEY,
@ -329,6 +330,8 @@ typedef enum eAnimFilter_Flags {
#define SEL_NLT(nlt) (nlt->flag & NLATRACK_SELECTED)
#define EDITABLE_NLT(nlt) ((nlt->flag & NLATRACK_PROTECTED) == 0)
/* Movie clip only */
#define EXPANDED_MCLIP(clip) (clip->flag & MCLIP_DATA_EXPAND)
/* AnimData - NLA mostly... */
#define SEL_ANIMDATA(adt) (adt->flag & ADT_UI_SELECTED)

View File

@ -146,6 +146,7 @@ enum {
MCLIP_USE_PROXY = (1 << 0),
MCLIP_USE_PROXY_CUSTOM_DIR = (1 << 1),
/* MCLIP_CUSTOM_START_FRAME = (1<<2), */ /* UNUSED */
MCLIP_DATA_EXPAND = (1 << 3),
MCLIP_TIMECODE_FLAGS = (MCLIP_USE_PROXY | MCLIP_USE_PROXY_CUSTOM_DIR)
};