2 * ***** BEGIN GPL LICENSE BLOCK *****
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
19 * All rights reserved.
21 * Contributor(s): Joshua Leung
23 * ***** END GPL LICENSE BLOCK *****
26 /** \file blender/editors/animation/anim_channels_defines.c
27 * \ingroup edanimation
33 #include "MEM_guardedalloc.h"
35 #include "BLI_blenlib.h"
37 #include "BLI_utildefines.h"
39 #include "BLT_translation.h"
41 #include "DNA_anim_types.h"
42 #include "DNA_armature_types.h"
43 #include "DNA_cachefile_types.h"
44 #include "DNA_camera_types.h"
45 #include "DNA_object_types.h"
46 #include "DNA_particle_types.h"
47 #include "DNA_screen_types.h"
48 #include "DNA_scene_types.h"
49 #include "DNA_space_types.h"
50 #include "DNA_key_types.h"
51 #include "DNA_lamp_types.h"
52 #include "DNA_lattice_types.h"
53 #include "DNA_linestyle_types.h"
54 #include "DNA_mesh_types.h"
55 #include "DNA_material_types.h"
56 #include "DNA_meta_types.h"
57 #include "DNA_node_types.h"
58 #include "DNA_world_types.h"
59 #include "DNA_gpencil_types.h"
60 #include "DNA_speaker_types.h"
61 #include "DNA_mask_types.h"
63 #include "RNA_access.h"
65 #include "BKE_animsys.h"
66 #include "BKE_curve.h"
67 #include "BKE_gpencil.h"
71 #include "BKE_context.h"
73 #include "GPU_immediate.h"
74 #include "GPU_state.h"
76 #include "DEG_depsgraph.h"
78 #include "UI_interface.h"
79 #include "UI_interface_icons.h"
80 #include "UI_resources.h"
82 #include "ED_anim_api.h"
83 #include "ED_keyframing.h"
90 /* *********************************************** */
91 // XXX constant defines to be moved elsewhere?
93 /* extra padding for lengths (to go under scrollers) */
94 #define EXTRA_SCROLL_PAD 100.0f
96 /* size of indent steps */
97 #define INDENT_STEP_SIZE (0.35f * U.widget_unit)
99 /* size of string buffers used for animation channel displayed names */
100 #define ANIM_CHAN_NAME_SIZE 256
102 /* get the pointer used for some flag */
103 #define GET_ACF_FLAG_PTR(ptr, type) ((*(type) = sizeof((ptr))), &(ptr))
105 /* *********************************************** */
106 /* Generic Functions (Type independent) */
108 /* Draw Backdrop ---------------------------------- */
110 /* get backdrop color for top-level widgets (Scene and Object only) */
111 static void acf_generic_root_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
113 /* darker blue for top-level widgets */
114 UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELOB, r_color);
117 /* backdrop for top-level widgets (Scene and Object only) */
118 static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
120 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
121 View2D *v2d = &ac->ar->v2d;
122 short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
123 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
126 /* set backdrop drawing color */
127 acf->get_backdrop_color(ac, ale, color);
129 /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
130 UI_draw_roundbox_corner_set((expanded) ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
131 UI_draw_roundbox_3fvAlpha(true, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8, color, 1.0f);
135 /* get backdrop color for data expanders under top-level Scene/Object */
136 static void acf_generic_dataexpand_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
138 /* lighter color than top-level widget */
139 UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELSUBOB, r_color);
142 /* backdrop for data expanders under top-level Scene/Object */
143 static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
145 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
146 View2D *v2d = &ac->ar->v2d;
147 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
150 uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
152 /* set backdrop drawing color */
153 acf->get_backdrop_color(ac, ale, color);
155 immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
156 immUniformColor3fv(color);
158 /* no rounded corner - just rectangular box */
159 immRectf(pos, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
164 /* helper method to test if group colors should be drawn */
165 static bool acf_show_channel_colors(bAnimContext *ac)
167 bool showGroupColors = false;
170 switch (ac->spacetype) {
173 SpaceAction *saction = (SpaceAction *)ac->sl;
174 showGroupColors = !(saction->flag & SACTION_NODRAWGCOLORS);
180 SpaceIpo *sipo = (SpaceIpo *)ac->sl;
181 showGroupColors = !(sipo->flag & SIPO_NODRAWGCOLORS);
188 return showGroupColors;
191 /* get backdrop color for generic channels */
192 static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
194 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
195 bActionGroup *grp = NULL;
196 short indent = (acf->get_indent_level) ? acf->get_indent_level(ac, ale) : 0;
197 bool showGroupColors = acf_show_channel_colors(ac);
199 if (ale->type == ANIMTYPE_FCURVE) {
200 FCurve *fcu = (FCurve *)ale->data;
204 /* set color for normal channels
205 * - use 3 shades of color group/standard color for 3 indention level
206 * - only use group colors if allowed to, and if actually feasible
208 if (showGroupColors && (grp) && (grp->customCol)) {
212 copy_v3_v3_char((char *)cp, grp->cs.solid);
214 else if (indent == 1) {
215 copy_v3_v3_char((char *)cp, grp->cs.select);
218 copy_v3_v3_char((char *)cp, grp->cs.active);
221 /* copy the colors over, transforming from bytes to floats */
222 rgb_uchar_to_float(r_color, cp);
225 // FIXME: what happens when the indention is 1 greater than what it should be (due to grouping)?
226 int colOfs = 10 - 10 * indent;
227 UI_GetThemeColorShade3fv(TH_SHADE2, colOfs, r_color);
231 /* backdrop for generic channels */
232 static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
234 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
235 View2D *v2d = &ac->ar->v2d;
236 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
239 uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
241 /* set backdrop drawing color */
242 acf->get_backdrop_color(ac, ale, color);
244 immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
245 immUniformColor3fv(color);
247 /* no rounded corners - just rectangular box */
248 immRectf(pos, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
253 /* Indention + Offset ------------------------------------------- */
255 /* indention level is always the value in the name */
256 static short acf_generic_indention_0(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale))
260 static short acf_generic_indention_1(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale))
264 #if 0 // XXX not used
265 static short acf_generic_indention_2(bAnimContext *ac, bAnimListElem *ale)
271 /* indention which varies with the grouping status */
272 static short acf_generic_indention_flexible(bAnimContext *UNUSED(ac), bAnimListElem *ale)
276 /* grouped F-Curves need extra level of indention */
277 if (ale->type == ANIMTYPE_FCURVE) {
278 FCurve *fcu = (FCurve *)ale->data;
280 // TODO: we need some way of specifying that the indention color should be one less...
289 /* basic offset for channels derived from indention */
290 static short acf_generic_basic_offset(bAnimContext *ac, bAnimListElem *ale)
292 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
294 if (acf && acf->get_indent_level)
295 return acf->get_indent_level(ac, ale) * INDENT_STEP_SIZE;
300 /* offset based on nodetree type */
301 static short acf_nodetree_rootType_offset(bNodeTree *ntree)
304 switch (ntree->type) {
306 /* 1 additional level (i.e. is indented one level in from material,
307 * so shift all right by one step)
309 return INDENT_STEP_SIZE;
312 /* no additional levels needed */
316 /* 2 additional levels */
317 return INDENT_STEP_SIZE * 2;
325 /* offset for groups + grouped entities */
326 static short acf_generic_group_offset(bAnimContext *ac, bAnimListElem *ale)
328 short offset = acf_generic_basic_offset(ac, ale);
331 /* texture animdata */
332 if (GS(ale->id->name) == ID_TE) {
333 offset += U.widget_unit;
335 /* materials and particles animdata */
336 else if (ELEM(GS(ale->id->name), ID_MA, ID_PA))
337 offset += (short)(0.7f * U.widget_unit);
339 /* if not in Action Editor mode, action-groups (and their children) must carry some offset too... */
340 else if (ac->datatype != ANIMCONT_ACTION)
341 offset += (short)(0.7f * U.widget_unit);
343 /* nodetree animdata */
344 if (GS(ale->id->name) == ID_NT) {
345 offset += acf_nodetree_rootType_offset((bNodeTree *)ale->id);
349 /* offset is just the normal type - i.e. based on indention */
353 /* Name ------------------------------------------- */
355 /* name for ID block entries */
356 static void acf_generic_idblock_name(bAnimListElem *ale, char *name)
358 ID *id = (ID *)ale->data; /* data pointed to should be an ID block */
360 /* just copy the name... */
362 BLI_strncpy(name, id->name + 2, ANIM_CHAN_NAME_SIZE);
365 /* name property for ID block entries */
366 static bool acf_generic_idblock_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
368 RNA_id_pointer_create(ale->data, ptr);
369 *prop = RNA_struct_name_property(ptr->type);
371 return (*prop != NULL);
375 /* name property for ID block entries which are just subheading "fillers" */
376 static bool acf_generic_idfill_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
378 /* actual ID we're representing is stored in ale->data not ale->id, as id gives the owner */
379 RNA_id_pointer_create(ale->data, ptr);
380 *prop = RNA_struct_name_property(ptr->type);
382 return (*prop != NULL);
385 /* Settings ------------------------------------------- */
388 /* channel type has no settings */
389 static bool acf_generic_none_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
395 /* check if some setting exists for this object-based data-expander (datablock only) */
396 static bool acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
399 /* expand is always supported */
400 case ACHANNEL_SETTING_EXPAND:
403 /* mute is only supported for NLA */
404 case ACHANNEL_SETTING_MUTE:
405 return ((ac) && (ac->spacetype == SPACE_NLA));
407 /* select is ok for most "ds*" channels (e.g. dsmat) */
408 case ACHANNEL_SETTING_SELECT:
411 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
414 /* other flags are never supported */
420 /* *********************************************** */
421 /* Type Specific Functions + Defines */
423 /* Animation Summary ----------------------------------- */
425 /* get backdrop color for summary widget */
426 static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
428 /* reddish color - same as the 'action' line in NLA */
429 UI_GetThemeColor3fv(TH_ANIM_ACTIVE, r_color);
432 /* backdrop for summary widget */
433 static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
435 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
436 View2D *v2d = &ac->ar->v2d;
439 /* set backdrop drawing color */
440 acf->get_backdrop_color(ac, ale, color);
442 /* rounded corners on LHS only
444 * - special hack: make the top a bit higher, since we are first...
446 UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
447 UI_draw_roundbox_3fvAlpha(true, 0, yminc - 2, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8, color, 1.0f);
450 /* name for summary entries */
451 static void acf_summary_name(bAnimListElem *UNUSED(ale), char *name)
454 BLI_strncpy(name, IFACE_("Dope Sheet Summary"), ANIM_CHAN_NAME_SIZE);
457 // FIXME: this is really a temp icon I think
458 static int acf_summary_icon(bAnimListElem *UNUSED(ale))
460 return ICON_BORDERMOVE;
463 /* check if some setting exists for this channel */
464 static bool acf_summary_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
466 /* only expanded is supported, as it is used for hiding all stuff which the summary covers */
467 return (setting == ACHANNEL_SETTING_EXPAND);
470 /* get the appropriate flag(s) for the setting when it is valid */
471 static int acf_summary_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
473 if (setting == ACHANNEL_SETTING_EXPAND) {
476 return ADS_FLAG_SUMMARY_COLLAPSED;
485 /* get pointer to the setting */
486 static void *acf_summary_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
488 bAnimContext *ac = (bAnimContext *)ale->data;
490 /* if data is valid, return pointer to active dopesheet's relevant flag
491 * - this is restricted to DopeSheet/Action Editor only
493 if ((ac->sl) && (ac->spacetype == SPACE_ACTION) && (setting == ACHANNEL_SETTING_EXPAND)) {
494 SpaceAction *saction = (SpaceAction *)ac->sl;
495 bDopeSheet *ads = &saction->ads;
497 /* return pointer to DopeSheet's flag */
498 return GET_ACF_FLAG_PTR(ads->flag, type);
501 /* can't return anything useful - unsupported */
507 /* all animation summary (DopeSheet only) type define */
508 static bAnimChannelType ACF_SUMMARY =
510 "Summary", /* type name */
511 ACHANNEL_ROLE_EXPANDER, /* role */
513 acf_summary_color, /* backdrop color */
514 acf_summary_backdrop, /* backdrop */
515 acf_generic_indention_0, /* indent level */
518 acf_summary_name, /* name */
519 NULL, /* name prop */
520 acf_summary_icon, /* icon */
522 acf_summary_setting_valid, /* has setting */
523 acf_summary_setting_flag, /* flag for setting */
524 acf_summary_setting_ptr /* pointer for setting */
527 /* Scene ------------------------------------------- */
529 // TODO: just get this from RNA?
530 static int acf_scene_icon(bAnimListElem *UNUSED(ale))
532 return ICON_SCENE_DATA;
535 /* check if some setting exists for this channel */
536 static bool acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
539 /* muted only in NLA */
540 case ACHANNEL_SETTING_MUTE:
541 return ((ac) && (ac->spacetype == SPACE_NLA));
543 /* visible only in Graph Editor */
544 case ACHANNEL_SETTING_VISIBLE:
545 return ((ac) && (ac->spacetype == SPACE_IPO));
547 /* only select and expand supported otherwise */
548 case ACHANNEL_SETTING_SELECT:
549 case ACHANNEL_SETTING_EXPAND:
552 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
560 /* get the appropriate flag(s) for the setting when it is valid */
561 static int acf_scene_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
563 /* clear extra return data first */
567 case ACHANNEL_SETTING_SELECT: /* selected */
568 return SCE_DS_SELECTED;
570 case ACHANNEL_SETTING_EXPAND: /* expanded */
572 return SCE_DS_COLLAPSED;
574 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
575 return ADT_NLA_EVAL_OFF;
577 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
579 return ADT_CURVES_NOT_VISIBLE;
581 default: /* unsupported */
586 /* get pointer to the setting */
587 static void *acf_scene_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
589 Scene *scene = (Scene *)ale->data;
591 /* clear extra return data first */
595 case ACHANNEL_SETTING_SELECT: /* selected */
596 return GET_ACF_FLAG_PTR(scene->flag, type);
598 case ACHANNEL_SETTING_EXPAND: /* expanded */
599 return GET_ACF_FLAG_PTR(scene->flag, type);
601 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
602 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
604 return GET_ACF_FLAG_PTR(scene->adt->flag, type);
607 default: /* unsupported */
612 /* scene type define */
613 static bAnimChannelType ACF_SCENE =
615 "Scene", /* type name */
616 ACHANNEL_ROLE_EXPANDER, /* role */
618 acf_generic_root_color, /* backdrop color */
619 acf_generic_root_backdrop, /* backdrop */
620 acf_generic_indention_0, /* indent level */
623 acf_generic_idblock_name, /* name */
624 acf_generic_idblock_name_prop, /* name prop */
625 acf_scene_icon, /* icon */
627 acf_scene_setting_valid, /* has setting */
628 acf_scene_setting_flag, /* flag for setting */
629 acf_scene_setting_ptr /* pointer for setting */
632 /* Object ------------------------------------------- */
634 static int acf_object_icon(bAnimListElem *ale)
636 Base *base = (Base *)ale->data;
637 Object *ob = base->object;
639 /* icon depends on object-type */
642 return ICON_OUTLINER_OB_LIGHT;
644 return ICON_OUTLINER_OB_MESH;
646 return ICON_OUTLINER_OB_CAMERA;
648 return ICON_OUTLINER_OB_CURVE;
650 return ICON_OUTLINER_OB_META;
652 return ICON_OUTLINER_OB_LATTICE;
654 return ICON_OUTLINER_OB_SPEAKER;
656 return ICON_OUTLINER_OB_LIGHTPROBE;
658 return ICON_OUTLINER_OB_ARMATURE;
660 return ICON_OUTLINER_OB_FONT;
662 return ICON_OUTLINER_OB_SURFACE;
664 return ICON_OUTLINER_OB_EMPTY;
666 return ICON_OUTLINER_OB_GREASEPENCIL;
668 return ICON_OBJECT_DATA;
672 /* name for object */
673 static void acf_object_name(bAnimListElem *ale, char *name)
675 Base *base = (Base *)ale->data;
676 Object *ob = base->object;
678 /* just copy the name... */
680 BLI_strncpy(name, ob->id.name + 2, ANIM_CHAN_NAME_SIZE);
683 /* name property for object */
684 static bool acf_object_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
686 RNA_id_pointer_create(ale->id, ptr);
687 *prop = RNA_struct_name_property(ptr->type);
689 return (*prop != NULL);
692 /* check if some setting exists for this channel */
693 static bool acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
695 Base *base = (Base *)ale->data;
696 Object *ob = base->object;
699 /* muted only in NLA */
700 case ACHANNEL_SETTING_MUTE:
701 return ((ac) && (ac->spacetype == SPACE_NLA));
703 /* visible only in Graph Editor */
704 case ACHANNEL_SETTING_VISIBLE:
705 return ((ac) && (ac->spacetype == SPACE_IPO) && (ob->adt));
707 /* only select and expand supported otherwise */
708 case ACHANNEL_SETTING_SELECT:
709 case ACHANNEL_SETTING_EXPAND:
712 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
713 return ((ac) && (ac->spacetype == SPACE_IPO) && (ob->adt));
720 /* get the appropriate flag(s) for the setting when it is valid */
721 static int acf_object_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
723 /* clear extra return data first */
727 case ACHANNEL_SETTING_SELECT: /* selected */
730 case ACHANNEL_SETTING_EXPAND: /* expanded */
732 return OB_ADS_COLLAPSED;
734 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
735 return ADT_NLA_EVAL_OFF;
737 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
739 return ADT_CURVES_NOT_VISIBLE;
741 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
742 return ADT_CURVES_ALWAYS_VISIBLE;
744 default: /* unsupported */
749 /* get pointer to the setting */
750 static void *acf_object_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
752 Base *base = (Base *)ale->data;
753 Object *ob = base->object;
755 /* clear extra return data first */
759 case ACHANNEL_SETTING_SELECT: /* selected */
760 return GET_ACF_FLAG_PTR(ob->flag, type);
762 case ACHANNEL_SETTING_EXPAND: /* expanded */
763 return GET_ACF_FLAG_PTR(ob->nlaflag, type); // xxx
765 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
766 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
767 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
769 return GET_ACF_FLAG_PTR(ob->adt->flag, type);
772 default: /* unsupported */
777 /* object type define */
778 static bAnimChannelType ACF_OBJECT =
780 "Object", /* type name */
781 ACHANNEL_ROLE_EXPANDER, /* role */
783 acf_generic_root_color, /* backdrop color */
784 acf_generic_root_backdrop, /* backdrop */
785 acf_generic_indention_0, /* indent level */
788 acf_object_name, /* name */
789 acf_object_name_prop, /* name prop */
790 acf_object_icon, /* icon */
792 acf_object_setting_valid, /* has setting */
793 acf_object_setting_flag, /* flag for setting */
794 acf_object_setting_ptr /* pointer for setting */
797 /* Group ------------------------------------------- */
799 /* get backdrop color for group widget */
800 static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
802 bActionGroup *agrp = (bActionGroup *)ale->data;
803 bool showGroupColors = acf_show_channel_colors(ac);
805 if (showGroupColors && agrp->customCol) {
808 /* highlight only for active */
809 if (ale->flag & AGRP_ACTIVE)
810 copy_v3_v3_char((char *)cp, agrp->cs.select);
812 copy_v3_v3_char((char *)cp, agrp->cs.solid);
814 /* copy the colors over, transforming from bytes to floats */
815 rgb_uchar_to_float(r_color, cp);
818 /* highlight only for active */
819 if (ale->flag & AGRP_ACTIVE)
820 UI_GetThemeColor3fv(TH_GROUP_ACTIVE, r_color);
822 UI_GetThemeColor3fv(TH_GROUP, r_color);
826 /* backdrop for group widget */
827 static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
829 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
830 View2D *v2d = &ac->ar->v2d;
831 short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
832 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
835 /* set backdrop drawing color */
836 acf->get_backdrop_color(ac, ale, color);
838 /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
839 UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
840 UI_draw_roundbox_3fvAlpha(true, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8, color, 1.0f);
843 /* name for group entries */
844 static void acf_group_name(bAnimListElem *ale, char *name)
846 bActionGroup *agrp = (bActionGroup *)ale->data;
848 /* just copy the name... */
850 BLI_strncpy(name, agrp->name, ANIM_CHAN_NAME_SIZE);
853 /* name property for group entries */
854 static bool acf_group_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
856 RNA_pointer_create(ale->id, &RNA_ActionGroup, ale->data, ptr);
857 *prop = RNA_struct_name_property(ptr->type);
859 return (*prop != NULL);
862 /* check if some setting exists for this channel */
863 static bool acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
865 /* for now, all settings are supported, though some are only conditionally */
868 case ACHANNEL_SETTING_SOLO: /* Only available in NLA Editor for tracks */
871 /* conditionally supported */
872 case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
873 return (ac->spacetype == SPACE_IPO);
875 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
876 return (ac->spacetype == SPACE_IPO);
878 default: /* always supported */
883 /* get the appropriate flag(s) for the setting when it is valid */
884 static int acf_group_setting_flag(bAnimContext *ac, eAnimChannel_Settings setting, bool *neg)
886 /* clear extra return data first */
890 case ACHANNEL_SETTING_SELECT: /* selected */
891 return AGRP_SELECTED;
893 case ACHANNEL_SETTING_EXPAND: /* expanded */
895 /* NOTE: Graph Editor uses a different flag to everywhere else for this,
896 * allowing different collapsing of groups there, since sharing the flag
897 * proved to be a hazard for workflows...
899 return (ac->spacetype == SPACE_IPO) ?
900 AGRP_EXPANDED_G : /* Graph Editor case */
901 AGRP_EXPANDED; /* DopeSheet and elsewhere */
904 case ACHANNEL_SETTING_MUTE: /* muted */
907 case ACHANNEL_SETTING_MOD_OFF: /* muted */
909 return AGRP_MODIFIERS_OFF;
911 case ACHANNEL_SETTING_PROTECT: /* protected */
912 return AGRP_PROTECTED;
914 case ACHANNEL_SETTING_VISIBLE: /* visibility - graph editor */
916 return AGRP_NOTVISIBLE;
918 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
919 return ADT_CURVES_ALWAYS_VISIBLE;
922 /* this shouldn't happen */
927 /* get pointer to the setting */
928 static void *acf_group_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
930 bActionGroup *agrp = (bActionGroup *)ale->data;
932 /* all flags are just in agrp->flag for now... */
933 return GET_ACF_FLAG_PTR(agrp->flag, type);
936 /* group type define */
937 static bAnimChannelType ACF_GROUP =
939 "Group", /* type name */
940 ACHANNEL_ROLE_CHANNEL, /* role */
942 acf_group_color, /* backdrop color */
943 acf_group_backdrop, /* backdrop */
944 acf_generic_indention_0, /* indent level */
945 acf_generic_group_offset, /* offset */
947 acf_group_name, /* name */
948 acf_group_name_prop, /* name prop */
951 acf_group_setting_valid, /* has setting */
952 acf_group_setting_flag, /* flag for setting */
953 acf_group_setting_ptr /* pointer for setting */
956 /* F-Curve ------------------------------------------- */
958 /* name for fcurve entries */
959 static void acf_fcurve_name(bAnimListElem *ale, char *name)
961 getname_anim_fcurve(name, ale->id, ale->data);
964 /* "name" property for fcurve entries */
965 static bool acf_fcurve_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
967 FCurve *fcu = (FCurve *)ale->data;
969 /* Ctrl-Click Usability Convenience Hack:
970 * For disabled F-Curves, allow access to the RNA Path
971 * as our "name" so that user can perform quick fixes
973 if (fcu->flag & FCURVE_DISABLED) {
974 RNA_pointer_create(ale->id, &RNA_FCurve, ale->data, ptr);
975 *prop = RNA_struct_find_property(ptr, "data_path");
978 /* for "normal" F-Curves - no editable name, but *prop may not be set properly yet... */
982 return (*prop != NULL);
985 /* check if some setting exists for this channel */
986 static bool acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
988 FCurve *fcu = (FCurve *)ale->data;
992 case ACHANNEL_SETTING_SOLO: /* Solo Flag is only for NLA */
993 case ACHANNEL_SETTING_EXPAND: /* F-Curves are not containers */
994 case ACHANNEL_SETTING_PINNED: /* This is only for NLA Actions */
997 /* conditionally available */
998 case ACHANNEL_SETTING_PROTECT: /* Protection is only valid when there's keyframes */
1002 return false; // NOTE: in this special case, we need to draw ICON_ZOOMOUT
1004 case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
1005 return (ac->spacetype == SPACE_IPO);
1007 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
1010 /* always available */
1016 /* get the appropriate flag(s) for the setting when it is valid */
1017 static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1019 /* clear extra return data first */
1023 case ACHANNEL_SETTING_SELECT: /* selected */
1024 return FCURVE_SELECTED;
1026 case ACHANNEL_SETTING_MUTE: /* muted */
1027 return FCURVE_MUTED;
1029 case ACHANNEL_SETTING_PROTECT: /* protected */
1030 return FCURVE_PROTECTED;
1032 case ACHANNEL_SETTING_VISIBLE: /* visibility - graph editor */
1033 return FCURVE_VISIBLE;
1035 case ACHANNEL_SETTING_MOD_OFF:
1037 return FCURVE_MOD_OFF;
1039 default: /* unsupported */
1044 /* get pointer to the setting */
1045 static void *acf_fcurve_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
1047 FCurve *fcu = (FCurve *)ale->data;
1049 /* all flags are just in agrp->flag for now... */
1050 return GET_ACF_FLAG_PTR(fcu->flag, type);
1053 /* fcurve type define */
1054 static bAnimChannelType ACF_FCURVE =
1056 "F-Curve", /* type name */
1057 ACHANNEL_ROLE_CHANNEL, /* role */
1059 acf_generic_channel_color, /* backdrop color */
1060 acf_generic_channel_backdrop, /* backdrop */
1061 acf_generic_indention_flexible, /* indent level */ // xxx rename this to f-curves only?
1062 acf_generic_group_offset, /* offset */
1064 acf_fcurve_name, /* name */
1065 acf_fcurve_name_prop, /* name prop */
1068 acf_fcurve_setting_valid, /* has setting */
1069 acf_fcurve_setting_flag, /* flag for setting */
1070 acf_fcurve_setting_ptr /* pointer for setting */
1073 /* NLA Control FCurves Expander ----------------------- */
1075 /* get backdrop color for nla controls widget */
1076 static void acf_nla_controls_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
1078 // TODO: give this its own theme setting?
1079 UI_GetThemeColorShade3fv(TH_GROUP, 55, r_color);
1082 /* backdrop for nla controls expander widget */
1083 static void acf_nla_controls_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
1085 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
1086 View2D *v2d = &ac->ar->v2d;
1087 short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
1088 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
1091 /* set backdrop drawing color */
1092 acf->get_backdrop_color(ac, ale, color);
1094 /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
1095 UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
1096 UI_draw_roundbox_3fvAlpha(true, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 5, color, 1.0f);
1099 /* name for nla controls expander entries */
1100 static void acf_nla_controls_name(bAnimListElem *UNUSED(ale), char *name)
1102 BLI_strncpy(name, IFACE_("NLA Strip Controls"), ANIM_CHAN_NAME_SIZE);
1105 /* check if some setting exists for this channel */
1106 static bool acf_nla_controls_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
1108 /* for now, all settings are supported, though some are only conditionally */
1111 case ACHANNEL_SETTING_EXPAND:
1116 default: /* unsupported */
1121 /* get the appropriate flag(s) for the setting when it is valid */
1122 static int acf_nla_controls_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1124 /* clear extra return data first */
1128 case ACHANNEL_SETTING_EXPAND: /* expanded */
1130 return ADT_NLA_SKEYS_COLLAPSED;
1133 /* this shouldn't happen */
1138 /* get pointer to the setting */
1139 static void *acf_nla_controls_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
1141 AnimData *adt = (AnimData *)ale->data;
1143 /* all flags are just in adt->flag for now... */
1144 return GET_ACF_FLAG_PTR(adt->flag, type);
1147 static int acf_nla_controls_icon(bAnimListElem *UNUSED(ale))
1152 /* NLA Control FCurves Expander type define */
1153 static bAnimChannelType ACF_NLACONTROLS =
1155 "NLA Controls Expander", /* type name */
1156 ACHANNEL_ROLE_EXPANDER, /* role */
1158 acf_nla_controls_color, /* backdrop color */
1159 acf_nla_controls_backdrop, /* backdrop */
1160 acf_generic_indention_0, /* indent level */
1161 acf_generic_group_offset, /* offset */
1163 acf_nla_controls_name, /* name */
1164 NULL, /* name prop */
1165 acf_nla_controls_icon, /* icon */
1167 acf_nla_controls_setting_valid, /* has setting */
1168 acf_nla_controls_setting_flag, /* flag for setting */
1169 acf_nla_controls_setting_ptr /* pointer for setting */
1173 /* NLA Control F-Curve -------------------------------- */
1175 /* name for nla control fcurve entries */
1176 static void acf_nla_curve_name(bAnimListElem *ale, char *name)
1178 NlaStrip *strip = ale->owner;
1179 FCurve *fcu = ale->data;
1182 /* try to get RNA property that this shortened path (relative to the strip) refers to */
1183 prop = RNA_struct_type_find_property(&RNA_NlaStrip, fcu->rna_path);
1185 /* "name" of this strip displays the UI identifier + the name of the NlaStrip */
1186 BLI_snprintf(name, 256, "%s (%s)", RNA_property_ui_name(prop), strip->name);
1189 /* unknown property... */
1190 BLI_snprintf(name, 256, "%s[%d]", fcu->rna_path, fcu->array_index);
1195 /* NLA Control F-Curve type define */
1196 static bAnimChannelType ACF_NLACURVE =
1198 "NLA Control F-Curve", /* type name */
1199 ACHANNEL_ROLE_CHANNEL, /* role */
1201 acf_generic_channel_color, /* backdrop color */
1202 acf_generic_channel_backdrop, /* backdrop */
1203 acf_generic_indention_1, /* indent level */
1204 acf_generic_group_offset, /* offset */
1206 acf_nla_curve_name, /* name */
1207 acf_fcurve_name_prop, /* name prop */
1210 acf_fcurve_setting_valid, /* has setting */
1211 acf_fcurve_setting_flag, /* flag for setting */
1212 acf_fcurve_setting_ptr /* pointer for setting */
1215 /* Object Action Expander ------------------------------------------- */
1217 // TODO: just get this from RNA?
1218 static int acf_fillactd_icon(bAnimListElem *UNUSED(ale))
1223 /* check if some setting exists for this channel */
1224 static bool acf_fillactd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
1227 /* only select and expand supported */
1228 case ACHANNEL_SETTING_SELECT:
1229 case ACHANNEL_SETTING_EXPAND:
1237 /* get the appropriate flag(s) for the setting when it is valid */
1238 static int acf_fillactd_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1240 /* clear extra return data first */
1244 case ACHANNEL_SETTING_SELECT: /* selected */
1245 return ADT_UI_SELECTED;
1247 case ACHANNEL_SETTING_EXPAND: /* expanded */
1249 return ACT_COLLAPSED;
1251 default: /* unsupported */
1256 /* get pointer to the setting */
1257 static void *acf_fillactd_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1259 bAction *act = (bAction *)ale->data;
1260 AnimData *adt = ale->adt;
1262 /* clear extra return data first */
1266 case ACHANNEL_SETTING_SELECT: /* selected */
1268 return GET_ACF_FLAG_PTR(adt->flag, type);
1272 case ACHANNEL_SETTING_EXPAND: /* expanded */
1273 return GET_ACF_FLAG_PTR(act->flag, type);
1275 default: /* unsupported */
1280 /* object action expander type define */
1281 static bAnimChannelType ACF_FILLACTD =
1283 "Ob-Action Filler", /* type name */
1284 ACHANNEL_ROLE_EXPANDER, /* role */
1286 acf_generic_dataexpand_color, /* backdrop color */
1287 acf_generic_dataexpand_backdrop, /* backdrop */
1288 acf_generic_indention_1, /* indent level */
1289 acf_generic_basic_offset, /* offset */
1291 acf_generic_idblock_name, /* name */
1292 acf_generic_idfill_name_prop, /* name prop */
1293 acf_fillactd_icon, /* icon */
1295 acf_fillactd_setting_valid, /* has setting */
1296 acf_fillactd_setting_flag, /* flag for setting */
1297 acf_fillactd_setting_ptr /* pointer for setting */
1300 /* Drivers Expander ------------------------------------------- */
1302 // TODO: just get this from RNA?
1303 static int acf_filldrivers_icon(bAnimListElem *UNUSED(ale))
1308 static void acf_filldrivers_name(bAnimListElem *UNUSED(ale), char *name)
1310 BLI_strncpy(name, IFACE_("Drivers"), ANIM_CHAN_NAME_SIZE);
1313 /* check if some setting exists for this channel */
1314 // TODO: this could be made more generic
1315 static bool acf_filldrivers_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
1318 /* only expand supported */
1319 case ACHANNEL_SETTING_EXPAND:
1327 /* get the appropriate flag(s) for the setting when it is valid */
1328 static int acf_filldrivers_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1330 /* clear extra return data first */
1334 case ACHANNEL_SETTING_EXPAND: /* expanded */
1336 return ADT_DRIVERS_COLLAPSED;
1338 default: /* unsupported */
1343 /* get pointer to the setting */
1344 static void *acf_filldrivers_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1346 AnimData *adt = (AnimData *)ale->data;
1348 /* clear extra return data first */
1352 case ACHANNEL_SETTING_EXPAND: /* expanded */
1353 return GET_ACF_FLAG_PTR(adt->flag, type);
1355 default: /* unsupported */
1360 /* drivers expander type define */
1361 static bAnimChannelType ACF_FILLDRIVERS =
1363 "Drivers Filler", /* type name */
1364 ACHANNEL_ROLE_EXPANDER, /* role */
1366 acf_generic_dataexpand_color, /* backdrop color */
1367 acf_generic_dataexpand_backdrop, /* backdrop */
1368 acf_generic_indention_1, /* indent level */
1369 acf_generic_basic_offset, /* offset */
1371 acf_filldrivers_name, /* name */
1372 NULL, /* name prop */
1373 acf_filldrivers_icon, /* icon */
1375 acf_filldrivers_setting_valid, /* has setting */
1376 acf_filldrivers_setting_flag, /* flag for setting */
1377 acf_filldrivers_setting_ptr /* pointer for setting */
1381 /* Material Expander ------------------------------------------- */
1383 // TODO: just get this from RNA?
1384 static int acf_dsmat_icon(bAnimListElem *UNUSED(ale))
1386 return ICON_MATERIAL_DATA;
1389 /* get the appropriate flag(s) for the setting when it is valid */
1390 static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1392 /* clear extra return data first */
1396 case ACHANNEL_SETTING_EXPAND: /* expanded */
1397 return MA_DS_EXPAND;
1399 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1400 return ADT_NLA_EVAL_OFF;
1402 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1404 return ADT_CURVES_NOT_VISIBLE;
1406 case ACHANNEL_SETTING_SELECT: /* selected */
1407 return ADT_UI_SELECTED;
1409 default: /* unsupported */
1414 /* get pointer to the setting */
1415 static void *acf_dsmat_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1417 Material *ma = (Material *)ale->data;
1419 /* clear extra return data first */
1423 case ACHANNEL_SETTING_EXPAND: /* expanded */
1424 return GET_ACF_FLAG_PTR(ma->flag, type);
1426 case ACHANNEL_SETTING_SELECT: /* selected */
1427 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1428 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1430 return GET_ACF_FLAG_PTR(ma->adt->flag, type);
1433 default: /* unsupported */
1438 /* material expander type define */
1439 static bAnimChannelType ACF_DSMAT =
1441 "Material Data Expander", /* type name */
1442 ACHANNEL_ROLE_EXPANDER, /* role */
1444 acf_generic_dataexpand_color, /* backdrop color */
1445 acf_generic_dataexpand_backdrop, /* backdrop */
1446 acf_generic_indention_1, /* indent level */
1447 acf_generic_basic_offset, /* offset */
1449 acf_generic_idblock_name, /* name */
1450 acf_generic_idblock_name_prop, /* name prop */
1451 acf_dsmat_icon, /* icon */
1453 acf_generic_dataexpand_setting_valid, /* has setting */
1454 acf_dsmat_setting_flag, /* flag for setting */
1455 acf_dsmat_setting_ptr /* pointer for setting */
1458 /* Light Expander ------------------------------------------- */
1460 // TODO: just get this from RNA?
1461 static int acf_dslight_icon(bAnimListElem *UNUSED(ale))
1463 return ICON_LIGHT_DATA;
1466 /* get the appropriate flag(s) for the setting when it is valid */
1467 static int acf_dslight_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1469 /* clear extra return data first */
1473 case ACHANNEL_SETTING_EXPAND: /* expanded */
1474 return LA_DS_EXPAND;
1476 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1477 return ADT_NLA_EVAL_OFF;
1479 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1481 return ADT_CURVES_NOT_VISIBLE;
1483 case ACHANNEL_SETTING_SELECT: /* selected */
1484 return ADT_UI_SELECTED;
1486 default: /* unsupported */
1491 /* get pointer to the setting */
1492 static void *acf_dslight_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1494 Lamp *la = (Lamp *)ale->data;
1496 /* clear extra return data first */
1500 case ACHANNEL_SETTING_EXPAND: /* expanded */
1501 return GET_ACF_FLAG_PTR(la->flag, type);
1503 case ACHANNEL_SETTING_SELECT: /* selected */
1504 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1505 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1507 return GET_ACF_FLAG_PTR(la->adt->flag, type);
1510 default: /* unsupported */
1515 /* lamp expander type define */
1516 static bAnimChannelType ACF_DSLIGHT =
1518 "Light Expander", /* type name */
1519 ACHANNEL_ROLE_EXPANDER, /* role */
1521 acf_generic_dataexpand_color, /* backdrop color */
1522 acf_generic_dataexpand_backdrop, /* backdrop */
1523 acf_generic_indention_1, /* indent level */
1524 acf_generic_basic_offset, /* offset */
1526 acf_generic_idblock_name, /* name */
1527 acf_generic_idblock_name_prop, /* name prop */
1528 acf_dslight_icon, /* icon */
1530 acf_generic_dataexpand_setting_valid, /* has setting */
1531 acf_dslight_setting_flag, /* flag for setting */
1532 acf_dslight_setting_ptr /* pointer for setting */
1535 /* Texture Expander ------------------------------------------- */
1537 // TODO: just get this from RNA?
1538 static int acf_dstex_icon(bAnimListElem *UNUSED(ale))
1540 return ICON_TEXTURE_DATA;
1543 /* offset for texture expanders */
1544 // FIXME: soon to be obsolete?
1545 static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale))
1547 return 14; // XXX: simply include this in indention instead?
1550 /* get the appropriate flag(s) for the setting when it is valid */
1551 static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1553 /* clear extra return data first */
1557 case ACHANNEL_SETTING_EXPAND: /* expanded */
1558 return TEX_DS_EXPAND;
1560 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1561 return ADT_NLA_EVAL_OFF;
1563 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1565 return ADT_CURVES_NOT_VISIBLE;
1567 case ACHANNEL_SETTING_SELECT: /* selected */
1568 return ADT_UI_SELECTED;
1570 default: /* unsupported */
1575 /* get pointer to the setting */
1576 static void *acf_dstex_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1578 Tex *tex = (Tex *)ale->data;
1580 /* clear extra return data first */
1584 case ACHANNEL_SETTING_EXPAND: /* expanded */
1585 return GET_ACF_FLAG_PTR(tex->flag, type);
1587 case ACHANNEL_SETTING_SELECT: /* selected */
1588 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1589 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1591 return GET_ACF_FLAG_PTR(tex->adt->flag, type);
1594 default: /* unsupported */
1599 /* texture expander type define */
1600 static bAnimChannelType ACF_DSTEX =
1602 "Texture Data Expander", /* type name */
1603 ACHANNEL_ROLE_EXPANDER, /* role */
1605 acf_generic_dataexpand_color, /* backdrop color */
1606 acf_generic_dataexpand_backdrop, /* backdrop */
1607 acf_generic_indention_1, /* indent level */
1608 acf_dstex_offset, /* offset */
1610 acf_generic_idblock_name, /* name */
1611 acf_generic_idfill_name_prop, /* name prop */
1612 acf_dstex_icon, /* icon */
1614 acf_generic_dataexpand_setting_valid, /* has setting */
1615 acf_dstex_setting_flag, /* flag for setting */
1616 acf_dstex_setting_ptr /* pointer for setting */
1619 /* Camera Expander ------------------------------------------- */
1621 // TODO: just get this from RNA?
1622 static int acf_dscachefile_icon(bAnimListElem *ale)
1628 /* get the appropriate flag(s) for the setting when it is valid */
1629 static int acf_dscachefile_setting_flag(bAnimContext *ac, eAnimChannel_Settings setting, bool *neg)
1631 /* clear extra return data first */
1635 case ACHANNEL_SETTING_EXPAND: /* expanded */
1636 return CACHEFILE_DS_EXPAND;
1638 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1639 return ADT_NLA_EVAL_OFF;
1641 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1643 return ADT_CURVES_NOT_VISIBLE;
1645 case ACHANNEL_SETTING_SELECT: /* selected */
1646 return ADT_UI_SELECTED;
1648 default: /* unsupported */
1655 /* get pointer to the setting */
1656 static void *acf_dscachefile_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1658 CacheFile *cache_file = (CacheFile *)ale->data;
1660 /* clear extra return data first */
1664 case ACHANNEL_SETTING_EXPAND: /* expanded */
1665 return GET_ACF_FLAG_PTR(cache_file->flag, type);
1667 case ACHANNEL_SETTING_SELECT: /* selected */
1668 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1669 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1670 if (cache_file->adt) {
1671 return GET_ACF_FLAG_PTR(cache_file->adt->flag, type);
1676 default: /* unsupported */
1681 /* CacheFile expander type define. */
1682 static bAnimChannelType ACF_DSCACHEFILE =
1684 "Cache File Expander", /* type name */
1685 ACHANNEL_ROLE_EXPANDER, /* role */
1687 acf_generic_dataexpand_color, /* backdrop color */
1688 acf_generic_dataexpand_backdrop, /* backdrop */
1689 acf_generic_indention_1, /* indent level */
1690 acf_generic_basic_offset, /* offset */
1692 acf_generic_idblock_name, /* name */
1693 acf_generic_idfill_name_prop, /* name prop */
1694 acf_dscachefile_icon, /* icon */
1696 acf_generic_dataexpand_setting_valid, /* has setting */
1697 acf_dscachefile_setting_flag, /* flag for setting */
1698 acf_dscachefile_setting_ptr /* pointer for setting */
1701 /* Camera Expander ------------------------------------------- */
1703 // TODO: just get this from RNA?
1704 static int acf_dscam_icon(bAnimListElem *UNUSED(ale))
1706 return ICON_CAMERA_DATA;
1709 /* get the appropriate flag(s) for the setting when it is valid */
1710 static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1712 /* clear extra return data first */
1716 case ACHANNEL_SETTING_EXPAND: /* expanded */
1717 return CAM_DS_EXPAND;
1719 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1720 return ADT_NLA_EVAL_OFF;
1722 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1724 return ADT_CURVES_NOT_VISIBLE;
1726 case ACHANNEL_SETTING_SELECT: /* selected */
1727 return ADT_UI_SELECTED;
1729 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
1730 return ADT_CURVES_ALWAYS_VISIBLE;
1732 default: /* unsupported */
1737 /* get pointer to the setting */
1738 static void *acf_dscam_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1740 Camera *ca = (Camera *)ale->data;
1742 /* clear extra return data first */
1746 case ACHANNEL_SETTING_EXPAND: /* expanded */
1747 return GET_ACF_FLAG_PTR(ca->flag, type);
1749 case ACHANNEL_SETTING_SELECT: /* selected */
1750 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1751 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1752 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
1754 return GET_ACF_FLAG_PTR(ca->adt->flag, type);
1757 default: /* unsupported */
1762 /* camera expander type define */
1763 static bAnimChannelType ACF_DSCAM =
1765 "Camera Expander", /* type name */
1766 ACHANNEL_ROLE_EXPANDER, /* role */
1768 acf_generic_dataexpand_color, /* backdrop color */
1769 acf_generic_dataexpand_backdrop, /* backdrop */
1770 acf_generic_indention_1, /* indent level */
1771 acf_generic_basic_offset, /* offset */
1773 acf_generic_idblock_name, /* name */
1774 acf_generic_idfill_name_prop, /* name prop */
1775 acf_dscam_icon, /* icon */
1777 acf_generic_dataexpand_setting_valid, /* has setting */
1778 acf_dscam_setting_flag, /* flag for setting */
1779 acf_dscam_setting_ptr /* pointer for setting */
1782 /* Curve Expander ------------------------------------------- */
1784 // TODO: just get this from RNA?
1785 static int acf_dscur_icon(bAnimListElem *ale)
1787 Curve *cu = (Curve *)ale->data;
1788 short obtype = BKE_curve_type_get(cu);
1792 return ICON_FONT_DATA;
1794 return ICON_SURFACE_DATA;
1796 return ICON_CURVE_DATA;
1800 /* get the appropriate flag(s) for the setting when it is valid */
1801 static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1803 /* clear extra return data first */
1807 case ACHANNEL_SETTING_EXPAND: /* expanded */
1808 return CU_DS_EXPAND;
1810 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1811 return ADT_NLA_EVAL_OFF;
1813 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1815 return ADT_CURVES_NOT_VISIBLE;
1817 case ACHANNEL_SETTING_SELECT: /* selected */
1818 return ADT_UI_SELECTED;
1820 default: /* unsupported */
1825 /* get pointer to the setting */
1826 static void *acf_dscur_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1828 Curve *cu = (Curve *)ale->data;
1830 /* clear extra return data first */
1834 case ACHANNEL_SETTING_EXPAND: /* expanded */
1835 return GET_ACF_FLAG_PTR(cu->flag, type);
1837 case ACHANNEL_SETTING_SELECT: /* selected */
1838 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1839 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1841 return GET_ACF_FLAG_PTR(cu->adt->flag, type);
1844 default: /* unsupported */
1849 /* curve expander type define */
1850 static bAnimChannelType ACF_DSCUR =
1852 "Curve Expander", /* type name */
1853 ACHANNEL_ROLE_EXPANDER, /* role */
1855 acf_generic_dataexpand_color, /* backdrop color */
1856 acf_generic_dataexpand_backdrop, /* backdrop */
1857 acf_generic_indention_1, /* indent level */
1858 acf_generic_basic_offset, /* offset */
1860 acf_generic_idblock_name, /* name */
1861 acf_generic_idblock_name_prop, /* name prop */
1862 acf_dscur_icon, /* icon */
1864 acf_generic_dataexpand_setting_valid, /* has setting */
1865 acf_dscur_setting_flag, /* flag for setting */
1866 acf_dscur_setting_ptr /* pointer for setting */
1869 /* Shape Key Expander ------------------------------------------- */
1871 // TODO: just get this from RNA?
1872 static int acf_dsskey_icon(bAnimListElem *UNUSED(ale))
1874 return ICON_SHAPEKEY_DATA;
1877 /* get the appropriate flag(s) for the setting when it is valid */
1878 static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1880 /* clear extra return data first */
1884 case ACHANNEL_SETTING_EXPAND: /* expanded */
1885 return KEY_DS_EXPAND;
1887 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1888 return ADT_NLA_EVAL_OFF;
1890 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1892 return ADT_CURVES_NOT_VISIBLE;
1894 case ACHANNEL_SETTING_SELECT: /* selected */
1895 return ADT_UI_SELECTED;
1897 default: /* unsupported */
1902 /* get pointer to the setting */
1903 static void *acf_dsskey_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1905 Key *key = (Key *)ale->data;
1907 /* clear extra return data first */
1911 case ACHANNEL_SETTING_EXPAND: /* expanded */
1912 return GET_ACF_FLAG_PTR(key->flag, type);
1914 case ACHANNEL_SETTING_SELECT: /* selected */
1915 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1916 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1918 return GET_ACF_FLAG_PTR(key->adt->flag, type);
1921 default: /* unsupported */
1926 /* shapekey expander type define */
1927 static bAnimChannelType ACF_DSSKEY =
1929 "Shape Key Expander", /* type name */
1930 ACHANNEL_ROLE_EXPANDER, /* role */
1932 acf_generic_dataexpand_color, /* backdrop color */
1933 acf_generic_dataexpand_backdrop, /* backdrop */
1934 acf_generic_indention_1, /* indent level */
1935 acf_generic_basic_offset, /* offset */
1937 acf_generic_idblock_name, /* name */
1938 acf_generic_idblock_name_prop, /* name prop */
1939 acf_dsskey_icon, /* icon */
1941 acf_generic_dataexpand_setting_valid, /* has setting */
1942 acf_dsskey_setting_flag, /* flag for setting */
1943 acf_dsskey_setting_ptr /* pointer for setting */
1946 /* World Expander ------------------------------------------- */
1948 // TODO: just get this from RNA?
1949 static int acf_dswor_icon(bAnimListElem *UNUSED(ale))
1951 return ICON_WORLD_DATA;
1954 /* get the appropriate flag(s) for the setting when it is valid */
1955 static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1957 /* clear extra return data first */
1961 case ACHANNEL_SETTING_EXPAND: /* expanded */
1962 return WO_DS_EXPAND;
1964 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1965 return ADT_NLA_EVAL_OFF;
1967 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1969 return ADT_CURVES_NOT_VISIBLE;
1971 case ACHANNEL_SETTING_SELECT: /* selected */
1972 return ADT_UI_SELECTED;
1974 default: /* unsupported */
1979 /* get pointer to the setting */
1980 static void *acf_dswor_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1982 World *wo = (World *)ale->data;
1984 /* clear extra return data first */
1988 case ACHANNEL_SETTING_EXPAND: /* expanded */
1989 return GET_ACF_FLAG_PTR(wo->flag, type);
1991 case ACHANNEL_SETTING_SELECT: /* selected */
1992 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1993 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1995 return GET_ACF_FLAG_PTR(wo->adt->flag, type);
1998 default: /* unsupported */
2003 /* world expander type define */
2004 static bAnimChannelType ACF_DSWOR =
2006 "World Expander", /* type name */
2007 ACHANNEL_ROLE_EXPANDER, /* role */
2009 acf_generic_dataexpand_color, /* backdrop color */
2010 acf_generic_dataexpand_backdrop, /* backdrop */
2011 acf_generic_indention_1, /* indent level */
2012 acf_generic_basic_offset, /* offset */
2014 acf_generic_idblock_name, /* name */
2015 acf_generic_idfill_name_prop, /* name prop */
2016 acf_dswor_icon, /* icon */
2018 acf_generic_dataexpand_setting_valid, /* has setting */
2019 acf_dswor_setting_flag, /* flag for setting */
2020 acf_dswor_setting_ptr /* pointer for setting */
2023 /* Particle Expander ------------------------------------------- */
2025 // TODO: just get this from RNA?
2026 static int acf_dspart_icon(bAnimListElem *UNUSED(ale))
2028 return ICON_PARTICLE_DATA;
2031 /* get the appropriate flag(s) for the setting when it is valid */
2032 static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2034 /* clear extra return data first */
2038 case ACHANNEL_SETTING_EXPAND: /* expanded */
2041 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2042 return ADT_NLA_EVAL_OFF;
2044 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2046 return ADT_CURVES_NOT_VISIBLE;
2048 case ACHANNEL_SETTING_SELECT: /* selected */
2049 return ADT_UI_SELECTED;
2051 default: /* unsupported */
2056 /* get pointer to the setting */
2057 static void *acf_dspart_setting_ptr(bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting, short *type)
2059 /* clear extra return data first */
2063 case ACHANNEL_SETTING_EXPAND: /* expanded */
2066 case ACHANNEL_SETTING_SELECT: /* selected */
2067 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2068 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2071 default: /* unsupported */
2076 /* particle expander type define */
2077 static bAnimChannelType ACF_DSPART =
2079 "Particle Data Expander", /* type name */
2080 ACHANNEL_ROLE_EXPANDER, /* role */
2082 acf_generic_dataexpand_color, /* backdrop color */
2083 acf_generic_dataexpand_backdrop, /* backdrop */
2084 acf_generic_indention_1, /* indent level */
2085 acf_generic_basic_offset, /* offset */
2087 acf_generic_idblock_name, /* name */
2088 acf_generic_idblock_name_prop, /* name prop */
2089 acf_dspart_icon, /* icon */
2091 acf_generic_dataexpand_setting_valid, /* has setting */
2092 acf_dspart_setting_flag, /* flag for setting */
2093 acf_dspart_setting_ptr /* pointer for setting */
2096 /* MetaBall Expander ------------------------------------------- */
2098 // TODO: just get this from RNA?
2099 static int acf_dsmball_icon(bAnimListElem *UNUSED(ale))
2101 return ICON_META_DATA;
2104 /* get the appropriate flag(s) for the setting when it is valid */
2105 static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2107 /* clear extra return data first */
2111 case ACHANNEL_SETTING_EXPAND: /* expanded */
2112 return MB_DS_EXPAND;
2114 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2115 return ADT_NLA_EVAL_OFF;
2117 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2119 return ADT_CURVES_NOT_VISIBLE;
2121 case ACHANNEL_SETTING_SELECT: /* selected */
2122 return ADT_UI_SELECTED;
2124 default: /* unsupported */
2129 /* get pointer to the setting */
2130 static void *acf_dsmball_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2132 MetaBall *mb = (MetaBall *)ale->data;
2134 /* clear extra return data first */
2138 case ACHANNEL_SETTING_EXPAND: /* expanded */
2139 return GET_ACF_FLAG_PTR(mb->flag2, type);
2141 case ACHANNEL_SETTING_SELECT: /* selected */
2142 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2143 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2145 return GET_ACF_FLAG_PTR(mb->adt->flag, type);
2148 default: /* unsupported */
2153 /* metaball expander type define */
2154 static bAnimChannelType ACF_DSMBALL =
2156 "Metaball Expander", /* type name */
2157 ACHANNEL_ROLE_EXPANDER, /* role */
2159 acf_generic_dataexpand_color, /* backdrop color */
2160 acf_generic_dataexpand_backdrop, /* backdrop */
2161 acf_generic_indention_1, /* indent level */
2162 acf_generic_basic_offset, /* offset */
2164 acf_generic_idblock_name, /* name */
2165 acf_generic_idblock_name_prop, /* name prop */
2166 acf_dsmball_icon, /* icon */
2168 acf_generic_dataexpand_setting_valid, /* has setting */
2169 acf_dsmball_setting_flag, /* flag for setting */
2170 acf_dsmball_setting_ptr /* pointer for setting */
2173 /* Armature Expander ------------------------------------------- */
2175 // TODO: just get this from RNA?
2176 static int acf_dsarm_icon(bAnimListElem *UNUSED(ale))
2178 return ICON_ARMATURE_DATA;
2181 /* get the appropriate flag(s) for the setting when it is valid */
2182 static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2184 /* clear extra return data first */
2188 case ACHANNEL_SETTING_EXPAND: /* expanded */
2189 return ARM_DS_EXPAND;
2191 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2192 return ADT_NLA_EVAL_OFF;
2194 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2196 return ADT_CURVES_NOT_VISIBLE;
2198 case ACHANNEL_SETTING_SELECT: /* selected */
2199 return ADT_UI_SELECTED;
2201 default: /* unsupported */
2206 /* get pointer to the setting */
2207 static void *acf_dsarm_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2209 bArmature *arm = (bArmature *)ale->data;
2211 /* clear extra return data first */
2215 case ACHANNEL_SETTING_EXPAND: /* expanded */
2216 return GET_ACF_FLAG_PTR(arm->flag, type);
2218 case ACHANNEL_SETTING_SELECT: /* selected */
2219 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2220 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2222 return GET_ACF_FLAG_PTR(arm->adt->flag, type);
2225 default: /* unsupported */
2230 /* metaball expander type define */
2231 static bAnimChannelType ACF_DSARM =
2233 "Armature Expander", /* type name */
2234 ACHANNEL_ROLE_EXPANDER, /* role */
2236 acf_generic_dataexpand_color, /* backdrop color */
2237 acf_generic_dataexpand_backdrop, /* backdrop */
2238 acf_generic_indention_1, /* indent level */
2239 acf_generic_basic_offset, /* offset */
2241 acf_generic_idblock_name, /* name */
2242 acf_generic_idblock_name_prop, /* name prop */
2243 acf_dsarm_icon, /* icon */
2245 acf_generic_dataexpand_setting_valid, /* has setting */
2246 acf_dsarm_setting_flag, /* flag for setting */
2247 acf_dsarm_setting_ptr /* pointer for setting */
2250 /* NodeTree Expander ------------------------------------------- */
2252 // TODO: just get this from RNA?
2253 static int acf_dsntree_icon(bAnimListElem *UNUSED(ale))
2255 return ICON_NODETREE;
2258 /* offset for nodetree expanders */
2259 static short acf_dsntree_offset(bAnimContext *ac, bAnimListElem *ale)
2261 bNodeTree *ntree = (bNodeTree *)ale->data;
2262 short offset = acf_generic_basic_offset(ac, ale);
2264 offset += acf_nodetree_rootType_offset(ntree);
2269 /* get the appropriate flag(s) for the setting when it is valid */
2270 static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2272 /* clear extra return data first */
2276 case ACHANNEL_SETTING_EXPAND: /* expanded */
2277 return NTREE_DS_EXPAND;
2279 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2280 return ADT_NLA_EVAL_OFF;
2282 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2284 return ADT_CURVES_NOT_VISIBLE;
2286 case ACHANNEL_SETTING_SELECT: /* selected */
2287 return ADT_UI_SELECTED;
2289 default: /* unsupported */
2294 /* get pointer to the setting */
2295 static void *acf_dsntree_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2297 bNodeTree *ntree = (bNodeTree *)ale->data;
2299 /* clear extra return data first */
2303 case ACHANNEL_SETTING_EXPAND: /* expanded */
2304 return GET_ACF_FLAG_PTR(ntree->flag, type);
2306 case ACHANNEL_SETTING_SELECT: /* selected */
2307 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2308 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2310 return GET_ACF_FLAG_PTR(ntree->adt->flag, type);
2313 default: /* unsupported */
2318 /* node tree expander type define */
2319 static bAnimChannelType ACF_DSNTREE =
2321 "Node Tree Expander", /* type name */
2322 ACHANNEL_ROLE_EXPANDER, /* role */
2324 acf_generic_dataexpand_color, /* backdrop color */
2325 acf_generic_dataexpand_backdrop, /* backdrop */
2326 acf_generic_indention_1, /* indent level */
2327 acf_dsntree_offset, /* offset */
2329 acf_generic_idblock_name, /* name */
2330 acf_generic_idblock_name_prop, /* name prop */
2331 acf_dsntree_icon, /* icon */
2333 acf_generic_dataexpand_setting_valid, /* has setting */
2334 acf_dsntree_setting_flag, /* flag for setting */
2335 acf_dsntree_setting_ptr /* pointer for setting */
2338 /* LineStyle Expander ------------------------------------------- */
2340 /* TODO: just get this from RNA? */
2341 static int acf_dslinestyle_icon(bAnimListElem *UNUSED(ale))
2343 return ICON_LINE_DATA;
2346 /* get the appropriate flag(s) for the setting when it is valid */
2347 static int acf_dslinestyle_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2349 /* clear extra return data first */
2353 case ACHANNEL_SETTING_EXPAND: /* expanded */
2354 return LS_DS_EXPAND;
2356 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2357 return ADT_NLA_EVAL_OFF;
2359 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2361 return ADT_CURVES_NOT_VISIBLE;
2363 case ACHANNEL_SETTING_SELECT: /* selected */
2364 return ADT_UI_SELECTED;
2366 default: /* unsupported */
2371 /* get pointer to the setting */
2372 static void *acf_dslinestyle_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2374 FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ale->data;
2376 /* clear extra return data first */
2380 case ACHANNEL_SETTING_EXPAND: /* expanded */
2381 return GET_ACF_FLAG_PTR(linestyle->flag, type);
2383 case ACHANNEL_SETTING_SELECT: /* selected */
2384 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2385 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2387 return GET_ACF_FLAG_PTR(linestyle->adt->flag, type);
2390 default: /* unsupported */
2395 /* node tree expander type define */
2396 static bAnimChannelType ACF_DSLINESTYLE =
2398 "Line Style Expander", /* type name */
2399 ACHANNEL_ROLE_EXPANDER, /* role */
2401 acf_generic_dataexpand_color, /* backdrop color */
2402 acf_generic_dataexpand_backdrop,/* backdrop */
2403 acf_generic_indention_1, /* indent level */
2404 acf_generic_basic_offset, /* offset */
2406 acf_generic_idblock_name, /* name */
2407 acf_generic_idblock_name_prop, /* name prop */
2408 acf_dslinestyle_icon, /* icon */
2410 acf_generic_dataexpand_setting_valid, /* has setting */
2411 acf_dslinestyle_setting_flag, /* flag for setting */
2412 acf_dslinestyle_setting_ptr /* pointer for setting */
2415 /* Mesh Expander ------------------------------------------- */
2417 // TODO: just get this from RNA?
2418 static int acf_dsmesh_icon(bAnimListElem *UNUSED(ale))
2420 return ICON_MESH_DATA;
2423 /* get the appropriate flag(s) for the setting when it is valid */
2424 static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2426 /* clear extra return data first */
2430 case ACHANNEL_SETTING_EXPAND: /* expanded */
2431 return ME_DS_EXPAND;
2433 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2434 return ADT_NLA_EVAL_OFF;
2436 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2438 return ADT_CURVES_NOT_VISIBLE;
2440 case ACHANNEL_SETTING_SELECT: /* selected */
2441 return ADT_UI_SELECTED;
2443 default: /* unsupported */
2448 /* get pointer to the setting */
2449 static void *acf_dsmesh_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2451 Mesh *me = (Mesh *)ale->data;
2453 /* clear extra return data first */
2457 case ACHANNEL_SETTING_EXPAND: /* expanded */
2458 return GET_ACF_FLAG_PTR(me->flag, type);
2460 case ACHANNEL_SETTING_SELECT: /* selected */
2461 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2462 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2464 return GET_ACF_FLAG_PTR(me->adt->flag, type);
2467 default: /* unsupported */
2472 /* node tree expander type define */
2473 static bAnimChannelType ACF_DSMESH =
2475 "Mesh Expander", /* type name */
2476 ACHANNEL_ROLE_EXPANDER, /* role */
2478 acf_generic_dataexpand_color, /* backdrop color */
2479 acf_generic_dataexpand_backdrop, /* backdrop */
2480 acf_generic_indention_1, /* indent level */ // XXX this only works for compositing
2481 acf_generic_basic_offset, /* offset */
2483 acf_generic_idblock_name, /* name */
2484 acf_generic_idblock_name_prop, /* name prop */
2485 acf_dsmesh_icon, /* icon */
2487 acf_generic_dataexpand_setting_valid, /* has setting */
2488 acf_dsmesh_setting_flag, /* flag for setting */
2489 acf_dsmesh_setting_ptr /* pointer for setting */
2492 /* Lattice Expander ------------------------------------------- */
2494 // TODO: just get this from RNA?
2495 static int acf_dslat_icon(bAnimListElem *UNUSED(ale))
2497 return ICON_LATTICE_DATA;
2500 /* get the appropriate flag(s) for the setting when it is valid */
2501 static int acf_dslat_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2503 /* clear extra return data first */
2507 case ACHANNEL_SETTING_EXPAND: /* expanded */
2508 return LT_DS_EXPAND;
2510 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2511 return ADT_NLA_EVAL_OFF;
2513 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2515 return ADT_CURVES_NOT_VISIBLE;
2517 case ACHANNEL_SETTING_SELECT: /* selected */
2518 return ADT_UI_SELECTED;
2520 default: /* unsupported */
2525 /* get pointer to the setting */
2526 static void *acf_dslat_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2528 Lattice *lt = (Lattice *)ale->data;
2530 /* clear extra return data first */
2534 case ACHANNEL_SETTING_EXPAND: /* expanded */
2535 return GET_ACF_FLAG_PTR(lt->flag, type);
2537 case ACHANNEL_SETTING_SELECT: /* selected */
2538 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2539 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2541 return GET_ACF_FLAG_PTR(lt->adt->flag, type);
2544 default: /* unsupported */
2549 /* node tree expander type define */
2550 static bAnimChannelType ACF_DSLAT =
2552 "Lattice Expander", /* type name */
2553 ACHANNEL_ROLE_EXPANDER, /* role */
2555 acf_generic_dataexpand_color, /* backdrop color */
2556 acf_generic_dataexpand_backdrop, /* backdrop */
2557 acf_generic_indention_1, /* indent level */ // XXX this only works for compositing
2558 acf_generic_basic_offset, /* offset */
2560 acf_generic_idblock_name, /* name */
2561 acf_generic_idblock_name_prop, /* name prop */
2562 acf_dslat_icon, /* icon */
2564 acf_generic_dataexpand_setting_valid, /* has setting */
2565 acf_dslat_setting_flag, /* flag for setting */
2566 acf_dslat_setting_ptr /* pointer for setting */
2569 /* Speaker Expander ------------------------------------------- */
2571 // TODO: just get this from RNA?
2572 static int acf_dsspk_icon(bAnimListElem *UNUSED(ale))
2574 return ICON_SPEAKER;
2577 /* get the appropriate flag(s) for the setting when it is valid */
2578 static int acf_dsspk_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2580 /* clear extra return data first */
2584 case ACHANNEL_SETTING_EXPAND: /* expanded */
2585 return SPK_DS_EXPAND;
2587 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2588 return ADT_NLA_EVAL_OFF;
2590 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2592 return ADT_CURVES_NOT_VISIBLE;
2594 case ACHANNEL_SETTING_SELECT: /* selected */
2595 return ADT_UI_SELECTED;
2597 default: /* unsupported */
2602 /* get pointer to the setting */
2603 static void *acf_dsspk_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2605 Speaker *spk = (Speaker *)ale->data;
2607 /* clear extra return data first */
2611 case ACHANNEL_SETTING_EXPAND: /* expanded */
2612 return GET_ACF_FLAG_PTR(spk->flag, type);
2614 case ACHANNEL_SETTING_SELECT: /* selected */
2615 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2616 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2618 return GET_ACF_FLAG_PTR(spk->adt->flag, type);
2621 default: /* unsupported */
2626 /* speaker expander type define */
2627 static bAnimChannelType ACF_DSSPK =
2629 "Speaker Expander", /* type name */
2630 ACHANNEL_ROLE_EXPANDER, /* role */
2632 acf_generic_dataexpand_color, /* backdrop color */
2633 acf_generic_dataexpand_backdrop, /* backdrop */
2634 acf_generic_indention_1, /* indent level */
2635 acf_generic_basic_offset, /* offset */
2637 acf_generic_idblock_name, /* name */
2638 acf_generic_idblock_name_prop, /* name prop */
2639 acf_dsspk_icon, /* icon */
2641 acf_generic_dataexpand_setting_valid, /* has setting */
2642 acf_dsspk_setting_flag, /* flag for setting */
2643 acf_dsspk_setting_ptr /* pointer for setting */
2646 /* GPencil Expander ------------------------------------------- */
2648 // TODO: just get this from RNA?
2649 static int acf_dsgpencil_icon(bAnimListElem *UNUSED(ale))
2651 return ICON_GREASEPENCIL;
2654 /* get the appropriate flag(s) for the setting when it is valid */
2655 static int acf_dsgpencil_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2657 /* clear extra return data first */
2661 case ACHANNEL_SETTING_EXPAND: /* expanded */
2662 return GP_DATA_EXPAND;
2664 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2665 return ADT_NLA_EVAL_OFF;
2667 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2669 return ADT_CURVES_NOT_VISIBLE;
2671 case ACHANNEL_SETTING_SELECT: /* selected */
2672 return ADT_UI_SELECTED;
2674 default: /* unsupported */
2679 /* get pointer to the setting */
2680 static void *acf_dsgpencil_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2682 bGPdata *gpd = (bGPdata *)ale->data;
2684 /* clear extra return data first */
2688 case ACHANNEL_SETTING_EXPAND: /* expanded */
2689 return GET_ACF_FLAG_PTR(gpd->flag, type);
2691 case ACHANNEL_SETTING_SELECT: /* selected */
2692 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2693 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2695 return GET_ACF_FLAG_PTR(gpd->adt->flag, type);
2698 default: /* unsupported */
2703 /* grease pencil expander type define */
2704 static bAnimChannelType ACF_DSGPENCIL =
2706 "GPencil DS Expander", /* type name */
2707 ACHANNEL_ROLE_EXPANDER, /* role */
2709 acf_generic_dataexpand_color, /* backdrop color */
2710 acf_generic_dataexpand_backdrop, /* backdrop */
2711 acf_generic_indention_1, /* indent level */
2712 acf_generic_basic_offset, /* offset */
2714 acf_generic_idblock_name, /* name */
2715 acf_generic_idblock_name_prop, /* name prop */
2716 acf_dsgpencil_icon, /* icon */
2718 acf_generic_dataexpand_setting_valid, /* has setting */
2719 acf_dsgpencil_setting_flag, /* flag for setting */
2720 acf_dsgpencil_setting_ptr /* pointer for setting */
2723 /* World Expander ------------------------------------------- */
2725 // TODO: just get this from RNA?
2726 static int acf_dsmclip_icon(bAnimListElem *UNUSED(ale))
2728 return ICON_SEQUENCE;
2731 /* get the appropriate flag(s) for the setting when it is valid */
2732 static int acf_dsmclip_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2734 /* clear extra return data first */
2738 case ACHANNEL_SETTING_EXPAND: /* expanded */
2739 return MCLIP_DATA_EXPAND;
2741 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2742 return ADT_NLA_EVAL_OFF;
2744 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2746 return ADT_CURVES_NOT_VISIBLE;
2748 case ACHANNEL_SETTING_SELECT: /* selected */
2749 return ADT_UI_SELECTED;
2751 default: /* unsupported */
2756 /* get pointer to the setting */
2757 static void *acf_dsmclip_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2759 MovieClip *clip = (MovieClip *)ale->data;
2761 /* clear extra return data first */
2765 case ACHANNEL_SETTING_EXPAND: /* expanded */
2766 return GET_ACF_FLAG_PTR(clip->flag, type);
2768 case ACHANNEL_SETTING_SELECT: /* selected */
2769 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2770 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2771 if (clip->adt != NULL) {
2772 return GET_ACF_FLAG_PTR(clip->adt->flag, type);
2776 default: /* unsupported */
2781 /* world expander type define */
2782 static bAnimChannelType ACF_DSMCLIP =
2784 "Movieclip Expander", /* type name */
2785 ACHANNEL_ROLE_EXPANDER, /* role */
2787 acf_generic_dataexpand_color, /* backdrop color */
2788 acf_generic_dataexpand_backdrop, /* backdrop */
2789 acf_generic_indention_1, /* indent level */
2790 acf_generic_basic_offset, /* offset */
2792 acf_generic_idblock_name, /* name */
2793 acf_generic_idfill_name_prop, /* name prop */
2794 acf_dsmclip_icon, /* icon */
2796 acf_generic_dataexpand_setting_valid, /* has setting */
2797 acf_dsmclip_setting_flag, /* flag for setting */
2798 acf_dsmclip_setting_ptr /* pointer for setting */
2801 /* ShapeKey Entry ------------------------------------------- */
2803 /* name for ShapeKey */
2804 static void acf_shapekey_name(bAnimListElem *ale, char *name)
2806 KeyBlock *kb = (KeyBlock *)ale->data;
2808 /* just copy the name... */
2810 /* if the KeyBlock had a name, use it, otherwise use the index */
2812 BLI_strncpy(name, kb->name, ANIM_CHAN_NAME_SIZE);
2814 BLI_snprintf(name, ANIM_CHAN_NAME_SIZE, IFACE_("Key %d"), ale->index);
2818 /* name property for ShapeKey entries */
2819 static bool acf_shapekey_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
2821 KeyBlock *kb = (KeyBlock *)ale->data;
2823 /* if the KeyBlock had a name, use it, otherwise use the index */
2824 if (kb && kb->name[0]) {
2825 RNA_pointer_create(ale->id, &RNA_ShapeKey, kb, ptr);
2826 *prop = RNA_struct_name_property(ptr->type);
2828 return (*prop != NULL);
2834 /* check if some setting exists for this channel */
2835 static bool acf_shapekey_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
2838 case ACHANNEL_SETTING_SELECT: /* selected */
2839 case ACHANNEL_SETTING_MUTE: /* muted */
2840 case ACHANNEL_SETTING_PROTECT: /* protected */
2843 /* nothing else is supported */
2849 /* get the appropriate flag(s) for the setting when it is valid */
2850 static int acf_shapekey_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2852 /* clear extra return data first */
2856 case ACHANNEL_SETTING_MUTE: /* mute */
2857 return KEYBLOCK_MUTE;
2859 case ACHANNEL_SETTING_SELECT: /* selected */
2860 return KEYBLOCK_SEL;
2862 case ACHANNEL_SETTING_PROTECT: /* locked */
2863 return KEYBLOCK_LOCKED;
2865 default: /* unsupported */
2870 /* get pointer to the setting */
2871 static void *acf_shapekey_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2873 KeyBlock *kb = (KeyBlock *)ale->data;
2875 /* clear extra return data first */
2879 case ACHANNEL_SETTING_SELECT: /* selected */
2880 case ACHANNEL_SETTING_MUTE: /* muted */
2881 case ACHANNEL_SETTING_PROTECT: /* protected */
2882 return GET_ACF_FLAG_PTR(kb->flag, type);
2884 default: /* unsupported */
2889 /* shapekey expander type define */
2890 static bAnimChannelType ACF_SHAPEKEY =
2892 "Shape Key", /* type name */
2893 ACHANNEL_ROLE_CHANNEL, /* role */
2895 acf_generic_channel_color, /* backdrop color */
2896 acf_generic_channel_backdrop, /* backdrop */
2897 acf_generic_indention_0, /* indent level */
2898 acf_generic_basic_offset, /* offset */
2900 acf_shapekey_name, /* name */
2901 acf_shapekey_name_prop, /* name prop */
2904 acf_shapekey_setting_valid, /* has setting */
2905 acf_shapekey_setting_flag, /* flag for setting */
2906 acf_shapekey_setting_ptr /* pointer for setting */
2909 /* GPencil Datablock ------------------------------------------- */
2911 /* get backdrop color for gpencil datablock widget */
2912 static void acf_gpd_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
2914 /* these are ID-blocks, but not exactly standalone... */
2915 UI_GetThemeColorShade3fv(TH_DOPESHEET_CHANNELSUBOB, 20, r_color);
2918 // TODO: just get this from RNA?
2919 static int acf_gpd_icon(bAnimListElem *UNUSED(ale))
2921 return ICON_GREASEPENCIL;
2924 /* check if some setting exists for this channel */
2925 static bool acf_gpd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
2928 /* only select and expand supported */
2929 case ACHANNEL_SETTING_SELECT:
2930 case ACHANNEL_SETTING_EXPAND:
2938 /* get the appropriate flag(s) for the setting when it is valid */
2939 static int acf_gpd_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2941 /* clear extra return data first */
2945 case ACHANNEL_SETTING_SELECT: /* selected */
2946 return AGRP_SELECTED;
2948 case ACHANNEL_SETTING_EXPAND: /* expanded */
2949 return GP_DATA_EXPAND;
2952 /* these shouldn't happen */
2957 /* get pointer to the setting */
2958 static void *acf_gpd_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
2960 bGPdata *gpd = (bGPdata *)ale->data;
2962 /* all flags are just in gpd->flag for now... */
2963 return GET_ACF_FLAG_PTR(gpd->flag, type);
2966 /* gpencil datablock type define */
2967 static bAnimChannelType ACF_GPD =
2969 "GPencil Datablock", /* type name */
2970 ACHANNEL_ROLE_EXPANDER, /* role */
2972 acf_gpd_color, /* backdrop color */
2973 acf_group_backdrop, /* backdrop */
2974 acf_generic_indention_0, /* indent level */
2975 acf_generic_group_offset, /* offset */
2977 acf_generic_idblock_name, /* name */
2978 acf_generic_idfill_name_prop, /* name prop */
2979 acf_gpd_icon, /* icon */
2981 acf_gpd_setting_valid, /* has setting */
2982 acf_gpd_setting_flag, /* flag for setting */
2983 acf_gpd_setting_ptr /* pointer for setting */
2986 /* GPencil Layer ------------------------------------------- */
2988 /* name for grease pencil layer entries */
2989 static void acf_gpl_name(bAnimListElem *ale, char *name)
2991 bGPDlayer *gpl = (bGPDlayer *)ale->data;
2994 BLI_strncpy(name, gpl->info, ANIM_CHAN_NAME_SIZE);
2997 /* name property for grease pencil layer entries */
2998 static bool acf_gpl_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
3001 RNA_pointer_create(ale->id, &RNA_GPencilLayer, ale->data, ptr);
3002 *prop = RNA_struct_name_property(ptr->type);
3004 return (*prop != NULL);
3010 /* check if some setting exists for this channel */
3011 static bool acf_gpl_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
3015 case ACHANNEL_SETTING_EXPAND: /* gpencil layers are more like F-Curves than groups */
3016 case ACHANNEL_SETTING_SOLO: /* nla editor only */
3019 /* always available */
3025 /* get the appropriate flag(s) for the setting when it is valid */
3026 static int acf_gpl_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
3028 /* clear extra return data first */
3032 case ACHANNEL_SETTING_SELECT: /* selected */
3033 return GP_LAYER_SELECT;
3035 case ACHANNEL_SETTING_MUTE: /* animation muting - similar to frame lock... */
3036 return GP_LAYER_FRAMELOCK;
3038 case ACHANNEL_SETTING_VISIBLE: /* visibility of the layers (NOT muting) */
3040 return GP_LAYER_HIDE;
3042 case ACHANNEL_SETTING_PROTECT: /* protected */
3043 return GP_LAYER_LOCKED;
3045 default: /* unsupported */
3050 /* get pointer to the setting */
3051 static void *acf_gpl_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
3053 bGPDlayer *gpl = (bGPDlayer *)ale->data;
3055 /* all flags are just in gpl->flag for now... */
3056 return GET_ACF_FLAG_PTR(gpl->flag, type);
3059 /* grease pencil layer type define */
3060 static bAnimChannelType ACF_GPL =
3062 "GPencil Layer", /* type name */
3063 ACHANNEL_ROLE_CHANNEL, /* role */
3065 acf_generic_channel_color, /* backdrop color */
3066 acf_generic_channel_backdrop, /* backdrop */
3067 acf_generic_indention_flexible, /* indent level */
3068 acf_generic_group_offset, /* offset */
3070 acf_gpl_name, /* name */
3071 acf_gpl_name_prop, /* name prop */
3074 acf_gpl_setting_valid, /* has setting */
3075 acf_gpl_setting_flag, /* flag for setting */
3076 acf_gpl_setting_ptr /* pointer for setting */
3080 /* Mask Datablock ------------------------------------------- */
3082 /* get backdrop color for mask datablock widget */
3083 static void acf_mask_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
3085 /* these are ID-blocks, but not exactly standalone... */
3086 UI_GetThemeColorShade3fv(TH_DOPESHEET_CHANNELSUBOB, 20, r_color);
3089 // TODO: just get this from RNA?
3090 static int acf_mask_icon(bAnimListElem *UNUSED(ale))
3092 return ICON_MOD_MASK;
3095 /* check if some setting exists for this channel */
3096 static bool acf_mask_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
3099 /* only select and expand supported */
3100 case ACHANNEL_SETTING_SELECT:
3101 case ACHANNEL_SETTING_EXPAND:
3109 /* get the appropriate flag(s) for the setting when it is valid */
3110 static int acf_mask_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
3112 /* clear extra return data first */
3116 case ACHANNEL_SETTING_SELECT: /* selected */
3117 return AGRP_SELECTED;
3119 case ACHANNEL_SETTING_EXPAND: /* expanded */
3120 return MASK_ANIMF_EXPAND;
3123 /* this shouldn't happen */
3128 /* get pointer to the setting */
3129 static void *acf_mask_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
3131 Mask *mask = (Mask *)ale->data;
3133 /* all flags are just in mask->flag for now... */
3134 return GET_ACF_FLAG_PTR(mask->flag, type);
3137 /* mask datablock type define */
3138 static bAnimChannelType ACF_MASKDATA =
3140 "Mask Datablock", /* type name */
3141 ACHANNEL_ROLE_EXPANDER, /* role */
3143 acf_mask_color, /* backdrop color */
3144 acf_group_backdrop, /* backdrop */
3145 acf_generic_indention_0, /* indent level */
3146 acf_generic_group_offset, /* offset */
3148 acf_generic_idblock_name, /* name */
3149 acf_generic_idfill_name_prop, /* name prop */
3150 acf_mask_icon, /* icon */
3152 acf_mask_setting_valid, /* has setting */
3153 acf_mask_setting_flag, /* flag for setting */
3154 acf_mask_setting_ptr /* pointer for setting */
3157 /* Mask Layer ------------------------------------------- */
3159 /* name for grease pencil layer entries */
3160 static void acf_masklay_name(bAnimListElem *ale, char *name)
3162 MaskLayer *masklay = (MaskLayer *)ale->data;
3164 if (masklay && name)
3165 BLI_strncpy(name, masklay->name, ANIM_CHAN_NAME_SIZE);
3168 /* name property for grease pencil layer entries */
3169 static bool acf_masklay_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
3172 RNA_pointer_create(ale->id, &RNA_MaskLayer, ale->data, ptr);
3173 *prop = RNA_struct_name_property(ptr->type);
3175 return (*prop != NULL);
3181 /* check if some setting exists for this channel */
3182 static bool acf_masklay_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
3186 case ACHANNEL_SETTING_EXPAND: /* mask layers are more like F-Curves than groups */
3187 case ACHANNEL_SETTING_VISIBLE: /* graph editor only */
3188 case ACHANNEL_SETTING_SOLO: /* nla editor only */
3191 /* always available */
3197 /* get the appropriate flag(s) for the setting when it is valid */
3198 static int acf_masklay_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
3200 /* clear extra return data first */
3204 case ACHANNEL_SETTING_SELECT: /* selected */
3205 return MASK_LAYERFLAG_SELECT;
3207 case ACHANNEL_SETTING_PROTECT: /* protected */
3208 return MASK_LAYERFLAG_LOCKED;
3210 default: /* unsupported */
3215 /* get pointer to the setting */
3216 static void *acf_masklay_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
3218 MaskLayer *masklay = (MaskLayer *)ale->data;
3220 /* all flags are just in masklay->flag for now... */
3221 return GET_ACF_FLAG_PTR(masklay->flag, type);
3224 /* grease pencil layer type define */
3225 static bAnimChannelType ACF_MASKLAYER =
3227 "Mask Layer", /* type name */
3228 ACHANNEL_ROLE_CHANNEL, /* role */
3230 acf_generic_channel_color, /* backdrop color */
3231 acf_generic_channel_backdrop, /* backdrop */
3232 acf_generic_indention_flexible, /* indent level */
3233 acf_generic_group_offset, /* offset */
3235 acf_masklay_name, /* name */
3236 acf_masklay_name_prop, /* name prop */
3239 acf_masklay_setting_valid, /* has setting */
3240 acf_masklay_setting_flag, /* flag for setting */
3241 acf_masklay_setting_ptr /* pointer for setting */