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_camera_types.h"
44 #include "DNA_object_types.h"
45 #include "DNA_particle_types.h"
46 #include "DNA_screen_types.h"
47 #include "DNA_scene_types.h"
48 #include "DNA_space_types.h"
49 #include "DNA_key_types.h"
50 #include "DNA_lamp_types.h"
51 #include "DNA_lattice_types.h"
52 #include "DNA_linestyle_types.h"
53 #include "DNA_mesh_types.h"
54 #include "DNA_material_types.h"
55 #include "DNA_meta_types.h"
56 #include "DNA_node_types.h"
57 #include "DNA_world_types.h"
58 #include "DNA_gpencil_types.h"
59 #include "DNA_speaker_types.h"
60 #include "DNA_mask_types.h"
62 #include "RNA_access.h"
64 #include "BKE_animsys.h"
65 #include "BKE_curve.h"
68 #include "BKE_context.h"
70 #include "UI_interface.h"
71 #include "UI_interface_icons.h"
72 #include "UI_resources.h"
74 #include "ED_anim_api.h"
75 #include "ED_keyframing.h"
78 #include "BIF_glutil.h"
83 /* *********************************************** */
84 // XXX constant defines to be moved elsewhere?
86 /* extra padding for lengths (to go under scrollers) */
87 #define EXTRA_SCROLL_PAD 100.0f
89 /* size of indent steps */
90 #define INDENT_STEP_SIZE (0.35f * U.widget_unit)
92 /* size of string buffers used for animation channel displayed names */
93 #define ANIM_CHAN_NAME_SIZE 256
95 /* get the pointer used for some flag */
96 #define GET_ACF_FLAG_PTR(ptr, type) ((*(type) = sizeof((ptr))), &(ptr))
98 /* *********************************************** */
99 /* Generic Functions (Type independent) */
101 /* Draw Backdrop ---------------------------------- */
103 /* get backdrop color for top-level widgets (Scene and Object only) */
104 static void acf_generic_root_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
106 /* darker blue for top-level widgets */
107 UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELOB, r_color);
110 /* backdrop for top-level widgets (Scene and Object only) */
111 static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
113 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
114 View2D *v2d = &ac->ar->v2d;
115 short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
116 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
119 /* set backdrop drawing color */
120 acf->get_backdrop_color(ac, ale, color);
123 /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
124 UI_draw_roundbox_corner_set((expanded) ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
125 UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8);
129 /* get backdrop color for data expanders under top-level Scene/Object */
130 static void acf_generic_dataexpand_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
132 /* lighter color than top-level widget */
133 UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELSUBOB, r_color);
136 /* backdrop for data expanders under top-level Scene/Object */
137 static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
139 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
140 View2D *v2d = &ac->ar->v2d;
141 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
144 /* set backdrop drawing color */
145 acf->get_backdrop_color(ac, ale, color);
148 /* no rounded corner - just rectangular box */
149 glRectf(offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
152 /* helper method to test if group colors should be drawn */
153 static bool acf_show_channel_colors(bAnimContext *ac)
155 bool showGroupColors = false;
158 switch (ac->spacetype) {
161 SpaceAction *saction = (SpaceAction *)ac->sl;
162 showGroupColors = !(saction->flag & SACTION_NODRAWGCOLORS);
168 SpaceIpo *sipo = (SpaceIpo *)ac->sl;
169 showGroupColors = !(sipo->flag & SIPO_NODRAWGCOLORS);
176 return showGroupColors;
179 /* get backdrop color for generic channels */
180 static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
182 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
183 bActionGroup *grp = NULL;
184 short indent = (acf->get_indent_level) ? acf->get_indent_level(ac, ale) : 0;
185 bool showGroupColors = acf_show_channel_colors(ac);
187 if (ale->type == ANIMTYPE_FCURVE) {
188 FCurve *fcu = (FCurve *)ale->data;
192 /* set color for normal channels
193 * - use 3 shades of color group/standard color for 3 indention level
194 * - only use group colors if allowed to, and if actually feasible
196 if (showGroupColors && (grp) && (grp->customCol)) {
200 copy_v3_v3_char((char *)cp, grp->cs.solid);
202 else if (indent == 1) {
203 copy_v3_v3_char((char *)cp, grp->cs.select);
206 copy_v3_v3_char((char *)cp, grp->cs.active);
209 /* copy the colors over, transforming from bytes to floats */
210 rgb_uchar_to_float(r_color, cp);
213 // FIXME: what happens when the indention is 1 greater than what it should be (due to grouping)?
214 int colOfs = 20 - 20 * indent;
215 UI_GetThemeColorShade3fv(TH_HEADER, colOfs, r_color);
219 /* backdrop for generic channels */
220 static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
222 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
223 View2D *v2d = &ac->ar->v2d;
224 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
227 /* set backdrop drawing color */
228 acf->get_backdrop_color(ac, ale, color);
231 /* no rounded corners - just rectangular box */
232 glRectf(offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
235 /* Indention + Offset ------------------------------------------- */
237 /* indention level is always the value in the name */
238 static short acf_generic_indention_0(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale))
242 static short acf_generic_indention_1(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale))
246 #if 0 // XXX not used
247 static short acf_generic_indention_2(bAnimContext *ac, bAnimListElem *ale)
253 /* indention which varies with the grouping status */
254 static short acf_generic_indention_flexible(bAnimContext *UNUSED(ac), bAnimListElem *ale)
258 /* grouped F-Curves need extra level of indention */
259 if (ale->type == ANIMTYPE_FCURVE) {
260 FCurve *fcu = (FCurve *)ale->data;
262 // TODO: we need some way of specifying that the indention color should be one less...
271 /* basic offset for channels derived from indention */
272 static short acf_generic_basic_offset(bAnimContext *ac, bAnimListElem *ale)
274 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
276 if (acf && acf->get_indent_level)
277 return acf->get_indent_level(ac, ale) * INDENT_STEP_SIZE;
282 /* offset based on nodetree type */
283 static short acf_nodetree_rootType_offset(bNodeTree *ntree)
286 switch (ntree->type) {
288 /* 1 additional level (i.e. is indented one level in from material,
289 * so shift all right by one step)
291 return INDENT_STEP_SIZE;
294 /* no additional levels needed */
298 /* 2 additional levels */
299 return INDENT_STEP_SIZE * 2;
307 /* offset for groups + grouped entities */
308 static short acf_generic_group_offset(bAnimContext *ac, bAnimListElem *ale)
310 short offset = acf_generic_basic_offset(ac, ale);
313 /* texture animdata */
314 if (GS(ale->id->name) == ID_TE) {
315 offset += U.widget_unit;
317 /* materials and particles animdata */
318 else if (ELEM(GS(ale->id->name), ID_MA, ID_PA))
319 offset += (short)(0.7f * U.widget_unit);
321 /* if not in Action Editor mode, action-groups (and their children) must carry some offset too... */
322 else if (ac->datatype != ANIMCONT_ACTION)
323 offset += (short)(0.7f * U.widget_unit);
325 /* nodetree animdata */
326 if (GS(ale->id->name) == ID_NT) {
327 offset += acf_nodetree_rootType_offset((bNodeTree *)ale->id);
331 /* offset is just the normal type - i.e. based on indention */
335 /* Name ------------------------------------------- */
337 /* name for ID block entries */
338 static void acf_generic_idblock_name(bAnimListElem *ale, char *name)
340 ID *id = (ID *)ale->data; /* data pointed to should be an ID block */
342 /* just copy the name... */
344 BLI_strncpy(name, id->name + 2, ANIM_CHAN_NAME_SIZE);
347 /* name property for ID block entries */
348 static bool acf_generic_idblock_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
350 RNA_id_pointer_create(ale->data, ptr);
351 *prop = RNA_struct_name_property(ptr->type);
353 return (*prop != NULL);
357 /* name property for ID block entries which are just subheading "fillers" */
358 static bool acf_generic_idfill_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
360 /* actual ID we're representing is stored in ale->data not ale->id, as id gives the owner */
361 RNA_id_pointer_create(ale->data, ptr);
362 *prop = RNA_struct_name_property(ptr->type);
364 return (*prop != NULL);
367 /* Settings ------------------------------------------- */
370 /* channel type has no settings */
371 static bool acf_generic_none_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
377 /* check if some setting exists for this object-based data-expander (datablock only) */
378 static bool acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
381 /* expand is always supported */
382 case ACHANNEL_SETTING_EXPAND:
385 /* mute is only supported for NLA */
386 case ACHANNEL_SETTING_MUTE:
387 return ((ac) && (ac->spacetype == SPACE_NLA));
389 /* select is ok for most "ds*" channels (e.g. dsmat) */
390 case ACHANNEL_SETTING_SELECT:
393 /* other flags are never supported */
399 /* *********************************************** */
400 /* Type Specific Functions + Defines */
402 /* Animation Summary ----------------------------------- */
404 /* get backdrop color for summary widget */
405 static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
407 /* reddish color - same as the 'action' line in NLA */
408 UI_GetThemeColor3fv(TH_ANIM_ACTIVE, r_color);
411 /* backdrop for summary widget */
412 static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
414 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
415 View2D *v2d = &ac->ar->v2d;
418 /* set backdrop drawing color */
419 acf->get_backdrop_color(ac, ale, color);
422 /* rounded corners on LHS only
424 * - special hack: make the top a bit higher, since we are first...
426 UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
427 UI_draw_roundbox_gl_mode(GL_POLYGON, 0, yminc - 2, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8);
430 /* name for summary entries */
431 static void acf_summary_name(bAnimListElem *UNUSED(ale), char *name)
434 BLI_strncpy(name, IFACE_("Dope Sheet Summary"), ANIM_CHAN_NAME_SIZE);
437 // FIXME: this is really a temp icon I think
438 static int acf_summary_icon(bAnimListElem *UNUSED(ale))
440 return ICON_BORDERMOVE;
443 /* check if some setting exists for this channel */
444 static bool acf_summary_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
446 /* only expanded is supported, as it is used for hiding all stuff which the summary covers */
447 return (setting == ACHANNEL_SETTING_EXPAND);
450 /* get the appropriate flag(s) for the setting when it is valid */
451 static int acf_summary_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
453 if (setting == ACHANNEL_SETTING_EXPAND) {
456 return ADS_FLAG_SUMMARY_COLLAPSED;
465 /* get pointer to the setting */
466 static void *acf_summary_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
468 bAnimContext *ac = (bAnimContext *)ale->data;
470 /* if data is valid, return pointer to active dopesheet's relevant flag
471 * - this is restricted to DopeSheet/Action Editor only
473 if ((ac->sl) && (ac->spacetype == SPACE_ACTION) && (setting == ACHANNEL_SETTING_EXPAND)) {
474 SpaceAction *saction = (SpaceAction *)ac->sl;
475 bDopeSheet *ads = &saction->ads;
477 /* return pointer to DopeSheet's flag */
478 return GET_ACF_FLAG_PTR(ads->flag, type);
481 /* can't return anything useful - unsupported */
487 /* all animation summary (DopeSheet only) type define */
488 static bAnimChannelType ACF_SUMMARY =
490 "Summary", /* type name */
491 ACHANNEL_ROLE_EXPANDER, /* role */
493 acf_summary_color, /* backdrop color */
494 acf_summary_backdrop, /* backdrop */
495 acf_generic_indention_0, /* indent level */
498 acf_summary_name, /* name */
499 NULL, /* name prop */
500 acf_summary_icon, /* icon */
502 acf_summary_setting_valid, /* has setting */
503 acf_summary_setting_flag, /* flag for setting */
504 acf_summary_setting_ptr /* pointer for setting */
507 /* Scene ------------------------------------------- */
509 // TODO: just get this from RNA?
510 static int acf_scene_icon(bAnimListElem *UNUSED(ale))
512 return ICON_SCENE_DATA;
515 /* check if some setting exists for this channel */
516 static bool acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
519 /* muted only in NLA */
520 case ACHANNEL_SETTING_MUTE:
521 return ((ac) && (ac->spacetype == SPACE_NLA));
523 /* visible only in Graph Editor */
524 case ACHANNEL_SETTING_VISIBLE:
525 return ((ac) && (ac->spacetype == SPACE_IPO));
527 /* only select and expand supported otherwise */
528 case ACHANNEL_SETTING_SELECT:
529 case ACHANNEL_SETTING_EXPAND:
537 /* get the appropriate flag(s) for the setting when it is valid */
538 static int acf_scene_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
540 /* clear extra return data first */
544 case ACHANNEL_SETTING_SELECT: /* selected */
545 return SCE_DS_SELECTED;
547 case ACHANNEL_SETTING_EXPAND: /* expanded */
549 return SCE_DS_COLLAPSED;
551 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
552 return ADT_NLA_EVAL_OFF;
554 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
556 return ADT_CURVES_NOT_VISIBLE;
558 default: /* unsupported */
563 /* get pointer to the setting */
564 static void *acf_scene_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
566 Scene *scene = (Scene *)ale->data;
568 /* clear extra return data first */
572 case ACHANNEL_SETTING_SELECT: /* selected */
573 return GET_ACF_FLAG_PTR(scene->flag, type);
575 case ACHANNEL_SETTING_EXPAND: /* expanded */
576 return GET_ACF_FLAG_PTR(scene->flag, type);
578 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
579 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
581 return GET_ACF_FLAG_PTR(scene->adt->flag, type);
584 default: /* unsupported */
589 /* scene type define */
590 static bAnimChannelType ACF_SCENE =
592 "Scene", /* type name */
593 ACHANNEL_ROLE_EXPANDER, /* role */
595 acf_generic_root_color, /* backdrop color */
596 acf_generic_root_backdrop, /* backdrop */
597 acf_generic_indention_0, /* indent level */
600 acf_generic_idblock_name, /* name */
601 acf_generic_idblock_name_prop, /* name prop */
602 acf_scene_icon, /* icon */
604 acf_scene_setting_valid, /* has setting */
605 acf_scene_setting_flag, /* flag for setting */
606 acf_scene_setting_ptr /* pointer for setting */
609 /* Object ------------------------------------------- */
611 static int acf_object_icon(bAnimListElem *ale)
613 Base *base = (Base *)ale->data;
614 Object *ob = base->object;
616 /* icon depends on object-type */
619 return ICON_OUTLINER_OB_LAMP;
621 return ICON_OUTLINER_OB_MESH;
623 return ICON_OUTLINER_OB_CAMERA;
625 return ICON_OUTLINER_OB_CURVE;
627 return ICON_OUTLINER_OB_META;
629 return ICON_OUTLINER_OB_LATTICE;
631 return ICON_OUTLINER_OB_SPEAKER;
633 return ICON_OUTLINER_OB_ARMATURE;
635 return ICON_OUTLINER_OB_FONT;
637 return ICON_OUTLINER_OB_SURFACE;
639 return ICON_OUTLINER_OB_EMPTY;
641 return ICON_OBJECT_DATA;
645 /* name for object */
646 static void acf_object_name(bAnimListElem *ale, char *name)
648 Base *base = (Base *)ale->data;
649 Object *ob = base->object;
651 /* just copy the name... */
653 BLI_strncpy(name, ob->id.name + 2, ANIM_CHAN_NAME_SIZE);
656 /* name property for object */
657 static bool acf_object_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
659 RNA_id_pointer_create(ale->id, ptr);
660 *prop = RNA_struct_name_property(ptr->type);
662 return (*prop != NULL);
665 /* check if some setting exists for this channel */
666 static bool acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
668 Base *base = (Base *)ale->data;
669 Object *ob = base->object;
672 /* muted only in NLA */
673 case ACHANNEL_SETTING_MUTE:
674 return ((ac) && (ac->spacetype == SPACE_NLA));
676 /* visible only in Graph Editor */
677 case ACHANNEL_SETTING_VISIBLE:
678 return ((ac) && (ac->spacetype == SPACE_IPO) && (ob->adt));
680 /* only select and expand supported otherwise */
681 case ACHANNEL_SETTING_SELECT:
682 case ACHANNEL_SETTING_EXPAND:
690 /* get the appropriate flag(s) for the setting when it is valid */
691 static int acf_object_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
693 /* clear extra return data first */
697 case ACHANNEL_SETTING_SELECT: /* selected */
700 case ACHANNEL_SETTING_EXPAND: /* expanded */
702 return OB_ADS_COLLAPSED;
704 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
705 return ADT_NLA_EVAL_OFF;
707 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
709 return ADT_CURVES_NOT_VISIBLE;
711 default: /* unsupported */
716 /* get pointer to the setting */
717 static void *acf_object_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
719 Base *base = (Base *)ale->data;
720 Object *ob = base->object;
722 /* clear extra return data first */
726 case ACHANNEL_SETTING_SELECT: /* selected */
727 return GET_ACF_FLAG_PTR(ob->flag, type);
729 case ACHANNEL_SETTING_EXPAND: /* expanded */
730 return GET_ACF_FLAG_PTR(ob->nlaflag, type); // xxx
732 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
733 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
735 return GET_ACF_FLAG_PTR(ob->adt->flag, type);
738 default: /* unsupported */
743 /* object type define */
744 static bAnimChannelType ACF_OBJECT =
746 "Object", /* type name */
747 ACHANNEL_ROLE_EXPANDER, /* role */
749 acf_generic_root_color, /* backdrop color */
750 acf_generic_root_backdrop, /* backdrop */
751 acf_generic_indention_0, /* indent level */
754 acf_object_name, /* name */
755 acf_object_name_prop, /* name prop */
756 acf_object_icon, /* icon */
758 acf_object_setting_valid, /* has setting */
759 acf_object_setting_flag, /* flag for setting */
760 acf_object_setting_ptr /* pointer for setting */
763 /* Group ------------------------------------------- */
765 /* get backdrop color for group widget */
766 static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
768 bActionGroup *agrp = (bActionGroup *)ale->data;
769 bool showGroupColors = acf_show_channel_colors(ac);
771 if (showGroupColors && agrp->customCol) {
774 /* highlight only for active */
775 if (ale->flag & AGRP_ACTIVE)
776 copy_v3_v3_char((char *)cp, agrp->cs.select);
778 copy_v3_v3_char((char *)cp, agrp->cs.solid);
780 /* copy the colors over, transforming from bytes to floats */
781 rgb_uchar_to_float(r_color, cp);
784 /* highlight only for active */
785 if (ale->flag & AGRP_ACTIVE)
786 UI_GetThemeColorShade3fv(TH_GROUP_ACTIVE, 10, r_color);
788 UI_GetThemeColorShade3fv(TH_GROUP, 20, r_color);
792 /* backdrop for group widget */
793 static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
795 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
796 View2D *v2d = &ac->ar->v2d;
797 short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
798 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
801 /* set backdrop drawing color */
802 acf->get_backdrop_color(ac, ale, color);
805 /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
806 UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
807 UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8);
810 /* name for group entries */
811 static void acf_group_name(bAnimListElem *ale, char *name)
813 bActionGroup *agrp = (bActionGroup *)ale->data;
815 /* just copy the name... */
817 BLI_strncpy(name, agrp->name, ANIM_CHAN_NAME_SIZE);
820 /* name property for group entries */
821 static bool acf_group_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
823 RNA_pointer_create(ale->id, &RNA_ActionGroup, ale->data, ptr);
824 *prop = RNA_struct_name_property(ptr->type);
826 return (*prop != NULL);
829 /* check if some setting exists for this channel */
830 static bool acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
832 /* for now, all settings are supported, though some are only conditionally */
835 case ACHANNEL_SETTING_SOLO: /* Only available in NLA Editor for tracks */
838 /* conditionally supported */
839 case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
840 return (ac->spacetype == SPACE_IPO);
842 default: /* always supported */
847 /* get the appropriate flag(s) for the setting when it is valid */
848 static int acf_group_setting_flag(bAnimContext *ac, eAnimChannel_Settings setting, bool *neg)
850 /* clear extra return data first */
854 case ACHANNEL_SETTING_SELECT: /* selected */
855 return AGRP_SELECTED;
857 case ACHANNEL_SETTING_EXPAND: /* expanded */
859 /* NOTE: Graph Editor uses a different flag to everywhere else for this,
860 * allowing different collapsing of groups there, since sharing the flag
861 * proved to be a hazard for workflows...
863 return (ac->spacetype == SPACE_IPO) ?
864 AGRP_EXPANDED_G : /* Graph Editor case */
865 AGRP_EXPANDED; /* DopeSheet and elsewhere */
868 case ACHANNEL_SETTING_MUTE: /* muted */
871 case ACHANNEL_SETTING_MOD_OFF: /* muted */
873 return AGRP_MODIFIERS_OFF;
875 case ACHANNEL_SETTING_PROTECT: /* protected */
876 return AGRP_PROTECTED;
878 case ACHANNEL_SETTING_VISIBLE: /* visibility - graph editor */
880 return AGRP_NOTVISIBLE;
883 /* this shouldn't happen */
888 /* get pointer to the setting */
889 static void *acf_group_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
891 bActionGroup *agrp = (bActionGroup *)ale->data;
893 /* all flags are just in agrp->flag for now... */
894 return GET_ACF_FLAG_PTR(agrp->flag, type);
897 /* group type define */
898 static bAnimChannelType ACF_GROUP =
900 "Group", /* type name */
901 ACHANNEL_ROLE_CHANNEL, /* role */
903 acf_group_color, /* backdrop color */
904 acf_group_backdrop, /* backdrop */
905 acf_generic_indention_0, /* indent level */
906 acf_generic_group_offset, /* offset */
908 acf_group_name, /* name */
909 acf_group_name_prop, /* name prop */
912 acf_group_setting_valid, /* has setting */
913 acf_group_setting_flag, /* flag for setting */
914 acf_group_setting_ptr /* pointer for setting */
917 /* F-Curve ------------------------------------------- */
919 /* name for fcurve entries */
920 static void acf_fcurve_name(bAnimListElem *ale, char *name)
922 getname_anim_fcurve(name, ale->id, ale->data);
925 /* "name" property for fcurve entries */
926 static bool acf_fcurve_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
928 FCurve *fcu = (FCurve *)ale->data;
930 /* Ctrl-Click Usability Convenience Hack:
931 * For disabled F-Curves, allow access to the RNA Path
932 * as our "name" so that user can perform quick fixes
934 if (fcu->flag & FCURVE_DISABLED) {
935 RNA_pointer_create(ale->id, &RNA_FCurve, ale->data, ptr);
936 *prop = RNA_struct_find_property(ptr, "data_path");
939 /* for "normal" F-Curves - no editable name, but *prop may not be set properly yet... */
943 return (*prop != NULL);
946 /* check if some setting exists for this channel */
947 static bool acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
949 FCurve *fcu = (FCurve *)ale->data;
953 case ACHANNEL_SETTING_SOLO: /* Solo Flag is only for NLA */
954 case ACHANNEL_SETTING_EXPAND: /* F-Curves are not containers */
955 case ACHANNEL_SETTING_PINNED: /* This is only for NLA Actions */
958 /* conditionally available */
959 case ACHANNEL_SETTING_PROTECT: /* Protection is only valid when there's keyframes */
963 return false; // NOTE: in this special case, we need to draw ICON_ZOOMOUT
965 case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
966 return (ac->spacetype == SPACE_IPO);
968 /* always available */
974 /* get the appropriate flag(s) for the setting when it is valid */
975 static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
977 /* clear extra return data first */
981 case ACHANNEL_SETTING_SELECT: /* selected */
982 return FCURVE_SELECTED;
984 case ACHANNEL_SETTING_MUTE: /* muted */
987 case ACHANNEL_SETTING_PROTECT: /* protected */
988 return FCURVE_PROTECTED;
990 case ACHANNEL_SETTING_VISIBLE: /* visibility - graph editor */
991 return FCURVE_VISIBLE;
993 case ACHANNEL_SETTING_MOD_OFF:
995 return FCURVE_MOD_OFF;
997 default: /* unsupported */
1002 /* get pointer to the setting */
1003 static void *acf_fcurve_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
1005 FCurve *fcu = (FCurve *)ale->data;
1007 /* all flags are just in agrp->flag for now... */
1008 return GET_ACF_FLAG_PTR(fcu->flag, type);
1011 /* fcurve type define */
1012 static bAnimChannelType ACF_FCURVE =
1014 "F-Curve", /* type name */
1015 ACHANNEL_ROLE_CHANNEL, /* role */
1017 acf_generic_channel_color, /* backdrop color */
1018 acf_generic_channel_backdrop, /* backdrop */
1019 acf_generic_indention_flexible, /* indent level */ // xxx rename this to f-curves only?
1020 acf_generic_group_offset, /* offset */
1022 acf_fcurve_name, /* name */
1023 acf_fcurve_name_prop, /* name prop */
1026 acf_fcurve_setting_valid, /* has setting */
1027 acf_fcurve_setting_flag, /* flag for setting */
1028 acf_fcurve_setting_ptr /* pointer for setting */
1031 /* NLA Control FCurves Expander ----------------------- */
1033 /* get backdrop color for nla controls widget */
1034 static void acf_nla_controls_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
1036 // TODO: give this its own theme setting?
1037 UI_GetThemeColorShade3fv(TH_GROUP, 55, r_color);
1040 /* backdrop for nla controls expander widget */
1041 static void acf_nla_controls_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
1043 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
1044 View2D *v2d = &ac->ar->v2d;
1045 short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
1046 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
1049 /* set backdrop drawing color */
1050 acf->get_backdrop_color(ac, ale, color);
1053 /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
1054 UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
1055 UI_draw_roundbox_gl_mode(GL_POLYGON, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 5);
1058 /* name for nla controls expander entries */
1059 static void acf_nla_controls_name(bAnimListElem *UNUSED(ale), char *name)
1061 BLI_strncpy(name, IFACE_("NLA Strip Controls"), ANIM_CHAN_NAME_SIZE);
1064 /* check if some setting exists for this channel */
1065 static bool acf_nla_controls_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
1067 /* for now, all settings are supported, though some are only conditionally */
1070 case ACHANNEL_SETTING_EXPAND:
1075 default: /* unsupported */
1080 /* get the appropriate flag(s) for the setting when it is valid */
1081 static int acf_nla_controls_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1083 /* clear extra return data first */
1087 case ACHANNEL_SETTING_EXPAND: /* expanded */
1089 return ADT_NLA_SKEYS_COLLAPSED;
1092 /* this shouldn't happen */
1097 /* get pointer to the setting */
1098 static void *acf_nla_controls_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
1100 AnimData *adt = (AnimData *)ale->data;
1102 /* all flags are just in adt->flag for now... */
1103 return GET_ACF_FLAG_PTR(adt->flag, type);
1106 static int acf_nla_controls_icon(bAnimListElem *UNUSED(ale))
1111 /* NLA Control FCurves Expander type define */
1112 static bAnimChannelType ACF_NLACONTROLS =
1114 "NLA Controls Expander", /* type name */
1115 ACHANNEL_ROLE_EXPANDER, /* role */
1117 acf_nla_controls_color, /* backdrop color */
1118 acf_nla_controls_backdrop, /* backdrop */
1119 acf_generic_indention_0, /* indent level */
1120 acf_generic_group_offset, /* offset */
1122 acf_nla_controls_name, /* name */
1123 NULL, /* name prop */
1124 acf_nla_controls_icon, /* icon */
1126 acf_nla_controls_setting_valid, /* has setting */
1127 acf_nla_controls_setting_flag, /* flag for setting */
1128 acf_nla_controls_setting_ptr /* pointer for setting */
1132 /* NLA Control F-Curve -------------------------------- */
1134 /* name for nla control fcurve entries */
1135 static void acf_nla_curve_name(bAnimListElem *ale, char *name)
1137 NlaStrip *strip = ale->owner;
1138 FCurve *fcu = ale->data;
1141 /* try to get RNA property that this shortened path (relative to the strip) refers to */
1142 prop = RNA_struct_type_find_property(&RNA_NlaStrip, fcu->rna_path);
1144 /* "name" of this strip displays the UI identifier + the name of the NlaStrip */
1145 BLI_snprintf(name, 256, "%s (%s)", RNA_property_ui_name(prop), strip->name);
1148 /* unknown property... */
1149 BLI_snprintf(name, 256, "%s[%d]", fcu->rna_path, fcu->array_index);
1154 /* NLA Control F-Curve type define */
1155 static bAnimChannelType ACF_NLACURVE =
1157 "NLA Control F-Curve", /* type name */
1158 ACHANNEL_ROLE_CHANNEL, /* role */
1160 acf_generic_channel_color, /* backdrop color */
1161 acf_generic_channel_backdrop, /* backdrop */
1162 acf_generic_indention_1, /* indent level */
1163 acf_generic_group_offset, /* offset */
1165 acf_nla_curve_name, /* name */
1166 acf_fcurve_name_prop, /* name prop */
1169 acf_fcurve_setting_valid, /* has setting */
1170 acf_fcurve_setting_flag, /* flag for setting */
1171 acf_fcurve_setting_ptr /* pointer for setting */
1174 /* Object Action Expander ------------------------------------------- */
1176 // TODO: just get this from RNA?
1177 static int acf_fillactd_icon(bAnimListElem *UNUSED(ale))
1182 /* check if some setting exists for this channel */
1183 static bool acf_fillactd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
1186 /* only select and expand supported */
1187 case ACHANNEL_SETTING_SELECT:
1188 case ACHANNEL_SETTING_EXPAND:
1196 /* get the appropriate flag(s) for the setting when it is valid */
1197 static int acf_fillactd_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1199 /* clear extra return data first */
1203 case ACHANNEL_SETTING_SELECT: /* selected */
1204 return ADT_UI_SELECTED;
1206 case ACHANNEL_SETTING_EXPAND: /* expanded */
1208 return ACT_COLLAPSED;
1210 default: /* unsupported */
1215 /* get pointer to the setting */
1216 static void *acf_fillactd_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1218 bAction *act = (bAction *)ale->data;
1219 AnimData *adt = ale->adt;
1221 /* clear extra return data first */
1225 case ACHANNEL_SETTING_SELECT: /* selected */
1227 return GET_ACF_FLAG_PTR(adt->flag, type);
1231 case ACHANNEL_SETTING_EXPAND: /* expanded */
1232 return GET_ACF_FLAG_PTR(act->flag, type);
1234 default: /* unsupported */
1239 /* object action expander type define */
1240 static bAnimChannelType ACF_FILLACTD =
1242 "Ob-Action Filler", /* type name */
1243 ACHANNEL_ROLE_EXPANDER, /* role */
1245 acf_generic_dataexpand_color, /* backdrop color */
1246 acf_generic_dataexpand_backdrop, /* backdrop */
1247 acf_generic_indention_1, /* indent level */
1248 acf_generic_basic_offset, /* offset */
1250 acf_generic_idblock_name, /* name */
1251 acf_generic_idfill_name_prop, /* name prop */
1252 acf_fillactd_icon, /* icon */
1254 acf_fillactd_setting_valid, /* has setting */
1255 acf_fillactd_setting_flag, /* flag for setting */
1256 acf_fillactd_setting_ptr /* pointer for setting */
1259 /* Drivers Expander ------------------------------------------- */
1261 // TODO: just get this from RNA?
1262 static int acf_filldrivers_icon(bAnimListElem *UNUSED(ale))
1267 static void acf_filldrivers_name(bAnimListElem *UNUSED(ale), char *name)
1269 BLI_strncpy(name, IFACE_("Drivers"), ANIM_CHAN_NAME_SIZE);
1272 /* check if some setting exists for this channel */
1273 // TODO: this could be made more generic
1274 static bool acf_filldrivers_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
1277 /* only expand supported */
1278 case ACHANNEL_SETTING_EXPAND:
1286 /* get the appropriate flag(s) for the setting when it is valid */
1287 static int acf_filldrivers_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1289 /* clear extra return data first */
1293 case ACHANNEL_SETTING_EXPAND: /* expanded */
1295 return ADT_DRIVERS_COLLAPSED;
1297 default: /* unsupported */
1302 /* get pointer to the setting */
1303 static void *acf_filldrivers_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1305 AnimData *adt = (AnimData *)ale->data;
1307 /* clear extra return data first */
1311 case ACHANNEL_SETTING_EXPAND: /* expanded */
1312 return GET_ACF_FLAG_PTR(adt->flag, type);
1314 default: /* unsupported */
1319 /* drivers expander type define */
1320 static bAnimChannelType ACF_FILLDRIVERS =
1322 "Drivers Filler", /* type name */
1323 ACHANNEL_ROLE_EXPANDER, /* role */
1325 acf_generic_dataexpand_color, /* backdrop color */
1326 acf_generic_dataexpand_backdrop, /* backdrop */
1327 acf_generic_indention_1, /* indent level */
1328 acf_generic_basic_offset, /* offset */
1330 acf_filldrivers_name, /* name */
1331 NULL, /* name prop */
1332 acf_filldrivers_icon, /* icon */
1334 acf_filldrivers_setting_valid, /* has setting */
1335 acf_filldrivers_setting_flag, /* flag for setting */
1336 acf_filldrivers_setting_ptr /* pointer for setting */
1340 /* Material Expander ------------------------------------------- */
1342 // TODO: just get this from RNA?
1343 static int acf_dsmat_icon(bAnimListElem *UNUSED(ale))
1345 return ICON_MATERIAL_DATA;
1348 /* get the appropriate flag(s) for the setting when it is valid */
1349 static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1351 /* clear extra return data first */
1355 case ACHANNEL_SETTING_EXPAND: /* expanded */
1356 return MA_DS_EXPAND;
1358 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1359 return ADT_NLA_EVAL_OFF;
1361 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1363 return ADT_CURVES_NOT_VISIBLE;
1365 case ACHANNEL_SETTING_SELECT: /* selected */
1366 return ADT_UI_SELECTED;
1368 default: /* unsupported */
1373 /* get pointer to the setting */
1374 static void *acf_dsmat_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1376 Material *ma = (Material *)ale->data;
1378 /* clear extra return data first */
1382 case ACHANNEL_SETTING_EXPAND: /* expanded */
1383 return GET_ACF_FLAG_PTR(ma->flag, type);
1385 case ACHANNEL_SETTING_SELECT: /* selected */
1386 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1387 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1389 return GET_ACF_FLAG_PTR(ma->adt->flag, type);
1392 default: /* unsupported */
1397 /* material expander type define */
1398 static bAnimChannelType ACF_DSMAT =
1400 "Material Data Expander", /* type name */
1401 ACHANNEL_ROLE_EXPANDER, /* role */
1403 acf_generic_dataexpand_color, /* backdrop color */
1404 acf_generic_dataexpand_backdrop, /* backdrop */
1405 acf_generic_indention_1, /* indent level */
1406 acf_generic_basic_offset, /* offset */
1408 acf_generic_idblock_name, /* name */
1409 acf_generic_idblock_name_prop, /* name prop */
1410 acf_dsmat_icon, /* icon */
1412 acf_generic_dataexpand_setting_valid, /* has setting */
1413 acf_dsmat_setting_flag, /* flag for setting */
1414 acf_dsmat_setting_ptr /* pointer for setting */
1417 /* Lamp Expander ------------------------------------------- */
1419 // TODO: just get this from RNA?
1420 static int acf_dslam_icon(bAnimListElem *UNUSED(ale))
1422 return ICON_LAMP_DATA;
1425 /* get the appropriate flag(s) for the setting when it is valid */
1426 static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1428 /* clear extra return data first */
1432 case ACHANNEL_SETTING_EXPAND: /* expanded */
1433 return LA_DS_EXPAND;
1435 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1436 return ADT_NLA_EVAL_OFF;
1438 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1440 return ADT_CURVES_NOT_VISIBLE;
1442 case ACHANNEL_SETTING_SELECT: /* selected */
1443 return ADT_UI_SELECTED;
1445 default: /* unsupported */
1450 /* get pointer to the setting */
1451 static void *acf_dslam_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1453 Lamp *la = (Lamp *)ale->data;
1455 /* clear extra return data first */
1459 case ACHANNEL_SETTING_EXPAND: /* expanded */
1460 return GET_ACF_FLAG_PTR(la->flag, type);
1462 case ACHANNEL_SETTING_SELECT: /* selected */
1463 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1464 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1466 return GET_ACF_FLAG_PTR(la->adt->flag, type);
1469 default: /* unsupported */
1474 /* lamp expander type define */
1475 static bAnimChannelType ACF_DSLAM =
1477 "Lamp Expander", /* type name */
1478 ACHANNEL_ROLE_EXPANDER, /* role */
1480 acf_generic_dataexpand_color, /* backdrop color */
1481 acf_generic_dataexpand_backdrop, /* backdrop */
1482 acf_generic_indention_1, /* indent level */
1483 acf_generic_basic_offset, /* offset */
1485 acf_generic_idblock_name, /* name */
1486 acf_generic_idblock_name_prop, /* name prop */
1487 acf_dslam_icon, /* icon */
1489 acf_generic_dataexpand_setting_valid, /* has setting */
1490 acf_dslam_setting_flag, /* flag for setting */
1491 acf_dslam_setting_ptr /* pointer for setting */
1494 /* Texture Expander ------------------------------------------- */
1496 // TODO: just get this from RNA?
1497 static int acf_dstex_icon(bAnimListElem *UNUSED(ale))
1499 return ICON_TEXTURE_DATA;
1502 /* offset for texture expanders */
1503 // FIXME: soon to be obsolete?
1504 static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale))
1506 return 14; // XXX: simply include this in indention instead?
1509 /* get the appropriate flag(s) for the setting when it is valid */
1510 static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1512 /* clear extra return data first */
1516 case ACHANNEL_SETTING_EXPAND: /* expanded */
1517 return TEX_DS_EXPAND;
1519 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1520 return ADT_NLA_EVAL_OFF;
1522 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1524 return ADT_CURVES_NOT_VISIBLE;
1526 case ACHANNEL_SETTING_SELECT: /* selected */
1527 return ADT_UI_SELECTED;
1529 default: /* unsupported */
1534 /* get pointer to the setting */
1535 static void *acf_dstex_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1537 Tex *tex = (Tex *)ale->data;
1539 /* clear extra return data first */
1543 case ACHANNEL_SETTING_EXPAND: /* expanded */
1544 return GET_ACF_FLAG_PTR(tex->flag, type);
1546 case ACHANNEL_SETTING_SELECT: /* selected */
1547 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1548 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1550 return GET_ACF_FLAG_PTR(tex->adt->flag, type);
1553 default: /* unsupported */
1558 /* texture expander type define */
1559 static bAnimChannelType ACF_DSTEX =
1561 "Texture Data Expander", /* type name */
1562 ACHANNEL_ROLE_EXPANDER, /* role */
1564 acf_generic_dataexpand_color, /* backdrop color */
1565 acf_generic_dataexpand_backdrop, /* backdrop */
1566 acf_generic_indention_1, /* indent level */
1567 acf_dstex_offset, /* offset */
1569 acf_generic_idblock_name, /* name */
1570 acf_generic_idfill_name_prop, /* name prop */
1571 acf_dstex_icon, /* icon */
1573 acf_generic_dataexpand_setting_valid, /* has setting */
1574 acf_dstex_setting_flag, /* flag for setting */
1575 acf_dstex_setting_ptr /* pointer for setting */
1578 /* Camera Expander ------------------------------------------- */
1580 // TODO: just get this from RNA?
1581 static int acf_dscam_icon(bAnimListElem *UNUSED(ale))
1583 return ICON_CAMERA_DATA;
1586 /* get the appropriate flag(s) for the setting when it is valid */
1587 static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1589 /* clear extra return data first */
1593 case ACHANNEL_SETTING_EXPAND: /* expanded */
1594 return CAM_DS_EXPAND;
1596 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1597 return ADT_NLA_EVAL_OFF;
1599 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1601 return ADT_CURVES_NOT_VISIBLE;
1603 case ACHANNEL_SETTING_SELECT: /* selected */
1604 return ADT_UI_SELECTED;
1606 default: /* unsupported */
1611 /* get pointer to the setting */
1612 static void *acf_dscam_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1614 Camera *ca = (Camera *)ale->data;
1616 /* clear extra return data first */
1620 case ACHANNEL_SETTING_EXPAND: /* expanded */
1621 return GET_ACF_FLAG_PTR(ca->flag, type);
1623 case ACHANNEL_SETTING_SELECT: /* selected */
1624 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1625 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1627 return GET_ACF_FLAG_PTR(ca->adt->flag, type);
1630 default: /* unsupported */
1635 /* camera expander type define */
1636 static bAnimChannelType ACF_DSCAM =
1638 "Camera Expander", /* type name */
1639 ACHANNEL_ROLE_EXPANDER, /* role */
1641 acf_generic_dataexpand_color, /* backdrop color */
1642 acf_generic_dataexpand_backdrop, /* backdrop */
1643 acf_generic_indention_1, /* indent level */
1644 acf_generic_basic_offset, /* offset */
1646 acf_generic_idblock_name, /* name */
1647 acf_generic_idfill_name_prop, /* name prop */
1648 acf_dscam_icon, /* icon */
1650 acf_generic_dataexpand_setting_valid, /* has setting */
1651 acf_dscam_setting_flag, /* flag for setting */
1652 acf_dscam_setting_ptr /* pointer for setting */
1655 /* Curve Expander ------------------------------------------- */
1657 // TODO: just get this from RNA?
1658 static int acf_dscur_icon(bAnimListElem *ale)
1660 Curve *cu = (Curve *)ale->data;
1661 short obtype = BKE_curve_type_get(cu);
1665 return ICON_FONT_DATA;
1667 return ICON_SURFACE_DATA;
1669 return ICON_CURVE_DATA;
1673 /* get the appropriate flag(s) for the setting when it is valid */
1674 static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1676 /* clear extra return data first */
1680 case ACHANNEL_SETTING_EXPAND: /* expanded */
1681 return CU_DS_EXPAND;
1683 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1684 return ADT_NLA_EVAL_OFF;
1686 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1688 return ADT_CURVES_NOT_VISIBLE;
1690 case ACHANNEL_SETTING_SELECT: /* selected */
1691 return ADT_UI_SELECTED;
1693 default: /* unsupported */
1698 /* get pointer to the setting */
1699 static void *acf_dscur_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1701 Curve *cu = (Curve *)ale->data;
1703 /* clear extra return data first */
1707 case ACHANNEL_SETTING_EXPAND: /* expanded */
1708 return GET_ACF_FLAG_PTR(cu->flag, type);
1710 case ACHANNEL_SETTING_SELECT: /* selected */
1711 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1712 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1714 return GET_ACF_FLAG_PTR(cu->adt->flag, type);
1717 default: /* unsupported */
1722 /* curve expander type define */
1723 static bAnimChannelType ACF_DSCUR =
1725 "Curve Expander", /* type name */
1726 ACHANNEL_ROLE_EXPANDER, /* role */
1728 acf_generic_dataexpand_color, /* backdrop color */
1729 acf_generic_dataexpand_backdrop, /* backdrop */
1730 acf_generic_indention_1, /* indent level */
1731 acf_generic_basic_offset, /* offset */
1733 acf_generic_idblock_name, /* name */
1734 acf_generic_idblock_name_prop, /* name prop */
1735 acf_dscur_icon, /* icon */
1737 acf_generic_dataexpand_setting_valid, /* has setting */
1738 acf_dscur_setting_flag, /* flag for setting */
1739 acf_dscur_setting_ptr /* pointer for setting */
1742 /* Shape Key Expander ------------------------------------------- */
1744 // TODO: just get this from RNA?
1745 static int acf_dsskey_icon(bAnimListElem *UNUSED(ale))
1747 return ICON_SHAPEKEY_DATA;
1750 /* get the appropriate flag(s) for the setting when it is valid */
1751 static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1753 /* clear extra return data first */
1757 case ACHANNEL_SETTING_EXPAND: /* expanded */
1758 return KEY_DS_EXPAND;
1760 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1761 return ADT_NLA_EVAL_OFF;
1763 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1765 return ADT_CURVES_NOT_VISIBLE;
1767 case ACHANNEL_SETTING_SELECT: /* selected */
1768 return ADT_UI_SELECTED;
1770 default: /* unsupported */
1775 /* get pointer to the setting */
1776 static void *acf_dsskey_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1778 Key *key = (Key *)ale->data;
1780 /* clear extra return data first */
1784 case ACHANNEL_SETTING_EXPAND: /* expanded */
1785 return GET_ACF_FLAG_PTR(key->flag, type);
1787 case ACHANNEL_SETTING_SELECT: /* selected */
1788 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1789 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1791 return GET_ACF_FLAG_PTR(key->adt->flag, type);
1794 default: /* unsupported */
1799 /* shapekey expander type define */
1800 static bAnimChannelType ACF_DSSKEY =
1802 "Shape Key Expander", /* type name */
1803 ACHANNEL_ROLE_EXPANDER, /* role */
1805 acf_generic_dataexpand_color, /* backdrop color */
1806 acf_generic_dataexpand_backdrop, /* backdrop */
1807 acf_generic_indention_1, /* indent level */
1808 acf_generic_basic_offset, /* offset */
1810 acf_generic_idblock_name, /* name */
1811 acf_generic_idblock_name_prop, /* name prop */
1812 acf_dsskey_icon, /* icon */
1814 acf_generic_dataexpand_setting_valid, /* has setting */
1815 acf_dsskey_setting_flag, /* flag for setting */
1816 acf_dsskey_setting_ptr /* pointer for setting */
1819 /* World Expander ------------------------------------------- */
1821 // TODO: just get this from RNA?
1822 static int acf_dswor_icon(bAnimListElem *UNUSED(ale))
1824 return ICON_WORLD_DATA;
1827 /* get the appropriate flag(s) for the setting when it is valid */
1828 static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1830 /* clear extra return data first */
1834 case ACHANNEL_SETTING_EXPAND: /* expanded */
1835 return WO_DS_EXPAND;
1837 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1838 return ADT_NLA_EVAL_OFF;
1840 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1842 return ADT_CURVES_NOT_VISIBLE;
1844 case ACHANNEL_SETTING_SELECT: /* selected */
1845 return ADT_UI_SELECTED;
1847 default: /* unsupported */
1852 /* get pointer to the setting */
1853 static void *acf_dswor_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1855 World *wo = (World *)ale->data;
1857 /* clear extra return data first */
1861 case ACHANNEL_SETTING_EXPAND: /* expanded */
1862 return GET_ACF_FLAG_PTR(wo->flag, type);
1864 case ACHANNEL_SETTING_SELECT: /* selected */
1865 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1866 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1868 return GET_ACF_FLAG_PTR(wo->adt->flag, type);
1871 default: /* unsupported */
1876 /* world expander type define */
1877 static bAnimChannelType ACF_DSWOR =
1879 "World Expander", /* type name */
1880 ACHANNEL_ROLE_EXPANDER, /* role */
1882 acf_generic_dataexpand_color, /* backdrop color */
1883 acf_generic_dataexpand_backdrop, /* backdrop */
1884 acf_generic_indention_1, /* indent level */
1885 acf_generic_basic_offset, /* offset */
1887 acf_generic_idblock_name, /* name */
1888 acf_generic_idfill_name_prop, /* name prop */
1889 acf_dswor_icon, /* icon */
1891 acf_generic_dataexpand_setting_valid, /* has setting */
1892 acf_dswor_setting_flag, /* flag for setting */
1893 acf_dswor_setting_ptr /* pointer for setting */
1896 /* Particle Expander ------------------------------------------- */
1898 // TODO: just get this from RNA?
1899 static int acf_dspart_icon(bAnimListElem *UNUSED(ale))
1901 return ICON_PARTICLE_DATA;
1904 /* get the appropriate flag(s) for the setting when it is valid */
1905 static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1907 /* clear extra return data first */
1911 case ACHANNEL_SETTING_EXPAND: /* expanded */
1912 return PART_DS_EXPAND;
1914 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1915 return ADT_NLA_EVAL_OFF;
1917 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1919 return ADT_CURVES_NOT_VISIBLE;
1921 case ACHANNEL_SETTING_SELECT: /* selected */
1922 return ADT_UI_SELECTED;
1924 default: /* unsupported */
1929 /* get pointer to the setting */
1930 static void *acf_dspart_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1932 ParticleSettings *part = (ParticleSettings *)ale->data;
1934 /* clear extra return data first */
1938 case ACHANNEL_SETTING_EXPAND: /* expanded */
1939 return GET_ACF_FLAG_PTR(part->flag, type);
1941 case ACHANNEL_SETTING_SELECT: /* selected */
1942 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1943 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1945 return GET_ACF_FLAG_PTR(part->adt->flag, type);
1948 default: /* unsupported */
1953 /* particle expander type define */
1954 static bAnimChannelType ACF_DSPART =
1956 "Particle Data Expander", /* type name */
1957 ACHANNEL_ROLE_EXPANDER, /* role */
1959 acf_generic_dataexpand_color, /* backdrop color */
1960 acf_generic_dataexpand_backdrop, /* backdrop */
1961 acf_generic_indention_1, /* indent level */
1962 acf_generic_basic_offset, /* offset */
1964 acf_generic_idblock_name, /* name */
1965 acf_generic_idblock_name_prop, /* name prop */
1966 acf_dspart_icon, /* icon */
1968 acf_generic_dataexpand_setting_valid, /* has setting */
1969 acf_dspart_setting_flag, /* flag for setting */
1970 acf_dspart_setting_ptr /* pointer for setting */
1973 /* MetaBall Expander ------------------------------------------- */
1975 // TODO: just get this from RNA?
1976 static int acf_dsmball_icon(bAnimListElem *UNUSED(ale))
1978 return ICON_META_DATA;
1981 /* get the appropriate flag(s) for the setting when it is valid */
1982 static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1984 /* clear extra return data first */
1988 case ACHANNEL_SETTING_EXPAND: /* expanded */
1989 return MB_DS_EXPAND;
1991 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1992 return ADT_NLA_EVAL_OFF;
1994 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1996 return ADT_CURVES_NOT_VISIBLE;
1998 case ACHANNEL_SETTING_SELECT: /* selected */
1999 return ADT_UI_SELECTED;
2001 default: /* unsupported */
2006 /* get pointer to the setting */
2007 static void *acf_dsmball_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2009 MetaBall *mb = (MetaBall *)ale->data;
2011 /* clear extra return data first */
2015 case ACHANNEL_SETTING_EXPAND: /* expanded */
2016 return GET_ACF_FLAG_PTR(mb->flag2, type);
2018 case ACHANNEL_SETTING_SELECT: /* selected */
2019 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2020 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2022 return GET_ACF_FLAG_PTR(mb->adt->flag, type);
2025 default: /* unsupported */
2030 /* metaball expander type define */
2031 static bAnimChannelType ACF_DSMBALL =
2033 "Metaball Expander", /* type name */
2034 ACHANNEL_ROLE_EXPANDER, /* role */
2036 acf_generic_dataexpand_color, /* backdrop color */
2037 acf_generic_dataexpand_backdrop, /* backdrop */
2038 acf_generic_indention_1, /* indent level */
2039 acf_generic_basic_offset, /* offset */
2041 acf_generic_idblock_name, /* name */
2042 acf_generic_idblock_name_prop, /* name prop */
2043 acf_dsmball_icon, /* icon */
2045 acf_generic_dataexpand_setting_valid, /* has setting */
2046 acf_dsmball_setting_flag, /* flag for setting */
2047 acf_dsmball_setting_ptr /* pointer for setting */
2050 /* Armature Expander ------------------------------------------- */
2052 // TODO: just get this from RNA?
2053 static int acf_dsarm_icon(bAnimListElem *UNUSED(ale))
2055 return ICON_ARMATURE_DATA;
2058 /* get the appropriate flag(s) for the setting when it is valid */
2059 static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2061 /* clear extra return data first */
2065 case ACHANNEL_SETTING_EXPAND: /* expanded */
2066 return ARM_DS_EXPAND;
2068 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2069 return ADT_NLA_EVAL_OFF;
2071 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2073 return ADT_CURVES_NOT_VISIBLE;
2075 case ACHANNEL_SETTING_SELECT: /* selected */
2076 return ADT_UI_SELECTED;
2078 default: /* unsupported */
2083 /* get pointer to the setting */
2084 static void *acf_dsarm_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2086 bArmature *arm = (bArmature *)ale->data;
2088 /* clear extra return data first */
2092 case ACHANNEL_SETTING_EXPAND: /* expanded */
2093 return GET_ACF_FLAG_PTR(arm->flag, type);
2095 case ACHANNEL_SETTING_SELECT: /* selected */
2096 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2097 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2099 return GET_ACF_FLAG_PTR(arm->adt->flag, type);
2102 default: /* unsupported */
2107 /* metaball expander type define */
2108 static bAnimChannelType ACF_DSARM =
2110 "Armature Expander", /* type name */
2111 ACHANNEL_ROLE_EXPANDER, /* role */
2113 acf_generic_dataexpand_color, /* backdrop color */
2114 acf_generic_dataexpand_backdrop, /* backdrop */
2115 acf_generic_indention_1, /* indent level */
2116 acf_generic_basic_offset, /* offset */
2118 acf_generic_idblock_name, /* name */
2119 acf_generic_idblock_name_prop, /* name prop */
2120 acf_dsarm_icon, /* icon */
2122 acf_generic_dataexpand_setting_valid, /* has setting */
2123 acf_dsarm_setting_flag, /* flag for setting */
2124 acf_dsarm_setting_ptr /* pointer for setting */
2127 /* NodeTree Expander ------------------------------------------- */
2129 // TODO: just get this from RNA?
2130 static int acf_dsntree_icon(bAnimListElem *UNUSED(ale))
2132 return ICON_NODETREE;
2135 /* offset for nodetree expanders */
2136 static short acf_dsntree_offset(bAnimContext *ac, bAnimListElem *ale)
2138 bNodeTree *ntree = (bNodeTree *)ale->data;
2139 short offset = acf_generic_basic_offset(ac, ale);
2141 offset += acf_nodetree_rootType_offset(ntree);
2146 /* get the appropriate flag(s) for the setting when it is valid */
2147 static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2149 /* clear extra return data first */
2153 case ACHANNEL_SETTING_EXPAND: /* expanded */
2154 return NTREE_DS_EXPAND;
2156 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2157 return ADT_NLA_EVAL_OFF;
2159 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2161 return ADT_CURVES_NOT_VISIBLE;
2163 case ACHANNEL_SETTING_SELECT: /* selected */
2164 return ADT_UI_SELECTED;
2166 default: /* unsupported */
2171 /* get pointer to the setting */
2172 static void *acf_dsntree_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2174 bNodeTree *ntree = (bNodeTree *)ale->data;
2176 /* clear extra return data first */
2180 case ACHANNEL_SETTING_EXPAND: /* expanded */
2181 return GET_ACF_FLAG_PTR(ntree->flag, type);
2183 case ACHANNEL_SETTING_SELECT: /* selected */
2184 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2185 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2187 return GET_ACF_FLAG_PTR(ntree->adt->flag, type);
2190 default: /* unsupported */
2195 /* node tree expander type define */
2196 static bAnimChannelType ACF_DSNTREE =
2198 "Node Tree Expander", /* type name */
2199 ACHANNEL_ROLE_EXPANDER, /* role */
2201 acf_generic_dataexpand_color, /* backdrop color */
2202 acf_generic_dataexpand_backdrop, /* backdrop */
2203 acf_generic_indention_1, /* indent level */
2204 acf_dsntree_offset, /* offset */
2206 acf_generic_idblock_name, /* name */
2207 acf_generic_idblock_name_prop, /* name prop */
2208 acf_dsntree_icon, /* icon */
2210 acf_generic_dataexpand_setting_valid, /* has setting */
2211 acf_dsntree_setting_flag, /* flag for setting */
2212 acf_dsntree_setting_ptr /* pointer for setting */
2215 /* LineStyle Expander ------------------------------------------- */
2217 /* TODO: just get this from RNA? */
2218 static int acf_dslinestyle_icon(bAnimListElem *UNUSED(ale))
2220 return ICON_LINE_DATA;
2223 /* get the appropriate flag(s) for the setting when it is valid */
2224 static int acf_dslinestyle_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2226 /* clear extra return data first */
2230 case ACHANNEL_SETTING_EXPAND: /* expanded */
2231 return LS_DS_EXPAND;
2233 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2234 return ADT_NLA_EVAL_OFF;
2236 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2238 return ADT_CURVES_NOT_VISIBLE;
2240 case ACHANNEL_SETTING_SELECT: /* selected */
2241 return ADT_UI_SELECTED;
2243 default: /* unsupported */
2248 /* get pointer to the setting */
2249 static void *acf_dslinestyle_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2251 FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ale->data;
2253 /* clear extra return data first */
2257 case ACHANNEL_SETTING_EXPAND: /* expanded */
2258 return GET_ACF_FLAG_PTR(linestyle->flag, type);
2260 case ACHANNEL_SETTING_SELECT: /* selected */
2261 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2262 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2264 return GET_ACF_FLAG_PTR(linestyle->adt->flag, type);
2267 default: /* unsupported */
2272 /* node tree expander type define */
2273 static bAnimChannelType ACF_DSLINESTYLE =
2275 "Line Style Expander", /* type name */
2276 ACHANNEL_ROLE_EXPANDER, /* role */
2278 acf_generic_dataexpand_color, /* backdrop color */
2279 acf_generic_dataexpand_backdrop,/* backdrop */
2280 acf_generic_indention_1, /* indent level */
2281 acf_generic_basic_offset, /* offset */
2283 acf_generic_idblock_name, /* name */
2284 acf_generic_idblock_name_prop, /* name prop */
2285 acf_dslinestyle_icon, /* icon */
2287 acf_generic_dataexpand_setting_valid, /* has setting */
2288 acf_dslinestyle_setting_flag, /* flag for setting */
2289 acf_dslinestyle_setting_ptr /* pointer for setting */
2292 /* Mesh Expander ------------------------------------------- */
2294 // TODO: just get this from RNA?
2295 static int acf_dsmesh_icon(bAnimListElem *UNUSED(ale))
2297 return ICON_MESH_DATA;
2300 /* get the appropriate flag(s) for the setting when it is valid */
2301 static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2303 /* clear extra return data first */
2307 case ACHANNEL_SETTING_EXPAND: /* expanded */
2308 return ME_DS_EXPAND;
2310 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2311 return ADT_NLA_EVAL_OFF;
2313 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2315 return ADT_CURVES_NOT_VISIBLE;
2317 case ACHANNEL_SETTING_SELECT: /* selected */
2318 return ADT_UI_SELECTED;
2320 default: /* unsupported */
2325 /* get pointer to the setting */
2326 static void *acf_dsmesh_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2328 Mesh *me = (Mesh *)ale->data;
2330 /* clear extra return data first */
2334 case ACHANNEL_SETTING_EXPAND: /* expanded */
2335 return GET_ACF_FLAG_PTR(me->flag, type);
2337 case ACHANNEL_SETTING_SELECT: /* selected */
2338 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2339 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2341 return GET_ACF_FLAG_PTR(me->adt->flag, type);
2344 default: /* unsupported */
2349 /* node tree expander type define */
2350 static bAnimChannelType ACF_DSMESH =
2352 "Mesh Expander", /* type name */
2353 ACHANNEL_ROLE_EXPANDER, /* role */
2355 acf_generic_dataexpand_color, /* backdrop color */
2356 acf_generic_dataexpand_backdrop, /* backdrop */
2357 acf_generic_indention_1, /* indent level */ // XXX this only works for compositing
2358 acf_generic_basic_offset, /* offset */
2360 acf_generic_idblock_name, /* name */
2361 acf_generic_idblock_name_prop, /* name prop */
2362 acf_dsmesh_icon, /* icon */
2364 acf_generic_dataexpand_setting_valid, /* has setting */
2365 acf_dsmesh_setting_flag, /* flag for setting */
2366 acf_dsmesh_setting_ptr /* pointer for setting */
2369 /* Lattice Expander ------------------------------------------- */
2371 // TODO: just get this from RNA?
2372 static int acf_dslat_icon(bAnimListElem *UNUSED(ale))
2374 return ICON_LATTICE_DATA;
2377 /* get the appropriate flag(s) for the setting when it is valid */
2378 static int acf_dslat_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2380 /* clear extra return data first */
2384 case ACHANNEL_SETTING_EXPAND: /* expanded */
2385 return LT_DS_EXPAND;
2387 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2388 return ADT_NLA_EVAL_OFF;
2390 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2392 return ADT_CURVES_NOT_VISIBLE;
2394 case ACHANNEL_SETTING_SELECT: /* selected */
2395 return ADT_UI_SELECTED;
2397 default: /* unsupported */
2402 /* get pointer to the setting */
2403 static void *acf_dslat_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2405 Lattice *lt = (Lattice *)ale->data;
2407 /* clear extra return data first */
2411 case ACHANNEL_SETTING_EXPAND: /* expanded */
2412 return GET_ACF_FLAG_PTR(lt->flag, type);
2414 case ACHANNEL_SETTING_SELECT: /* selected */
2415 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2416 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2418 return GET_ACF_FLAG_PTR(lt->adt->flag, type);
2421 default: /* unsupported */
2426 /* node tree expander type define */
2427 static bAnimChannelType ACF_DSLAT =
2429 "Lattice Expander", /* type name */
2430 ACHANNEL_ROLE_EXPANDER, /* role */
2432 acf_generic_dataexpand_color, /* backdrop color */
2433 acf_generic_dataexpand_backdrop, /* backdrop */
2434 acf_generic_indention_1, /* indent level */ // XXX this only works for compositing
2435 acf_generic_basic_offset, /* offset */
2437 acf_generic_idblock_name, /* name */
2438 acf_generic_idblock_name_prop, /* name prop */
2439 acf_dslat_icon, /* icon */
2441 acf_generic_dataexpand_setting_valid, /* has setting */
2442 acf_dslat_setting_flag, /* flag for setting */
2443 acf_dslat_setting_ptr /* pointer for setting */
2446 /* Speaker Expander ------------------------------------------- */
2448 // TODO: just get this from RNA?
2449 static int acf_dsspk_icon(bAnimListElem *UNUSED(ale))
2451 return ICON_SPEAKER;
2454 /* get the appropriate flag(s) for the setting when it is valid */
2455 static int acf_dsspk_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2457 /* clear extra return data first */
2461 case ACHANNEL_SETTING_EXPAND: /* expanded */
2462 return SPK_DS_EXPAND;
2464 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2465 return ADT_NLA_EVAL_OFF;
2467 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2469 return ADT_CURVES_NOT_VISIBLE;
2471 case ACHANNEL_SETTING_SELECT: /* selected */
2472 return ADT_UI_SELECTED;
2474 default: /* unsupported */
2479 /* get pointer to the setting */
2480 static void *acf_dsspk_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2482 Speaker *spk = (Speaker *)ale->data;
2484 /* clear extra return data first */
2488 case ACHANNEL_SETTING_EXPAND: /* expanded */
2489 return GET_ACF_FLAG_PTR(spk->flag, type);
2491 case ACHANNEL_SETTING_SELECT: /* selected */
2492 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2493 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2495 return GET_ACF_FLAG_PTR(spk->adt->flag, type);
2498 default: /* unsupported */
2503 /* speaker expander type define */
2504 static bAnimChannelType ACF_DSSPK =
2506 "Speaker Expander", /* type name */
2507 ACHANNEL_ROLE_EXPANDER, /* role */
2509 acf_generic_dataexpand_color, /* backdrop color */
2510 acf_generic_dataexpand_backdrop, /* backdrop */
2511 acf_generic_indention_1, /* indent level */
2512 acf_generic_basic_offset, /* offset */
2514 acf_generic_idblock_name, /* name */
2515 acf_generic_idblock_name_prop, /* name prop */
2516 acf_dsspk_icon, /* icon */
2518 acf_generic_dataexpand_setting_valid, /* has setting */
2519 acf_dsspk_setting_flag, /* flag for setting */
2520 acf_dsspk_setting_ptr /* pointer for setting */
2523 /* GPencil Expander ------------------------------------------- */
2525 // TODO: just get this from RNA?
2526 static int acf_dsgpencil_icon(bAnimListElem *UNUSED(ale))
2528 return ICON_GREASEPENCIL;
2531 /* get the appropriate flag(s) for the setting when it is valid */
2532 static int acf_dsgpencil_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2534 /* clear extra return data first */
2538 case ACHANNEL_SETTING_EXPAND: /* expanded */
2539 return GP_DATA_EXPAND;
2541 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2542 return ADT_NLA_EVAL_OFF;
2544 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2546 return ADT_CURVES_NOT_VISIBLE;
2548 case ACHANNEL_SETTING_SELECT: /* selected */
2549 return ADT_UI_SELECTED;
2551 default: /* unsupported */
2556 /* get pointer to the setting */
2557 static void *acf_dsgpencil_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2559 bGPdata *gpd = (bGPdata *)ale->data;
2561 /* clear extra return data first */
2565 case ACHANNEL_SETTING_EXPAND: /* expanded */
2566 return GET_ACF_FLAG_PTR(gpd->flag, type);
2568 case ACHANNEL_SETTING_SELECT: /* selected */
2569 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2570 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2572 return GET_ACF_FLAG_PTR(gpd->adt->flag, type);
2575 default: /* unsupported */
2580 /* grease pencil expander type define */
2581 static bAnimChannelType ACF_DSGPENCIL =
2583 "GPencil DS Expander", /* type name */
2584 ACHANNEL_ROLE_EXPANDER, /* role */
2586 acf_generic_dataexpand_color, /* backdrop color */
2587 acf_generic_dataexpand_backdrop, /* backdrop */
2588 acf_generic_indention_1, /* indent level */
2589 acf_generic_basic_offset, /* offset */
2591 acf_generic_idblock_name, /* name */
2592 acf_generic_idblock_name_prop, /* name prop */
2593 acf_dsgpencil_icon, /* icon */
2595 acf_generic_dataexpand_setting_valid, /* has setting */
2596 acf_dsgpencil_setting_flag, /* flag for setting */
2597 acf_dsgpencil_setting_ptr /* pointer for setting */
2600 /* ShapeKey Entry ------------------------------------------- */
2602 /* name for ShapeKey */
2603 static void acf_shapekey_name(bAnimListElem *ale, char *name)
2605 KeyBlock *kb = (KeyBlock *)ale->data;
2607 /* just copy the name... */
2609 /* if the KeyBlock had a name, use it, otherwise use the index */
2611 BLI_strncpy(name, kb->name, ANIM_CHAN_NAME_SIZE);
2613 BLI_snprintf(name, ANIM_CHAN_NAME_SIZE, IFACE_("Key %d"), ale->index);
2617 /* name property for ShapeKey entries */
2618 static bool acf_shapekey_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
2620 KeyBlock *kb = (KeyBlock *)ale->data;
2622 /* if the KeyBlock had a name, use it, otherwise use the index */
2623 if (kb && kb->name[0]) {
2624 RNA_pointer_create(ale->id, &RNA_ShapeKey, kb, ptr);
2625 *prop = RNA_struct_name_property(ptr->type);
2627 return (*prop != NULL);
2633 /* check if some setting exists for this channel */
2634 static bool acf_shapekey_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
2637 case ACHANNEL_SETTING_SELECT: /* selected */
2638 case ACHANNEL_SETTING_MUTE: /* muted */
2639 case ACHANNEL_SETTING_PROTECT: /* protected */
2642 /* nothing else is supported */
2648 /* get the appropriate flag(s) for the setting when it is valid */
2649 static int acf_shapekey_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2651 /* clear extra return data first */
2655 case ACHANNEL_SETTING_MUTE: /* mute */
2656 return KEYBLOCK_MUTE;
2658 case ACHANNEL_SETTING_SELECT: /* selected */
2659 return KEYBLOCK_SEL;
2661 case ACHANNEL_SETTING_PROTECT: /* locked */
2662 return KEYBLOCK_LOCKED;
2664 default: /* unsupported */
2669 /* get pointer to the setting */
2670 static void *acf_shapekey_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2672 KeyBlock *kb = (KeyBlock *)ale->data;
2674 /* clear extra return data first */
2678 case ACHANNEL_SETTING_SELECT: /* selected */
2679 case ACHANNEL_SETTING_MUTE: /* muted */
2680 case ACHANNEL_SETTING_PROTECT: /* protected */
2681 return GET_ACF_FLAG_PTR(kb->flag, type);
2683 default: /* unsupported */
2688 /* shapekey expander type define */
2689 static bAnimChannelType ACF_SHAPEKEY =
2691 "Shape Key", /* type name */
2692 ACHANNEL_ROLE_CHANNEL, /* role */
2694 acf_generic_channel_color, /* backdrop color */
2695 acf_generic_channel_backdrop, /* backdrop */
2696 acf_generic_indention_0, /* indent level */
2697 acf_generic_basic_offset, /* offset */
2699 acf_shapekey_name, /* name */
2700 acf_shapekey_name_prop, /* name prop */
2703 acf_shapekey_setting_valid, /* has setting */
2704 acf_shapekey_setting_flag, /* flag for setting */
2705 acf_shapekey_setting_ptr /* pointer for setting */
2708 /* GPencil Datablock ------------------------------------------- */
2710 /* get backdrop color for gpencil datablock widget */
2711 static void acf_gpd_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
2713 /* these are ID-blocks, but not exactly standalone... */
2714 UI_GetThemeColorShade3fv(TH_DOPESHEET_CHANNELSUBOB, 20, r_color);
2717 // TODO: just get this from RNA?
2718 static int acf_gpd_icon(bAnimListElem *UNUSED(ale))
2720 return ICON_GREASEPENCIL;
2723 /* check if some setting exists for this channel */
2724 static bool acf_gpd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
2727 /* only select and expand supported */
2728 case ACHANNEL_SETTING_SELECT:
2729 case ACHANNEL_SETTING_EXPAND:
2737 /* get the appropriate flag(s) for the setting when it is valid */
2738 static int acf_gpd_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2740 /* clear extra return data first */
2744 case ACHANNEL_SETTING_SELECT: /* selected */
2745 return AGRP_SELECTED;
2747 case ACHANNEL_SETTING_EXPAND: /* expanded */
2748 return GP_DATA_EXPAND;
2751 /* these shouldn't happen */
2756 /* get pointer to the setting */
2757 static void *acf_gpd_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
2759 bGPdata *gpd = (bGPdata *)ale->data;
2761 /* all flags are just in gpd->flag for now... */
2762 return GET_ACF_FLAG_PTR(gpd->flag, type);
2765 /* gpencil datablock type define */
2766 static bAnimChannelType ACF_GPD =
2768 "GPencil Datablock", /* type name */
2769 ACHANNEL_ROLE_EXPANDER, /* role */
2771 acf_gpd_color, /* backdrop color */
2772 acf_group_backdrop, /* backdrop */
2773 acf_generic_indention_0, /* indent level */
2774 acf_generic_group_offset, /* offset */
2776 acf_generic_idblock_name, /* name */
2777 acf_generic_idfill_name_prop, /* name prop */
2778 acf_gpd_icon, /* icon */
2780 acf_gpd_setting_valid, /* has setting */
2781 acf_gpd_setting_flag, /* flag for setting */
2782 acf_gpd_setting_ptr /* pointer for setting */
2785 /* GPencil Layer ------------------------------------------- */
2787 /* name for grease pencil layer entries */
2788 static void acf_gpl_name(bAnimListElem *ale, char *name)
2790 bGPDlayer *gpl = (bGPDlayer *)ale->data;
2793 BLI_strncpy(name, gpl->info, ANIM_CHAN_NAME_SIZE);
2796 /* name property for grease pencil layer entries */
2797 static bool acf_gpl_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
2800 RNA_pointer_create(ale->id, &RNA_GPencilLayer, ale->data, ptr);
2801 *prop = RNA_struct_name_property(ptr->type);
2803 return (*prop != NULL);
2809 /* check if some setting exists for this channel */
2810 static bool acf_gpl_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
2814 case ACHANNEL_SETTING_EXPAND: /* gpencil layers are more like F-Curves than groups */
2815 case ACHANNEL_SETTING_SOLO: /* nla editor only */
2818 /* always available */
2824 /* get the appropriate flag(s) for the setting when it is valid */
2825 static int acf_gpl_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2827 /* clear extra return data first */
2831 case ACHANNEL_SETTING_SELECT: /* selected */
2832 return GP_LAYER_SELECT;
2834 case ACHANNEL_SETTING_MUTE: /* animation muting - similar to frame lock... */
2835 return GP_LAYER_FRAMELOCK;
2837 case ACHANNEL_SETTING_VISIBLE: /* visiblity of the layers (NOT muting) */
2839 return GP_LAYER_HIDE;
2841 case ACHANNEL_SETTING_PROTECT: /* protected */
2842 return GP_LAYER_LOCKED;
2844 default: /* unsupported */
2849 /* get pointer to the setting */
2850 static void *acf_gpl_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
2852 bGPDlayer *gpl = (bGPDlayer *)ale->data;
2854 /* all flags are just in gpl->flag for now... */
2855 return GET_ACF_FLAG_PTR(gpl->flag, type);
2858 /* grease pencil layer type define */
2859 static bAnimChannelType ACF_GPL =
2861 "GPencil Layer", /* type name */
2862 ACHANNEL_ROLE_CHANNEL, /* role */
2864 acf_generic_channel_color, /* backdrop color */
2865 acf_generic_channel_backdrop, /* backdrop */
2866 acf_generic_indention_flexible, /* indent level */
2867 acf_generic_group_offset, /* offset */
2869 acf_gpl_name, /* name */
2870 acf_gpl_name_prop, /* name prop */
2873 acf_gpl_setting_valid, /* has setting */
2874 acf_gpl_setting_flag, /* flag for setting */
2875 acf_gpl_setting_ptr /* pointer for setting */
2879 /* Mask Datablock ------------------------------------------- */
2881 /* get backdrop color for mask datablock widget */
2882 static void acf_mask_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
2884 /* these are ID-blocks, but not exactly standalone... */
2885 UI_GetThemeColorShade3fv(TH_DOPESHEET_CHANNELSUBOB, 20, r_color);
2888 // TODO: just get this from RNA?
2889 static int acf_mask_icon(bAnimListElem *UNUSED(ale))
2891 return ICON_MOD_MASK;
2894 /* check if some setting exists for this channel */
2895 static bool acf_mask_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
2898 /* only select and expand supported */
2899 case ACHANNEL_SETTING_SELECT:
2900 case ACHANNEL_SETTING_EXPAND:
2908 /* get the appropriate flag(s) for the setting when it is valid */
2909 static int acf_mask_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2911 /* clear extra return data first */
2915 case ACHANNEL_SETTING_SELECT: /* selected */
2916 return AGRP_SELECTED;
2918 case ACHANNEL_SETTING_EXPAND: /* expanded */
2919 return MASK_ANIMF_EXPAND;
2922 /* this shouldn't happen */
2927 /* get pointer to the setting */
2928 static void *acf_mask_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
2930 Mask *mask = (Mask *)ale->data;
2932 /* all flags are just in mask->flag for now... */
2933 return GET_ACF_FLAG_PTR(mask->flag, type);
2936 /* mask datablock type define */
2937 static bAnimChannelType ACF_MASKDATA =
2939 "Mask Datablock", /* type name */
2940 ACHANNEL_ROLE_EXPANDER, /* role */
2942 acf_mask_color, /* backdrop color */
2943 acf_group_backdrop, /* backdrop */
2944 acf_generic_indention_0, /* indent level */
2945 acf_generic_group_offset, /* offset */
2947 acf_generic_idblock_name, /* name */
2948 acf_generic_idfill_name_prop, /* name prop */
2949 acf_mask_icon, /* icon */
2951 acf_mask_setting_valid, /* has setting */
2952 acf_mask_setting_flag, /* flag for setting */
2953 acf_mask_setting_ptr /* pointer for setting */
2956 /* Mask Layer ------------------------------------------- */
2958 /* name for grease pencil layer entries */
2959 static void acf_masklay_name(bAnimListElem *ale, char *name)
2961 MaskLayer *masklay = (MaskLayer *)ale->data;
2963 if (masklay && name)
2964 BLI_strncpy(name, masklay->name, ANIM_CHAN_NAME_SIZE);
2967 /* name property for grease pencil layer entries */
2968 static bool acf_masklay_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
2971 RNA_pointer_create(ale->id, &RNA_MaskLayer, ale->data, ptr);
2972 *prop = RNA_struct_name_property(ptr->type);
2974 return (*prop != NULL);
2980 /* check if some setting exists for this channel */
2981 static bool acf_masklay_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
2985 case ACHANNEL_SETTING_EXPAND: /* mask layers are more like F-Curves than groups */
2986 case ACHANNEL_SETTING_VISIBLE: /* graph editor only */
2987 case ACHANNEL_SETTING_SOLO: /* nla editor only */
2990 /* always available */
2996 /* get the appropriate flag(s) for the setting when it is valid */
2997 static int acf_masklay_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2999 /* clear extra return data first */
3003 case ACHANNEL_SETTING_SELECT: /* selected */
3004 return MASK_LAYERFLAG_SELECT;
3006 case ACHANNEL_SETTING_PROTECT: /* protected */
3007 return MASK_LAYERFLAG_LOCKED;
3009 default: /* unsupported */
3014 /* get pointer to the setting */
3015 static void *acf_masklay_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
3017 MaskLayer *masklay = (MaskLayer *)ale->data;
3019 /* all flags are just in masklay->flag for now... */
3020 return GET_ACF_FLAG_PTR(masklay->flag, type);
3023 /* grease pencil layer type define */
3024 static bAnimChannelType ACF_MASKLAYER =
3026 "Mask Layer", /* type name */
3027 ACHANNEL_ROLE_CHANNEL, /* role */
3029 acf_generic_channel_color, /* backdrop color */
3030 acf_generic_channel_backdrop, /* backdrop */
3031 acf_generic_indention_flexible, /* indent level */
3032 acf_generic_group_offset, /* offset */
3034 acf_masklay_name, /* name */
3035 acf_masklay_name_prop, /* name prop */
3038 acf_masklay_setting_valid, /* has setting */
3039 acf_masklay_setting_flag, /* flag for setting */
3040 acf_masklay_setting_ptr /* pointer for setting */
3043 /* NLA Track ----------------------------------------------- */
3045 /* get backdrop color for nla track channels */
3046 static void acf_nlatrack_color(bAnimContext *UNUSED(ac), bAnimListElem *ale, float r_color[3])
3048 NlaTrack *nlt = (NlaTrack *)ale->data;
3049 AnimData *adt = ale->adt;
3050 bool nonSolo = false;
3052 /* is track enabled for solo drawing? */
3053 if ((adt) && (adt->flag & ADT_NLA_SOLO_TRACK)) {
3054 if ((nlt->flag & NLATRACK_SOLO) == 0) {
3055 /* tag for special non-solo handling */
3060 /* set color for nla track */
3061 UI_GetThemeColorShade3fv(TH_HEADER, ((nonSolo == false) ? 20 : -20), r_color);
3064 /* name for nla track entries */
3065 static void acf_nlatrack_name(bAnimListElem *ale, char *name)
3067 NlaTrack *nlt = (NlaTrack *)ale->data;
3070 BLI_strncpy(name, nlt->name, ANIM_CHAN_NAME_SIZE);
3073 /* name property for nla track entries */
3074 static bool acf_nlatrack_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
3077 RNA_pointer_create(ale->id, &RNA_NlaTrack, ale->data, ptr);
3078 *prop = RNA_struct_name_property(ptr->type);
3080 return (*prop != NULL);
3086 /* check if some setting exists for this channel */
3087 static bool acf_nlatrack_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *ale, eAnimChannel_Settings setting)
3089 NlaTrack *nlt = (NlaTrack *)ale->data;
3090 AnimData *adt = ale->adt;
3092 /* visibility of settings depends on various states... */
3094 /* always supported */
3095 case ACHANNEL_SETTING_SELECT:
3096 case ACHANNEL_SETTING_SOLO:
3099 /* conditionally supported... */
3100 case ACHANNEL_SETTING_PROTECT:
3101 case ACHANNEL_SETTING_MUTE:
3102 /* if this track is active and we're tweaking it, don't draw these toggles */
3103 if (((nlt->flag & NLATRACK_ACTIVE) && (nlt->flag & NLATRACK_DISABLED)) == 0) {
3104 /* is track enabled for solo drawing? */
3105 if ((adt) && (adt->flag & ADT_NLA_SOLO_TRACK)) {
3106 if (nlt->flag & NLATRACK_SOLO) {
3107 /* ok - we've got a solo track, and this is it */
3111 /* not ok - we've got a solo track, but this isn't it, so make it more obvious */
3117 /* ok - no tracks are solo'd, and this isn't being tweaked */
3121 /* unsupported - this track is being tweaked */
3131 /* get the appropriate flag(s) for the setting when it is valid */
3132 static int acf_nlatrack_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
3134 /* clear extra return data first */
3138 case ACHANNEL_SETTING_SELECT: /* selected */