Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/animation/anim_channels_defines.c
| Context not available. | |||||
| #include "BKE_animsys.h" | #include "BKE_animsys.h" | ||||
| #include "BKE_curve.h" | #include "BKE_curve.h" | ||||
| #include "BKE_gpencil.h" | |||||
| #include "BKE_key.h" | #include "BKE_key.h" | ||||
| #include "BKE_nla.h" | #include "BKE_nla.h" | ||||
| #include "BKE_context.h" | #include "BKE_context.h" | ||||
| Context not available. | |||||
| return ICON_OUTLINER_OB_SURFACE; | return ICON_OUTLINER_OB_SURFACE; | ||||
| case OB_EMPTY: | case OB_EMPTY: | ||||
| return ICON_OUTLINER_OB_EMPTY; | return ICON_OUTLINER_OB_EMPTY; | ||||
| case OB_GPENCIL: | |||||
| return ICON_OUTLINER_OB_GREASEPENCIL; | |||||
| default: | default: | ||||
| return ICON_OBJECT_DATA; | return ICON_OBJECT_DATA; | ||||
| } | } | ||||
| Context not available. | |||||
| acf_dsgpencil_setting_ptr /* pointer for setting */ | acf_dsgpencil_setting_ptr /* pointer for setting */ | ||||
| }; | }; | ||||
| /* Palette Expander ------------------------------------------- */ | |||||
| // TODO: just get this from RNA? | |||||
| static int acf_dspalette_icon(bAnimListElem *UNUSED(ale)) | |||||
| { | |||||
| return ICON_COLOR; | |||||
| } | |||||
| /* get the appropriate flag(s) for the setting when it is valid */ | |||||
| static int acf_dspalette_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 PALETTE_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_dspalette_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type) | |||||
| { | |||||
| Palette *palette = (Palette *)ale->data; | |||||
| /* clear extra return data first */ | |||||
| *type = 0; | |||||
| switch (setting) { | |||||
| case ACHANNEL_SETTING_EXPAND: /* expanded */ | |||||
| return GET_ACF_FLAG_PTR(palette->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 (palette->adt) | |||||
| return GET_ACF_FLAG_PTR(palette->adt->flag, type); | |||||
| return NULL; | |||||
| default: /* unsupported */ | |||||
| return NULL; | |||||
| } | |||||
| } | |||||
| /* grease pencil expander type define */ | |||||
| static bAnimChannelType ACF_DSPALETTE = | |||||
| { | |||||
| "Palette DS 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_idblock_name_prop, /* name prop */ | |||||
| acf_dspalette_icon, /* icon */ | |||||
| acf_generic_dataexpand_setting_valid, /* has setting */ | |||||
| acf_dspalette_setting_flag, /* flag for setting */ | |||||
| acf_dspalette_setting_ptr /* pointer for setting */ | |||||
| }; | |||||
| /* World Expander ------------------------------------------- */ | /* World Expander ------------------------------------------- */ | ||||
| // TODO: just get this from RNA? | // TODO: just get this from RNA? | ||||
| Context not available. | |||||
| animchannelTypeInfo[type++] = &ACF_NLATRACK; /* NLA Track */ | animchannelTypeInfo[type++] = &ACF_NLATRACK; /* NLA Track */ | ||||
| animchannelTypeInfo[type++] = &ACF_NLAACTION; /* NLA Action */ | animchannelTypeInfo[type++] = &ACF_NLAACTION; /* NLA Action */ | ||||
| animchannelTypeInfo[type++] = &ACF_DSPALETTE; /* Palette Channel */ | |||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| return; | return; | ||||
| } | } | ||||
| if (ale_setting->type == ANIMTYPE_GPLAYER) | if (ale_setting->type == ANIMTYPE_GPLAYER) { | ||||
| /* draw cache updates for settings that affect the visible strokes */ | |||||
| if (setting == ACHANNEL_SETTING_VISIBLE) { | |||||
| BKE_gpencil_batch_cache_dirty((bGPdata *)ale_setting->id); | |||||
| } | |||||
| /* UI updates */ | |||||
| WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, NULL); | WM_event_add_notifier(C, NC_GPENCIL | ND_DATA, NULL); | ||||
| } | |||||
| /* verify animation context */ | /* verify animation context */ | ||||
| if (ANIM_animdata_get_context(C, &ac) == 0) | if (ANIM_animdata_get_context(C, &ac) == 0) | ||||
| Context not available. | |||||