Blender V5.0
anim_channels_defines.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2009 Blender Authors, Joshua Leung. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include <cstdio>
10
11#include "ANIM_action.hh"
12#include "ANIM_animdata.hh"
13#include "ANIM_keyframing.hh"
14
15#include "MEM_guardedalloc.h"
16
17#include "BLI_listbase.h"
18#include "BLI_math_color.h"
19#include "BLI_math_vector.h"
20#include "BLI_string.h"
21#include "BLI_string_utf8.h"
22#include "BLI_utildefines.h"
23
24#include "BLT_translation.hh"
25
26#include "DNA_anim_types.h"
27#include "DNA_armature_types.h"
28#include "DNA_cachefile_types.h"
29#include "DNA_camera_types.h"
30#include "DNA_curves_types.h"
33#include "DNA_key_types.h"
34#include "DNA_lattice_types.h"
35#include "DNA_light_types.h"
37#include "DNA_linestyle_types.h"
38#include "DNA_mask_types.h"
39#include "DNA_material_types.h"
40#include "DNA_mesh_types.h"
41#include "DNA_meta_types.h"
42#include "DNA_node_types.h"
43#include "DNA_object_types.h"
44#include "DNA_particle_types.h"
46#include "DNA_scene_types.h"
47#include "DNA_screen_types.h"
48#include "DNA_space_types.h"
49#include "DNA_speaker_types.h"
50#include "DNA_userdef_types.h"
51#include "DNA_volume_types.h"
52#include "DNA_world_types.h"
53
54#include "RNA_access.hh"
55#include "RNA_path.hh"
56#include "RNA_prototypes.hh"
57
58#include "BKE_anim_data.hh"
59#include "BKE_animsys.h"
60#include "BKE_context.hh"
61#include "BKE_curve.hh"
62#include "BKE_grease_pencil.hh"
63#include "BKE_key.hh"
64#include "BKE_lib_id.hh"
65#include "BKE_nla.hh"
66
67#include "GPU_immediate.hh"
68#include "GPU_state.hh"
69
70#include "DEG_depsgraph.hh"
72
73#include "UI_interface.hh"
74#include "UI_interface_icons.hh"
75#include "UI_resources.hh"
76#include "UI_view2d.hh"
77
78#include "ED_anim_api.hh"
79
80#include "ANIM_fcurve.hh"
81
82#include "WM_api.hh"
83#include "WM_types.hh"
84
85#include "anim_intern.hh"
86
87using namespace blender;
88
89/* *********************************************** */
90/* XXX constant defines to be moved elsewhere? */
91
92/* extra padding for lengths (to go under scrollers) */
93#define EXTRA_SCROLL_PAD 100.0f
94
95/* size of indent steps */
96#define INDENT_STEP_SIZE (0.35f * U.widget_unit)
97
98/* get the pointer used for some flag */
99#define GET_ACF_FLAG_PTR(ptr, type) ((*(type) = sizeof(ptr)), &(ptr))
100
101/* *********************************************** */
102/* Generic Functions (Type independent) */
103
104/* Draw Backdrop ---------------------------------- */
105
106/* get backdrop color for top-level widgets (Scene, Object and ActionSlot only) */
108 bAnimListElem * /*ale*/,
109 float r_color[3])
110{
111 /* darker blue for top-level widgets */
113}
114
115/* backdrop for top-level widgets (Scene and Object only) */
117 bAnimListElem *ale,
118 float yminc,
119 float ymaxc)
120{
122 View2D *v2d = &ac->region->v2d;
123 short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
124 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
125 float color[3];
126
127 /* set backdrop drawing color */
128 acf->get_backdrop_color(ac, ale, color);
129
130 /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
133
134 rctf box;
135 box.xmin = offset;
136 box.xmax = v2d->cur.xmax + EXTRA_SCROLL_PAD;
137 box.ymin = yminc;
138 box.ymax = ymaxc;
139 UI_draw_roundbox_3fv_alpha(&box, true, 8, color, 1.0f);
140}
141
142/* get backdrop color for data expanders under top-level Scene/Object */
144 bAnimListElem * /*ale*/,
145 float r_color[3])
146{
147 /* lighter color than top-level widget */
149}
150
151/* backdrop for data expanders under top-level Scene/Object */
153 bAnimListElem *ale,
154 float yminc,
155 float ymaxc)
156{
158 View2D *v2d = &ac->region->v2d;
159 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
160 float color[3];
161
163 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
164
165 /* set backdrop drawing color */
166 acf->get_backdrop_color(ac, ale, color);
167
170
171 /* no rounded corner - just rectangular box */
172 immRectf(pos, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
173
175}
176
177/* helper method to test if group colors should be drawn */
179{
180 return (U.animation_flag & USER_ANIM_SHOW_CHANNEL_GROUP_COLORS) != 0;
181}
182
183/* get backdrop color for generic channels */
184static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
185{
187 short indent = (acf->get_indent_level) ? acf->get_indent_level(ac, ale) : 0;
188
189 /* FIXME: what happens when the indentation is 1 greater than what it should be
190 * (due to grouping)? */
191 const int colorOffset = 10 - 10 * indent;
192 UI_GetThemeColorShade3fv(TH_CHANNEL, colorOffset, r_color);
193}
194
195/* backdrop for generic channels */
197 bAnimListElem *ale,
198 float yminc,
199 float ymaxc)
200{
202 View2D *v2d = &ac->region->v2d;
203 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
204 float color[3];
205
207 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
208
209 /* set backdrop drawing color */
210 acf->get_backdrop_color(ac, ale, color);
211
214
215 /* no rounded corners - just rectangular box */
216 immRectf(pos, offset, yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
217
219}
220
221/* Indentation + Offset ------------------------------------------- */
222
223/* indentation level is always the value in the name */
224static short acf_generic_indentation_0(bAnimContext * /*ac*/, bAnimListElem * /*ale*/)
225{
226 return 0;
227}
228static short acf_generic_indentation_1(bAnimContext * /*ac*/, bAnimListElem * /*ale*/)
229{
230 return 1;
231}
232#if 0 /* XXX not used */
233static short acf_generic_indentation_2(bAnimContext *ac, bAnimListElem *ale)
234{
235 return 2;
236}
237#endif
238
239/* indentation which varies with the grouping status */
241{
242 if (ale->type != ANIMTYPE_FCURVE) {
243 return 0;
244 }
245
246 /* Grouped F-Curves need extra level of indentation. */
247 const FCurve *fcu = static_cast<const FCurve *>(ale->data);
248 if (fcu->grp) {
249 return 1;
250 }
251
252 return 0;
253}
254
255/* basic offset for channels derived from indentation */
257{
259
260 if (acf && acf->get_indent_level) {
261 return acf->get_indent_level(ac, ale) * INDENT_STEP_SIZE;
262 }
263 return 0;
264}
265
266/* offset based on nodetree type */
268{
269 if (ntree) {
270 switch (ntree->type) {
271 case NTREE_SHADER:
272 /* 1 additional level (i.e. is indented one level in from material,
273 * so shift all right by one step)
274 */
275 return INDENT_STEP_SIZE;
276
277 case NTREE_COMPOSIT:
278 /* no additional levels needed */
279 return 0;
280
281 case NTREE_TEXTURE:
282 /* 2 additional levels */
283 return INDENT_STEP_SIZE * 2;
284 }
285 }
286
287 /* unknown */
288 return 0;
289}
290
291/* offset for groups + grouped entities */
293{
294 short offset = acf_generic_basic_offset(ac, ale);
295
296 if (ale->id) {
297
298 /* Action Editor. */
299 if (ac->datatype == ANIMCONT_ACTION) {
300 /* For Action Editor mode, we have a limited set of channel types we need
301 * to account for, so we can handle them very simply here in one place. */
302 switch (ale->type) {
303 case ANIMTYPE_FCURVE:
304 case ANIMTYPE_GROUP: {
305 const bAction *action = reinterpret_cast<bAction *>(ale->fcurve_owner_id);
306 if (action->wrap().is_action_layered()) {
307 offset += short(0.35f * U.widget_unit);
308 }
309 break;
310 }
311
312 case ANIMTYPE_SUMMARY:
314 break;
315
316 /* There should be no types except the above in Action Editor mode. */
317 default:
319 break;
320 }
321
322 return offset;
323 }
324
325 /* Other editors. */
326
327 /* texture animdata */
328 if (GS(ale->id->name) == ID_TE) {
329 offset += U.widget_unit;
330 }
331 /* materials and particles animdata */
332 else if (ELEM(GS(ale->id->name), ID_MA, ID_PA)) {
333 offset += short(0.7f * U.widget_unit);
334 }
335 /* If not in Action Editor mode, action-groups (and their children)
336 * must carry some offset too. */
337 else {
338 offset += short(0.7f * U.widget_unit);
339 }
340
341 /* nodetree animdata */
342 if (GS(ale->id->name) == ID_NT) {
343 offset += acf_nodetree_rootType_offset(reinterpret_cast<bNodeTree *>(ale->id));
344 }
345 }
346
347 /* offset is just the normal type - i.e. based on indentation */
348 return offset;
349}
350
351/* Name ------------------------------------------- */
352
353/* name for ID block entries */
355{
356 ID *id = static_cast<ID *>(ale->data); /* data pointed to should be an ID block */
357
358 /* just copy the name... */
359 if (id && name) {
361 }
362}
363
364/* name property for ID block entries */
366 PointerRNA *r_ptr,
367 PropertyRNA **r_prop)
368{
369 *r_ptr = RNA_id_pointer_create(static_cast<ID *>(ale->data));
370 *r_prop = RNA_struct_name_property(r_ptr->type);
371
372 return (*r_prop != nullptr);
373}
374
375/* name property for ID block entries which are just subheading "fillers" */
377 PointerRNA *r_ptr,
378 PropertyRNA **r_prop)
379{
380 /* actual ID we're representing is stored in ale->data not ale->id, as id gives the owner */
381 *r_ptr = RNA_id_pointer_create(static_cast<ID *>(ale->data));
382 *r_prop = RNA_struct_name_property(r_ptr->type);
383
384 return (*r_prop != nullptr);
385}
386
387/* Settings ------------------------------------------- */
388
389/* check if some setting exists for this object-based data-expander (datablock only) */
391 bAnimListElem * /*ale*/,
392 eAnimChannel_Settings setting)
393{
394 switch (setting) {
395 /* expand is always supported */
397 return true;
398
399 /* mute is only supported for NLA */
401 return ((ac) && (ac->spacetype == SPACE_NLA));
402
403 /* Select is ok for most `ds*` channels (e.g. `dsmat`) */
405 return true;
406
408 return true;
409
410 /* other flags are never supported */
411 default:
412 return false;
413 }
414}
415
416/* *********************************************** */
417/* Type Specific Functions + Defines */
418
419/* Animation Summary ----------------------------------- */
420
421/* get backdrop color for summary widget */
422static void acf_summary_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
423{
424 /* Only draw the summary line backdrop when it is expanded. If the entire dope sheet is
425 * just one line, there is no need for any distinction between lines, and the red-ish
426 * color is only going to be a distraction. */
427 const bool is_expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND);
428 UI_GetThemeColor3fv(is_expanded ? TH_ANIM_ACTIVE : TH_HEADER, r_color);
429}
430
431/* backdrop for summary widget */
432static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
433{
435 View2D *v2d = &ac->region->v2d;
436 float color[3];
437
438 /* set backdrop drawing color */
439 acf->get_backdrop_color(ac, ale, color);
440
441 /* rounded corners on LHS only
442 * - top and bottom
443 * - special hack: make the top a bit higher, since we are first...
444 */
446
447 rctf box;
448 box.xmin = 0;
449 box.xmax = v2d->cur.xmax + EXTRA_SCROLL_PAD;
450 box.ymin = yminc - 2;
451 box.ymax = ymaxc;
452 UI_draw_roundbox_3fv_alpha(&box, true, 8, color, 1.0f);
453}
454
455/* name for summary entries */
456static void acf_summary_name(bAnimListElem * /*ale*/, char *name)
457{
458 if (name) {
460 }
461}
462
463/* check if some setting exists for this channel */
465 bAnimListElem * /*ale*/,
466 eAnimChannel_Settings setting)
467{
468 /* only expanded is supported, as it is used for hiding all stuff which the summary covers */
469 return (setting == ACHANNEL_SETTING_EXPAND);
470}
471
472/* Get the appropriate flag(s) for the setting when it is valid. */
474 eAnimChannel_Settings setting,
475 bool *r_neg)
476{
477 if (setting == ACHANNEL_SETTING_EXPAND) {
478 /* expanded */
479 *r_neg = true;
481 }
482
483 /* unsupported */
484 *r_neg = false;
485 return 0;
486}
487
488/* get pointer to the setting */
490 eAnimChannel_Settings setting,
491 short *r_type)
492{
493 bAnimContext *ac = static_cast<bAnimContext *>(ale->data);
494
495 /* If data is valid, return pointer to active dope-sheet's relevant flag
496 * - this is restricted to DopeSheet/Action Editor only. */
497 if ((ac->sl) && (ac->spacetype == SPACE_ACTION) && (setting == ACHANNEL_SETTING_EXPAND)) {
498 SpaceAction *saction = reinterpret_cast<SpaceAction *>(ac->sl);
499 bDopeSheet *ads = &saction->ads;
500
501 /* return pointer to DopeSheet's flag */
502 return GET_ACF_FLAG_PTR(ads->flag, r_type);
503 }
504
505 /* can't return anything useful - unsupported */
506 *r_type = 0;
507 return nullptr;
508}
509
512 /*channel_type_name*/ "Summary",
513 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
514
515 /*get_backdrop_color*/ acf_summary_color,
516 /*get_channel_color*/ nullptr,
517 /*draw_backdrop*/ acf_summary_backdrop,
518 /*get_indent_level*/ acf_generic_indentation_0,
519 /*get_offset*/ nullptr,
520
521 /*name*/ acf_summary_name,
522 /*name_prop*/ nullptr,
523 /*icon*/ nullptr,
524
525 /*has_setting*/ acf_summary_setting_valid,
526 /*setting_flag*/ acf_summary_setting_flag,
527 /*setting_ptr*/ acf_summary_setting_ptr,
528 /*setting_post_update*/ nullptr,
529};
530
531/* Scene ------------------------------------------- */
532
533/* TODO: just get this from RNA? */
534static int acf_scene_icon(bAnimListElem * /*ale*/)
535{
536 return ICON_SCENE_DATA;
537}
538
539/* check if some setting exists for this channel */
541 bAnimListElem * /*ale*/,
542 eAnimChannel_Settings setting)
543{
544 switch (setting) {
545 /* muted only in NLA */
547 return ((ac) && (ac->spacetype == SPACE_NLA));
548
549 /* visible only in Graph Editor */
551 return ((ac) && (ac->spacetype == SPACE_GRAPH));
552
553 /* only select and expand supported otherwise */
556 return true;
557
559 return false;
560
561 default:
562 return false;
563 }
564}
565
566/* Get the appropriate flag(s) for the setting when it is valid. */
568 eAnimChannel_Settings setting,
569 bool *r_neg)
570{
571 /* Clear extra return data first. */
572 *r_neg = false;
573
574 switch (setting) {
575 case ACHANNEL_SETTING_SELECT: /* selected */
576 return SCE_DS_SELECTED;
577
578 case ACHANNEL_SETTING_EXPAND: /* expanded */
579 *r_neg = true;
580 return SCE_DS_COLLAPSED;
581
582 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
583 return ADT_NLA_EVAL_OFF;
584
585 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
586 *r_neg = true;
588
589 default: /* unsupported */
590 return 0;
591 }
592}
593
594/* get pointer to the setting */
596 eAnimChannel_Settings setting,
597 short *r_type)
598{
599 Scene *scene = static_cast<Scene *>(ale->data);
600
601 /* Clear extra return data first. */
602 *r_type = 0;
603
604 switch (setting) {
605 case ACHANNEL_SETTING_SELECT: /* selected */
606 return GET_ACF_FLAG_PTR(scene->flag, r_type);
607
608 case ACHANNEL_SETTING_EXPAND: /* expanded */
609 return GET_ACF_FLAG_PTR(scene->flag, r_type);
610
611 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
612 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
613 if (scene->adt) {
614 return GET_ACF_FLAG_PTR(scene->adt->flag, r_type);
615 }
616 return nullptr;
617
618 default: /* unsupported */
619 return nullptr;
620 }
621}
622
625 /*channel_type_name*/ "Scene",
626 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
627
628 /*get_backdrop_color*/ acf_generic_root_color,
629 /*get_channel_color*/ nullptr,
630 /*draw_backdrop*/ acf_generic_root_backdrop,
631 /*get_indent_level*/ acf_generic_indentation_0,
632 /*get_offset*/ nullptr,
633
635 /*name_prop*/ acf_generic_idblock_name_prop,
636 /*icon*/ acf_scene_icon,
637
638 /*has_setting*/ acf_scene_setting_valid,
639 /*setting_flag*/ acf_scene_setting_flag,
640 /*setting_ptr*/ acf_scene_setting_ptr,
641 /*setting_post_update*/ nullptr,
642};
643
644/* Object ------------------------------------------- */
645
647{
648 Base *base = static_cast<Base *>(ale->data);
649 Object *ob = base->object;
650
651 /* icon depends on object-type */
652 switch (ob->type) {
653 case OB_LAMP:
654 return ICON_OUTLINER_OB_LIGHT;
655 case OB_MESH:
656 return ICON_OUTLINER_OB_MESH;
657 case OB_CAMERA:
658 return ICON_OUTLINER_OB_CAMERA;
659 case OB_CURVES_LEGACY:
660 return ICON_OUTLINER_OB_CURVE;
661 case OB_MBALL:
662 return ICON_OUTLINER_OB_META;
663 case OB_LATTICE:
664 return ICON_OUTLINER_OB_LATTICE;
665 case OB_SPEAKER:
666 return ICON_OUTLINER_OB_SPEAKER;
667 case OB_LIGHTPROBE:
668 return ICON_OUTLINER_OB_LIGHTPROBE;
669 case OB_ARMATURE:
670 return ICON_OUTLINER_OB_ARMATURE;
671 case OB_FONT:
672 return ICON_OUTLINER_OB_FONT;
673 case OB_SURF:
674 return ICON_OUTLINER_OB_SURFACE;
675 case OB_CURVES:
676 return ICON_OUTLINER_OB_CURVES;
677 case OB_POINTCLOUD:
678 return ICON_OUTLINER_OB_POINTCLOUD;
679 case OB_VOLUME:
680 return ICON_OUTLINER_OB_VOLUME;
681 case OB_EMPTY:
682 return ICON_OUTLINER_OB_EMPTY;
683 case OB_GREASE_PENCIL:
684 return ICON_OUTLINER_OB_GREASEPENCIL;
685 default:
686 return ICON_OBJECT_DATA;
687 }
688}
689
690/* name for object */
691static void acf_object_name(bAnimListElem *ale, char *name)
692{
693 Base *base = static_cast<Base *>(ale->data);
694 Object *ob = base->object;
695
696 /* just copy the name... */
697 if (ob && name) {
699 }
700}
701
702/* name property for object */
703static bool acf_object_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
704{
705 *r_ptr = RNA_id_pointer_create(ale->id);
706 *r_prop = RNA_struct_name_property(r_ptr->type);
707
708 return (*r_prop != nullptr);
709}
710
711/* check if some setting exists for this channel */
713 bAnimListElem *ale,
714 eAnimChannel_Settings setting)
715{
716 Base *base = static_cast<Base *>(ale->data);
717 Object *ob = base->object;
718
719 switch (setting) {
720 /* muted only in NLA */
722 return ((ac) && (ac->spacetype == SPACE_NLA));
723
724 /* visible only in Graph Editor */
726 return ((ac) && (ac->spacetype == SPACE_GRAPH) && (ob->adt));
727
728 /* only select and expand supported otherwise */
731 return true;
732
734 return ((ac) && (ac->spacetype == SPACE_GRAPH) && (ob->adt));
735
736 default:
737 return false;
738 }
739}
740
741/* Get the appropriate flag(s) for the setting when it is valid. */
743 eAnimChannel_Settings setting,
744 bool *r_neg)
745{
746 /* Clear extra return data first. */
747 *r_neg = false;
748
749 switch (setting) {
750 case ACHANNEL_SETTING_SELECT: /* selected */
751 return BASE_SELECTED;
752
753 case ACHANNEL_SETTING_EXPAND: /* expanded */
754 *r_neg = true;
755 return OB_ADS_COLLAPSED;
756
757 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
758 return ADT_NLA_EVAL_OFF;
759
760 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
761 *r_neg = true;
763
764 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
766
767 default: /* unsupported */
768 return 0;
769 }
770}
771
772/* get pointer to the setting */
774 eAnimChannel_Settings setting,
775 short *r_type)
776{
777 Base *base = static_cast<Base *>(ale->data);
778 Object *ob = base->object;
779
780 /* Clear extra return data first. */
781 *r_type = 0;
782
783 switch (setting) {
784 case ACHANNEL_SETTING_SELECT: /* selected */
785 return GET_ACF_FLAG_PTR(base->flag, r_type);
786
787 case ACHANNEL_SETTING_EXPAND: /* expanded */
788 return GET_ACF_FLAG_PTR(ob->nlaflag, r_type); /* XXX */
789
790 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
791 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
792 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
793 if (ob->adt) {
794 return GET_ACF_FLAG_PTR(ob->adt->flag, r_type);
795 }
796 return nullptr;
797
798 default: /* unsupported */
799 return nullptr;
800 }
801}
802
805 /*channel_type_name*/ "Object",
806 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
807
808 /*get_backdrop_color*/ acf_generic_root_color,
809 /*get_channel_color*/ nullptr,
810 /*draw_backdrop*/ acf_generic_root_backdrop,
811 /*get_indent_level*/ acf_generic_indentation_0,
812 /*get_offset*/ nullptr,
813
814 /*name*/ acf_object_name,
815 /*name_prop*/ acf_object_name_prop,
816 /*icon*/ acf_object_icon,
817
818 /*has_setting*/ acf_object_setting_valid,
819 /*setting_flag*/ acf_object_setting_flag,
820 /*setting_ptr*/ acf_object_setting_ptr,
821 /*setting_post_update*/ nullptr,
822};
823
824/* Group ------------------------------------------- */
825
826/* get backdrop color for group widget */
827static void acf_group_color(bAnimContext * /*ac*/, bAnimListElem *ale, float r_color[3])
828{
829 if (ale->flag & AGRP_ACTIVE) {
831 }
832 else {
834 }
835}
836
837/* backdrop for group widget */
838static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
839{
841 View2D *v2d = &ac->region->v2d;
842 short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
843 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
844 float color[3];
845
846 /* set backdrop drawing color */
847 acf->get_backdrop_color(ac, ale, color);
848
849 /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
851
852 rctf box;
853 box.xmin = offset;
854 box.xmax = v2d->cur.xmax + EXTRA_SCROLL_PAD;
855 box.ymin = yminc;
856 box.ymax = ymaxc;
857 UI_draw_roundbox_3fv_alpha(&box, true, 8, color, 1.0f);
858}
859
860/* name for group entries */
861static void acf_group_name(bAnimListElem *ale, char *name)
862{
863 bActionGroup *agrp = static_cast<bActionGroup *>(ale->data);
864
865 /* just copy the name... */
866 if (agrp && name) {
868 }
869}
870
871/* name property for group entries */
872static bool acf_group_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
873{
874 *r_ptr = RNA_pointer_create_discrete(ale->fcurve_owner_id, &RNA_ActionGroup, ale->data);
875 *r_prop = RNA_struct_name_property(r_ptr->type);
876
877 return (*r_prop != nullptr);
878}
879
880/* check if some setting exists for this channel */
882 bAnimListElem * /*ale*/,
883 eAnimChannel_Settings setting)
884{
885 /* for now, all settings are supported, though some are only conditionally */
886 switch (setting) {
887 /* unsupported */
888 case ACHANNEL_SETTING_SOLO: /* Only available in NLA Editor for tracks */
889 case ACHANNEL_SETTING_PINNED: /* Only for NLA actions */
890 return false;
891
892 /* conditionally supported */
893 case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
894 return (ac->spacetype == SPACE_GRAPH);
895
896 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
898
899 default: /* always supported */
900 return true;
901 }
902}
903
904/* Get the appropriate flag(s) for the setting when it is valid. */
905static int acf_group_setting_flag(bAnimContext *ac, eAnimChannel_Settings setting, bool *r_neg)
906{
907 /* Clear extra return data first. */
908 *r_neg = false;
909
910 switch (setting) {
911 case ACHANNEL_SETTING_SELECT: /* selected */
912 return AGRP_SELECTED;
913
914 case ACHANNEL_SETTING_EXPAND: /* expanded */
915 {
916 /* NOTE: Graph Editor uses a different flag to everywhere else for this,
917 * allowing different collapsing of groups there, since sharing the flag
918 * proved to be a hazard for workflows...
919 */
920 return (ac->spacetype == SPACE_GRAPH) ? AGRP_EXPANDED_G : /* Graph Editor case */
921 AGRP_EXPANDED; /* DopeSheet and elsewhere */
922 }
923
924 case ACHANNEL_SETTING_MUTE: /* muted */
925 return AGRP_MUTED;
926
927 case ACHANNEL_SETTING_MOD_OFF: /* muted */
928 *r_neg = true;
929 return AGRP_MODIFIERS_OFF;
930
931 case ACHANNEL_SETTING_PROTECT: /* protected */
932 return AGRP_PROTECTED;
933
934 case ACHANNEL_SETTING_VISIBLE: /* visibility - graph editor */
935 *r_neg = true;
936 return AGRP_NOTVISIBLE;
937
938 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
940
941 default:
942 /* this shouldn't happen */
943 return 0;
944 }
945}
946
947/* get pointer to the setting */
949 eAnimChannel_Settings /*setting*/,
950 short *r_type)
951{
952 bActionGroup *agrp = static_cast<bActionGroup *>(ale->data);
953
954 /* all flags are just in agrp->flag for now... */
955 return GET_ACF_FLAG_PTR(agrp->flag, r_type);
956}
957
958static bool get_actiongroup_color(const bActionGroup *agrp, uint8_t r_color[3])
959{
960 if (!agrp) {
961 return false;
962 }
963
964 const int8_t color_index = agrp->customCol;
965 if (color_index == 0) {
966 return false;
967 }
968
969 const ThemeWireColor *wire_color;
970 if (color_index < 0) {
971 wire_color = &agrp->cs;
972 }
973 else {
974 const bTheme *btheme = UI_GetTheme();
975 wire_color = &btheme->tarm[(color_index - 1)];
976 }
977
978 r_color[0] = wire_color->solid[0];
979 r_color[1] = wire_color->solid[1];
980 r_color[2] = wire_color->solid[2];
981 return true;
982}
983
984static bool acf_group_channel_color(const bAnimListElem *ale, uint8_t r_color[3])
985{
986 const bActionGroup *agrp = static_cast<const bActionGroup *>(ale->data);
987 return get_actiongroup_color(agrp, r_color);
988}
989
992 /*channel_type_name*/ "Group",
993 /*channel_role*/ ACHANNEL_ROLE_CHANNEL,
994
995 /*get_backdrop_color*/ acf_group_color,
996 /*get_channel_color*/ acf_group_channel_color,
997 /*draw_backdrop*/ acf_group_backdrop,
998 /*get_indent_level*/ acf_generic_indentation_0,
999 /*get_offset*/ acf_generic_group_offset,
1000
1001 /*name*/ acf_group_name,
1002 /*name_prop*/ acf_group_name_prop,
1003 /*icon*/ nullptr,
1004
1005 /*has_setting*/ acf_group_setting_valid,
1006 /*setting_flag*/ acf_group_setting_flag,
1007 /*setting_ptr*/ acf_group_setting_ptr,
1008 /*setting_post_update*/ nullptr,
1009};
1010
1011/* F-Curve ------------------------------------------- */
1012
1013/* name for fcurve entries */
1014static void acf_fcurve_name(bAnimListElem *ale, char *name)
1015{
1016 using namespace blender::animrig;
1017
1018 FCurve *fcurve = static_cast<FCurve *>(ale->data);
1019
1020 /* Clear the error flag. It'll be set again when an error situation is detected. */
1021 fcurve->flag &= ~FCURVE_DISABLED;
1022
1023 if (ale->fcurve_owner_id && GS(ale->fcurve_owner_id->name) == ID_AC &&
1025 {
1026 /* F-Curve comes from a layered Action. This means that we cannot trust `ale->id` or
1027 * `ale->adt`, because in the Action Editor those are set to whatever object has this Action
1028 * assigned. This F-Curve may be for a different slot, though, and thus might be animating a
1029 * entirely different ID type. */
1030 const Action &action = reinterpret_cast<bAction *>(ale->fcurve_owner_id)->wrap();
1031 const Slot *slot = action.slot_for_handle(ale->slot_handle);
1032 if (!slot) {
1033 /* Defer to the default F-Curve resolution, but without the animated ID
1034 * pointer, as it's likely to be wrong anyway. */
1035 getname_anim_fcurve(name, nullptr, fcurve);
1036 return;
1037 }
1038
1039 /* If the animated ID this ALE is for is a user of the slot, try to resolve the path on that.
1040 * If this fails, mark the F-Curve as problematic. This code is here so that
1041 * getname_anim_fcurve_for_slot() can do its best to find a label of the animated property,
1042 * independently of the "error line" shown in the dope sheet, at the cost of one extra call to
1043 * RNA_path_resolve_property(). See #129490. */
1044 if (slot->users(*ale->bmain).contains(ale->id)) {
1045 PointerRNA id_ptr = RNA_id_pointer_create(ale->id);
1047 PropertyRNA *prop;
1048 if (!RNA_path_resolve_property(&id_ptr, fcurve->rna_path, &ptr, &prop)) {
1049 fcurve->flag |= FCURVE_DISABLED;
1050 }
1051 }
1052
1053 BLI_assert(ale->bmain);
1054 const std::string fcurve_name = getname_anim_fcurve_for_slot(*ale->bmain, *slot, *fcurve);
1055 const size_t num_chars_copied = fcurve_name.copy(name, std::string::npos);
1056 name[num_chars_copied] = '\0';
1057
1058 return;
1059 }
1060
1061 getname_anim_fcurve(name, ale->id, fcurve);
1062}
1063
1064/* "name" property for fcurve entries */
1066{
1067 FCurve *fcu = static_cast<FCurve *>(ale->data);
1068
1069 /* Ctrl-Click Usability Convenience Hack:
1070 * For disabled F-Curves, allow access to the RNA Path
1071 * as our "name" so that user can perform quick fixes
1072 */
1073 if (fcu->flag & FCURVE_DISABLED) {
1074 *r_ptr = RNA_pointer_create_discrete(ale->fcurve_owner_id, &RNA_FCurve, ale->data);
1075 *r_prop = RNA_struct_find_property(r_ptr, "data_path");
1076 }
1077 else {
1078 /* for "normal" F-Curves - no editable name, but *prop may not be set properly yet... */
1079 *r_prop = nullptr;
1080 }
1081
1082 return (*r_prop != nullptr);
1083}
1084
1085/* check if some setting exists for this channel */
1087 bAnimListElem * /*ale*/,
1088 eAnimChannel_Settings setting)
1089{
1090 switch (setting) {
1091 /* unsupported */
1092 case ACHANNEL_SETTING_SOLO: /* Solo Flag is only for NLA */
1093 case ACHANNEL_SETTING_EXPAND: /* F-Curves are not containers */
1094 case ACHANNEL_SETTING_PINNED: /* This is only for NLA Actions */
1095 return false;
1096
1097 case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
1098 return (ac->spacetype == SPACE_GRAPH);
1099
1101 return false;
1102
1103 /* always available */
1104 default:
1105 return true;
1106 }
1107}
1108
1109/* Get the appropriate flag(s) for the setting when it is valid. */
1111 eAnimChannel_Settings setting,
1112 bool *r_neg)
1113{
1114 /* Clear extra return data first. */
1115 *r_neg = false;
1116
1117 switch (setting) {
1118 case ACHANNEL_SETTING_SELECT: /* selected */
1119 return FCURVE_SELECTED;
1120
1121 case ACHANNEL_SETTING_MUTE: /* muted */
1122 return FCURVE_MUTED;
1123
1124 case ACHANNEL_SETTING_PROTECT: /* protected */
1125 return FCURVE_PROTECTED;
1126
1127 case ACHANNEL_SETTING_VISIBLE: /* visibility - graph editor */
1128 return FCURVE_VISIBLE;
1129
1131 *r_neg = true;
1132 return FCURVE_MOD_OFF;
1133
1134 default: /* unsupported */
1135 return 0;
1136 }
1137}
1138
1139/* get pointer to the setting */
1141 eAnimChannel_Settings /*setting*/,
1142 short *r_type)
1143{
1144 FCurve *fcu = static_cast<FCurve *>(ale->data);
1145
1146 /* all flags are just in agrp->flag for now... */
1147 return GET_ACF_FLAG_PTR(fcu->flag, r_type);
1148}
1149
1150static bool acf_fcurve_channel_color(const bAnimListElem *ale, uint8_t r_color[3])
1151{
1152 const FCurve *fcu = static_cast<const FCurve *>(ale->data);
1153 return get_actiongroup_color(fcu->grp, r_color);
1154}
1155
1158 /*channel_type_name*/ "F-Curve",
1159 /*channel_role*/ ACHANNEL_ROLE_CHANNEL,
1160
1161 /*get_backdrop_color*/ acf_generic_channel_color,
1162 /*get_channel_color*/ acf_fcurve_channel_color,
1163 /*draw_backdrop*/ acf_generic_channel_backdrop,
1164 /*get_indent_level*/ acf_generic_indentation_flexible,
1165 /* XXX rename this to f-curves only? */
1166 /*get_offset*/ acf_generic_group_offset,
1167
1168 /*name*/ acf_fcurve_name,
1169 /*name_prop*/ acf_fcurve_name_prop,
1170 /*icon*/ nullptr,
1171
1172 /*has_setting*/ acf_fcurve_setting_valid,
1173 /*setting_flag*/ acf_fcurve_setting_flag,
1174 /*setting_ptr*/ acf_fcurve_setting_ptr,
1175 /*setting_post_update*/ nullptr,
1176};
1177
1178/* NLA Control FCurves Expander ----------------------- */
1179
1180/* get backdrop color for nla controls widget */
1182 bAnimListElem * /*ale*/,
1183 float r_color[3])
1184{
1185 /* TODO: give this its own theme setting? */
1186 UI_GetThemeColorShade3fv(TH_GROUP, 55, r_color);
1187}
1188
1189/* backdrop for nla controls expander widget */
1191 bAnimListElem *ale,
1192 float yminc,
1193 float ymaxc)
1194{
1196 View2D *v2d = &ac->region->v2d;
1197 short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
1198 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
1199 float color[3];
1200
1201 /* set backdrop drawing color */
1202 acf->get_backdrop_color(ac, ale, color);
1203
1204 /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
1206
1207 rctf box;
1208 box.xmin = offset;
1209 box.xmax = v2d->cur.xmax + EXTRA_SCROLL_PAD;
1210 box.ymin = yminc;
1211 box.ymax = ymaxc;
1212 UI_draw_roundbox_3fv_alpha(&box, true, 5, color, 1.0f);
1213}
1214
1215/* name for nla controls expander entries */
1216static void acf_nla_controls_name(bAnimListElem * /*ale*/, char *name)
1217{
1218 BLI_strncpy_utf8(name, IFACE_("NLA Strip Controls"), ANIM_CHAN_NAME_SIZE);
1219}
1220
1221/* check if some setting exists for this track */
1223 bAnimListElem * /*ale*/,
1224 eAnimChannel_Settings setting)
1225{
1226 /* for now, all settings are supported, though some are only conditionally */
1227 switch (setting) {
1228 /* supported */
1230 return true;
1231
1232 /* TODO: selected? */
1233
1234 default: /* unsupported */
1235 return false;
1236 }
1237}
1238
1239/* Get the appropriate flag(s) for the setting when it is valid. */
1241 eAnimChannel_Settings setting,
1242 bool *r_neg)
1243{
1244 /* Clear extra return data first. */
1245 *r_neg = false;
1246
1247 switch (setting) {
1248 case ACHANNEL_SETTING_EXPAND: /* expanded */
1249 *r_neg = true;
1251
1252 default:
1253 /* this shouldn't happen */
1254 return 0;
1255 }
1256}
1257
1258/* get pointer to the setting */
1260 eAnimChannel_Settings /*setting*/,
1261 short *r_type)
1262{
1263 AnimData *adt = static_cast<AnimData *>(ale->data);
1264
1265 /* all flags are just in adt->flag for now... */
1266 return GET_ACF_FLAG_PTR(adt->flag, r_type);
1267}
1268
1270{
1271 return ICON_NLA;
1272}
1273
1276 /*channel_type_name*/ "NLA Controls Expander",
1277 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
1278
1279 /*get_backdrop_color*/ acf_nla_controls_color,
1280 /*get_channel_color*/ nullptr,
1281 /*draw_backdrop*/ acf_nla_controls_backdrop,
1282 /*get_indent_level*/ acf_generic_indentation_0,
1283 /*get_offset*/ acf_generic_group_offset,
1284
1285 /*name*/ acf_nla_controls_name,
1286 /*name_prop*/ nullptr,
1287 /*icon*/ acf_nla_controls_icon,
1288
1289 /*has_setting*/ acf_nla_controls_setting_valid,
1290 /*setting_flag*/ acf_nla_controls_setting_flag,
1291 /*setting_ptr*/ acf_nla_controls_setting_ptr,
1292 /*setting_post_update*/ nullptr,
1293};
1294
1295/* NLA Control F-Curve -------------------------------- */
1296
1297/* name for nla control fcurve entries */
1298static void acf_nla_curve_name(bAnimListElem *ale, char *name)
1299{
1300 NlaStrip *strip = static_cast<NlaStrip *>(ale->owner);
1301 FCurve *fcu = static_cast<FCurve *>(ale->data);
1302 PropertyRNA *prop;
1303
1304 /* try to get RNA property that this shortened path (relative to the strip) refers to */
1305 prop = RNA_struct_type_find_property(&RNA_NlaStrip, fcu->rna_path);
1306 if (prop) {
1307 /* "name" of this strip displays the UI identifier + the name of the NlaStrip */
1309 name, ANIM_CHAN_NAME_SIZE, "%s (%s)", RNA_property_ui_name(prop), strip->name);
1310 }
1311 else {
1312 /* unknown property... */
1314 }
1315}
1316
1319 /*channel_type_name*/ "NLA Control F-Curve",
1320 /*channel_role*/ ACHANNEL_ROLE_CHANNEL,
1321
1322 /*get_backdrop_color*/ acf_generic_channel_color,
1323 /*get_channel_color*/ nullptr,
1324 /*draw_backdrop*/ acf_generic_channel_backdrop,
1325 /*get_indent_level*/ acf_generic_indentation_1,
1326 /*get_offset*/ acf_generic_group_offset,
1327
1328 /*name*/ acf_nla_curve_name,
1329 /*name_prop*/ acf_fcurve_name_prop,
1330 /*icon*/ nullptr,
1331
1332 /*has_setting*/ acf_fcurve_setting_valid,
1333 /*setting_flag*/ acf_fcurve_setting_flag,
1334 /*setting_ptr*/ acf_fcurve_setting_ptr,
1335 /*setting_post_update*/ nullptr,
1336};
1337
1338/* Object Animation Expander ------------------------------------------- */
1339
1340/* TODO: just get this from RNA? */
1342{
1343 return ICON_ACTION;
1344}
1345
1346/* check if some setting exists for this channel */
1348 bAnimListElem * /*ale*/,
1349 eAnimChannel_Settings setting)
1350{
1351 switch (setting) {
1354 return true;
1355
1356 default:
1357 return false;
1358 }
1359}
1360
1361/* Get the appropriate flag(s) for the setting when it is valid. */
1363 eAnimChannel_Settings setting,
1364 bool *r_neg)
1365{
1366 *r_neg = false;
1367
1368 switch (setting) {
1370 return ADT_UI_SELECTED;
1371
1373 return ADT_UI_EXPANDED;
1374
1375 default:
1376 return 0;
1377 }
1378}
1379
1380/* get pointer to the setting */
1382 eAnimChannel_Settings setting,
1383 short *r_type)
1384{
1385 AnimData *adt = ale->adt;
1386 BLI_assert(adt);
1387
1388 *r_type = 0;
1389
1390 switch (setting) {
1392 return GET_ACF_FLAG_PTR(adt->flag, r_type);
1393
1395 return GET_ACF_FLAG_PTR(adt->flag, r_type);
1396
1397 default:
1398 return nullptr;
1399 }
1400}
1401
1402/* TODO: merge this with the regular Action expander. */
1405 /*channel_type_name*/ "Ob-Layered-Action Filler",
1406 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
1407
1408 /*get_backdrop_color*/ acf_generic_dataexpand_color,
1409 /*get_channel_color*/ nullptr,
1410 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
1411 /*get_indent_level*/ acf_generic_indentation_1,
1412 /*get_offset*/ acf_generic_basic_offset,
1413
1414 /*name*/ acf_generic_idblock_name,
1415 /*name_prop*/ acf_generic_idfill_name_prop,
1416 /*icon*/ acf_fillanim_icon,
1417
1418 /*has_setting*/ acf_fillanim_setting_valid,
1419 /*setting_flag*/ acf_fillanim_setting_flag,
1420 /*setting_ptr*/ acf_fillanim_setting_ptr,
1421 /*setting_post_update*/ nullptr,
1422};
1423
1424static void acf_action_slot_name(bAnimListElem *ale, char *r_name)
1425{
1426 const animrig::Slot *slot = static_cast<animrig::Slot *>(ale->data);
1427 if (!slot) {
1428 /* Trying to getting the slot's name without a slot is a bug. */
1430 BLI_strncpy_utf8(r_name, "-nil-", ANIM_CHAN_NAME_SIZE);
1431 return;
1432 }
1433
1434 BLI_assert(ale->bmain);
1435 const int num_users = slot->users(*ale->bmain).size();
1436 const char *display_name = slot->identifier_without_prefix().c_str();
1437
1438 BLI_assert(num_users >= 0);
1439 switch (num_users) {
1440 case 0:
1441 BLI_snprintf_utf8(r_name, ANIM_CHAN_NAME_SIZE, "%s (unassigned)", display_name);
1442 break;
1443 case 1:
1444 BLI_strncpy_utf8(r_name, display_name, ANIM_CHAN_NAME_SIZE);
1445 break;
1446 default:
1447 BLI_snprintf_utf8(r_name, ANIM_CHAN_NAME_SIZE, "%s (%d)", display_name, num_users);
1448 break;
1449 }
1450}
1452{
1453 animrig::Slot *slot = static_cast<animrig::Slot *>(ale->data);
1455
1456 *r_ptr = RNA_pointer_create_discrete(ale->fcurve_owner_id, &RNA_ActionSlot, slot);
1457 *r_prop = RNA_struct_find_property(r_ptr, "name_display");
1458
1459 return (*r_prop != nullptr);
1460}
1461
1463{
1464 return ICON_ACTION_SLOT;
1465}
1466
1468{
1469 animrig::Slot *slot = static_cast<animrig::Slot *>(ale->data);
1470 return UI_icon_from_idcode(slot->idtype);
1471}
1472
1474 bAnimListElem * /*ale*/,
1475 const eAnimChannel_Settings setting)
1476{
1477 switch (setting) {
1480 return true;
1481
1482 default:
1483 return false;
1484 }
1485}
1486
1488 eAnimChannel_Settings setting,
1489 bool *r_neg)
1490{
1491 *r_neg = false;
1492
1493 switch (setting) {
1498 default:
1499 return 0;
1500 }
1501}
1503 eAnimChannel_Settings /*setting*/,
1504 short *r_type)
1505{
1506 animrig::Slot *slot = static_cast<animrig::Slot *>(ale->data);
1507 return GET_ACF_FLAG_PTR(slot->slot_flags, r_type);
1508}
1509
1511 /*channel_type_name*/ "Action Slot",
1512 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
1513
1514 /*get_backdrop_color*/ acf_generic_root_color,
1515 /*get_channel_color*/ nullptr,
1516 /*draw_backdrop*/ acf_generic_root_backdrop,
1517 /*get_indent_level*/ acf_generic_indentation_0,
1518 /*get_offset*/ acf_generic_group_offset,
1519
1520 /*name*/ acf_action_slot_name,
1521 /*name_prop*/ acf_action_slot_name_prop,
1522 /*icon*/ acf_action_slot_icon,
1523
1524 /*has_setting*/ acf_action_slot_setting_valid,
1525 /*setting_flag*/ acf_action_slot_setting_flag,
1526 /*setting_ptr*/ acf_action_slot_setting_ptr,
1527 /*setting_post_update*/ nullptr,
1528};
1529
1530/* Object Action Expander ------------------------------------------- */
1531
1532/* TODO: just get this from RNA? */
1534{
1535 return ICON_ACTION;
1536}
1537
1538/* check if some setting exists for this channel */
1540 bAnimListElem * /*ale*/,
1541 eAnimChannel_Settings setting)
1542{
1543 switch (setting) {
1544 /* only select and expand supported */
1547 return true;
1548
1549 default:
1550 return false;
1551 }
1552}
1553
1554/* Get the appropriate flag(s) for the setting when it is valid. */
1556 eAnimChannel_Settings setting,
1557 bool *r_neg)
1558{
1559 /* Clear extra return data first. */
1560 *r_neg = false;
1561
1562 switch (setting) {
1563 case ACHANNEL_SETTING_SELECT: /* selected */
1564 return ADT_UI_SELECTED;
1565
1566 case ACHANNEL_SETTING_EXPAND: /* expanded */
1567 *r_neg = true;
1568 return ACT_COLLAPSED;
1569
1570 default: /* unsupported */
1571 return 0;
1572 }
1573}
1574
1575/* get pointer to the setting */
1577 eAnimChannel_Settings setting,
1578 short *r_type)
1579{
1580 bAction *act = static_cast<bAction *>(ale->data);
1581 AnimData *adt = ale->adt;
1582
1583 /* Clear extra return data first. */
1584 *r_type = 0;
1585
1586 switch (setting) {
1587 case ACHANNEL_SETTING_SELECT: /* selected */
1588 if (adt) {
1589 return GET_ACF_FLAG_PTR(adt->flag, r_type);
1590 }
1591 return nullptr;
1592
1593 case ACHANNEL_SETTING_EXPAND: /* expanded */
1594 return GET_ACF_FLAG_PTR(act->flag, r_type);
1595
1596 default: /* unsupported */
1597 return nullptr;
1598 }
1599}
1600
1603 /*channel_type_name*/ "Ob-Action Filler",
1604 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
1605
1606 /*get_backdrop_color*/ acf_generic_dataexpand_color,
1607 /*get_channel_color*/ nullptr,
1608 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
1609 /*get_indent_level*/ acf_generic_indentation_1,
1610 /*get_offset*/ acf_generic_basic_offset,
1611
1612 /*name*/ acf_generic_idblock_name,
1613 /*name_prop*/ acf_generic_idfill_name_prop,
1614 /*icon*/ acf_fillactd_icon,
1615
1616 /*has_setting*/ acf_fillactd_setting_valid,
1617 /*setting_flag*/ acf_fillactd_setting_flag,
1618 /*setting_ptr*/ acf_fillactd_setting_ptr,
1619 /*setting_post_update*/ nullptr,
1620};
1621
1622/* Drivers Expander ------------------------------------------- */
1623
1624/* TODO: just get this from RNA? */
1626{
1627 return ICON_DRIVER;
1628}
1629
1630static void acf_filldrivers_name(bAnimListElem * /*ale*/, char *name)
1631{
1633}
1634
1635/* check if some setting exists for this channel */
1636/* TODO: this could be made more generic */
1638 bAnimListElem * /*ale*/,
1639 eAnimChannel_Settings setting)
1640{
1641 switch (setting) {
1642 /* only expand supported */
1644 return true;
1645
1646 default:
1647 return false;
1648 }
1649}
1650
1651/* Get the appropriate flag(s) for the setting when it is valid. */
1653 eAnimChannel_Settings setting,
1654 bool *r_neg)
1655{
1656 /* Clear extra return data first. */
1657 *r_neg = false;
1658
1659 switch (setting) {
1660 case ACHANNEL_SETTING_EXPAND: /* expanded */
1661 *r_neg = true;
1662 return ADT_DRIVERS_COLLAPSED;
1663
1664 default: /* unsupported */
1665 return 0;
1666 }
1667}
1668
1669/* get pointer to the setting */
1671 eAnimChannel_Settings setting,
1672 short *r_type)
1673{
1674 AnimData *adt = static_cast<AnimData *>(ale->data);
1675
1676 /* Clear extra return data first. */
1677 *r_type = 0;
1678
1679 switch (setting) {
1680 case ACHANNEL_SETTING_EXPAND: /* expanded */
1681 return GET_ACF_FLAG_PTR(adt->flag, r_type);
1682
1683 default: /* unsupported */
1684 return nullptr;
1685 }
1686}
1687
1690 /*channel_type_name*/ "Drivers Filler",
1691 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
1692
1693 /*get_backdrop_color*/ acf_generic_dataexpand_color,
1694 /*get_channel_color*/ nullptr,
1695 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
1696 /*get_indent_level*/ acf_generic_indentation_1,
1697 /*get_offset*/ acf_generic_basic_offset,
1698
1699 /*name*/ acf_filldrivers_name,
1700 /*name_prop*/ nullptr,
1701 /*icon*/ acf_filldrivers_icon,
1702
1703 /*has_setting*/ acf_filldrivers_setting_valid,
1704 /*setting_flag*/ acf_filldrivers_setting_flag,
1705 /*setting_ptr*/ acf_filldrivers_setting_ptr,
1706 /*setting_post_update*/ nullptr,
1707};
1708
1709/* Material Expander ------------------------------------------- */
1710
1711/* TODO: just get this from RNA? */
1712static int acf_dsmat_icon(bAnimListElem * /*ale*/)
1713{
1714 return ICON_MATERIAL_DATA;
1715}
1716
1717/* Get the appropriate flag(s) for the setting when it is valid. */
1719 eAnimChannel_Settings setting,
1720 bool *r_neg)
1721{
1722 /* Clear extra return data first. */
1723 *r_neg = false;
1724
1725 switch (setting) {
1726 case ACHANNEL_SETTING_EXPAND: /* expanded */
1727 return MA_DS_EXPAND;
1728
1729 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1730 return ADT_NLA_EVAL_OFF;
1731
1732 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1733 *r_neg = true;
1735
1736 case ACHANNEL_SETTING_SELECT: /* selected */
1737 return ADT_UI_SELECTED;
1738
1739 default: /* unsupported */
1740 return 0;
1741 }
1742}
1743
1744/* get pointer to the setting */
1746 eAnimChannel_Settings setting,
1747 short *r_type)
1748{
1749 Material *ma = static_cast<Material *>(ale->data);
1750
1751 /* Clear extra return data first. */
1752 *r_type = 0;
1753
1754 switch (setting) {
1755 case ACHANNEL_SETTING_EXPAND: /* expanded */
1756 return GET_ACF_FLAG_PTR(ma->flag, r_type);
1757
1758 case ACHANNEL_SETTING_SELECT: /* selected */
1759 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1760 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1761 if (ma->adt) {
1762 return GET_ACF_FLAG_PTR(ma->adt->flag, r_type);
1763 }
1764 return nullptr;
1765
1766 default: /* unsupported */
1767 return nullptr;
1768 }
1769}
1770
1773 /*channel_type_name*/ "Material Data Expander",
1774 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
1775
1776 /*get_backdrop_color*/ acf_generic_dataexpand_color,
1777 /*get_channel_color*/ nullptr,
1778 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
1779 /*get_indent_level*/ acf_generic_indentation_1,
1780 /*get_offset*/ acf_generic_basic_offset,
1781
1782 /*name*/ acf_generic_idblock_name,
1783 /*name_prop*/ acf_generic_idblock_name_prop,
1784 /*icon*/ acf_dsmat_icon,
1785
1787 /*setting_flag*/ acf_dsmat_setting_flag,
1788 /*setting_ptr*/ acf_dsmat_setting_ptr,
1789 /*setting_post_update*/ nullptr,
1790};
1791
1792/* Light Expander ------------------------------------------- */
1793
1794/* TODO: just get this from RNA? */
1795static int acf_dslight_icon(bAnimListElem * /*ale*/)
1796{
1797 return ICON_LIGHT_DATA;
1798}
1799
1800/* Get the appropriate flag(s) for the setting when it is valid. */
1802 eAnimChannel_Settings setting,
1803 bool *r_neg)
1804{
1805 /* Clear extra return data first. */
1806 *r_neg = false;
1807
1808 switch (setting) {
1809 case ACHANNEL_SETTING_EXPAND: /* expanded */
1810 return LA_DS_EXPAND;
1811
1812 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1813 return ADT_NLA_EVAL_OFF;
1814
1815 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1816 *r_neg = true;
1818
1819 case ACHANNEL_SETTING_SELECT: /* selected */
1820 return ADT_UI_SELECTED;
1821
1822 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
1824
1825 default: /* unsupported */
1826 return 0;
1827 }
1828}
1829
1830/* get pointer to the setting */
1832 eAnimChannel_Settings setting,
1833 short *r_type)
1834{
1835 Light *la = static_cast<Light *>(ale->data);
1836
1837 /* Clear extra return data first. */
1838 *r_type = 0;
1839
1840 switch (setting) {
1841 case ACHANNEL_SETTING_EXPAND: /* expanded */
1842 return GET_ACF_FLAG_PTR(la->flag, r_type);
1843
1844 case ACHANNEL_SETTING_SELECT: /* selected */
1845 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1846 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1847 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
1848 if (la->adt) {
1849 return GET_ACF_FLAG_PTR(la->adt->flag, r_type);
1850 }
1851 return nullptr;
1852
1853 default: /* unsupported */
1854 return nullptr;
1855 }
1856}
1857
1860 /*channel_type_name*/ "Light Expander",
1861 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
1862
1863 /*get_backdrop_color*/ acf_generic_dataexpand_color,
1864 /*get_channel_color*/ nullptr,
1865 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
1866 /*get_indent_level*/ acf_generic_indentation_1,
1867 /*get_offset*/ acf_generic_basic_offset,
1868
1869 /*name*/ acf_generic_idblock_name,
1870 /*name_prop*/ acf_generic_idblock_name_prop,
1871 /*icon*/ acf_dslight_icon,
1872
1874 /*setting_flag*/ acf_dslight_setting_flag,
1875 /*setting_ptr*/ acf_dslight_setting_ptr,
1876 /*setting_post_update*/ nullptr,
1877};
1878
1879/* Texture Expander ------------------------------------------- */
1880
1881/* TODO: just get this from RNA? */
1882static int acf_dstex_icon(bAnimListElem * /*ale*/)
1883{
1884 return ICON_TEXTURE_DATA;
1885}
1886
1887/* offset for texture expanders */
1888/* FIXME: soon to be obsolete? */
1889static short acf_dstex_offset(bAnimContext * /*ac*/, bAnimListElem * /*ale*/)
1890{
1891 return 14; /* XXX: simply include this in indentation instead? */
1892}
1893
1894/* Get the appropriate flag(s) for the setting when it is valid. */
1896 eAnimChannel_Settings setting,
1897 bool *r_neg)
1898{
1899 /* Clear extra return data first. */
1900 *r_neg = false;
1901
1902 switch (setting) {
1903 case ACHANNEL_SETTING_EXPAND: /* expanded */
1904 return TEX_DS_EXPAND;
1905
1906 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1907 return ADT_NLA_EVAL_OFF;
1908
1909 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1910 *r_neg = true;
1912
1913 case ACHANNEL_SETTING_SELECT: /* selected */
1914 return ADT_UI_SELECTED;
1915
1916 default: /* unsupported */
1917 return 0;
1918 }
1919}
1920
1921/* get pointer to the setting */
1923 eAnimChannel_Settings setting,
1924 short *r_type)
1925{
1926 Tex *tex = static_cast<Tex *>(ale->data);
1927
1928 /* Clear extra return data first. */
1929 *r_type = 0;
1930
1931 switch (setting) {
1932 case ACHANNEL_SETTING_EXPAND: /* expanded */
1933 return GET_ACF_FLAG_PTR(tex->flag, r_type);
1934
1935 case ACHANNEL_SETTING_SELECT: /* selected */
1936 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1937 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1938 if (tex->adt) {
1939 return GET_ACF_FLAG_PTR(tex->adt->flag, r_type);
1940 }
1941 return nullptr;
1942
1943 default: /* unsupported */
1944 return nullptr;
1945 }
1946}
1947
1950 /*channel_type_name*/ "Texture Data Expander",
1951 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
1952
1953 /*get_backdrop_color*/ acf_generic_dataexpand_color,
1954 /*get_channel_color*/ nullptr,
1955 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
1956 /*get_indent_level*/ acf_generic_indentation_1,
1957 /*get_offset*/ acf_dstex_offset,
1958
1959 /*name*/ acf_generic_idblock_name,
1960 /*name_prop*/ acf_generic_idfill_name_prop,
1961 /*icon*/ acf_dstex_icon,
1962
1964 /*setting_flag*/ acf_dstex_setting_flag,
1965 /*setting_ptr*/ acf_dstex_setting_ptr,
1966 /*setting_post_update*/ nullptr,
1967};
1968
1969/* Camera Expander ------------------------------------------- */
1970
1971/* TODO: just get this from RNA? */
1973{
1974 UNUSED_VARS(ale);
1975 return ICON_FILE;
1976}
1977
1978/* Get the appropriate flag(s) for the setting when it is valid. */
1980 eAnimChannel_Settings setting,
1981 bool *r_neg)
1982{
1983 /* Clear extra return data first. */
1984 *r_neg = false;
1985
1986 switch (setting) {
1987 case ACHANNEL_SETTING_EXPAND: /* expanded */
1988 return CACHEFILE_DS_EXPAND;
1989
1990 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1991 return ADT_NLA_EVAL_OFF;
1992
1993 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1994 *r_neg = true;
1996
1997 case ACHANNEL_SETTING_SELECT: /* selected */
1998 return ADT_UI_SELECTED;
1999
2000 default: /* unsupported */
2001 return 0;
2002 }
2003
2004 UNUSED_VARS(ac);
2005}
2006
2007/* get pointer to the setting */
2009 eAnimChannel_Settings setting,
2010 short *r_type)
2011{
2012 CacheFile *cache_file = static_cast<CacheFile *>(ale->data);
2013
2014 /* Clear extra return data first. */
2015 *r_type = 0;
2016
2017 switch (setting) {
2018 case ACHANNEL_SETTING_EXPAND: /* expanded */
2019 return GET_ACF_FLAG_PTR(cache_file->flag, r_type);
2020
2021 case ACHANNEL_SETTING_SELECT: /* selected */
2022 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2023 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2024 if (cache_file->adt) {
2025 return GET_ACF_FLAG_PTR(cache_file->adt->flag, r_type);
2026 }
2027
2028 return nullptr;
2029
2030 default: /* unsupported */
2031 return nullptr;
2032 }
2033}
2034
2037 /*channel_type_name*/ "Cache File Expander",
2038 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
2039
2040 /*get_backdrop_color*/ acf_generic_dataexpand_color,
2041 /*get_channel_color*/ nullptr,
2042 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
2043 /*get_indent_level*/ acf_generic_indentation_1,
2044 /*get_offset*/ acf_generic_basic_offset,
2045
2046 /*name*/ acf_generic_idblock_name,
2047 /*name_prop*/ acf_generic_idfill_name_prop,
2048 /*icon*/ acf_dscachefile_icon,
2049
2051 /*setting_flag*/ acf_dscachefile_setting_flag,
2052 /*setting_ptr*/ acf_dscachefile_setting_ptr,
2053 /*setting_post_update*/ nullptr,
2054};
2055
2056/* Camera Expander ------------------------------------------- */
2057
2058/* TODO: just get this from RNA? */
2059static int acf_dscam_icon(bAnimListElem * /*ale*/)
2060{
2061 return ICON_CAMERA_DATA;
2062}
2063
2064/* Get the appropriate flag(s) for the setting when it is valid. */
2066 eAnimChannel_Settings setting,
2067 bool *r_neg)
2068{
2069 /* Clear extra return data first. */
2070 *r_neg = false;
2071
2072 switch (setting) {
2073 case ACHANNEL_SETTING_EXPAND: /* expanded */
2074 return CAM_DS_EXPAND;
2075
2076 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2077 return ADT_NLA_EVAL_OFF;
2078
2079 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2080 *r_neg = true;
2082
2083 case ACHANNEL_SETTING_SELECT: /* selected */
2084 return ADT_UI_SELECTED;
2085
2086 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
2088
2089 default: /* unsupported */
2090 return 0;
2091 }
2092}
2093
2094/* get pointer to the setting */
2096 eAnimChannel_Settings setting,
2097 short *r_type)
2098{
2099 Camera *ca = static_cast<Camera *>(ale->data);
2100
2101 /* Clear extra return data first. */
2102 *r_type = 0;
2103
2104 switch (setting) {
2105 case ACHANNEL_SETTING_EXPAND: /* expanded */
2106 return GET_ACF_FLAG_PTR(ca->flag, r_type);
2107
2108 case ACHANNEL_SETTING_SELECT: /* selected */
2109 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2110 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2111 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
2112 if (ca->adt) {
2113 return GET_ACF_FLAG_PTR(ca->adt->flag, r_type);
2114 }
2115 return nullptr;
2116
2117 default: /* unsupported */
2118 return nullptr;
2119 }
2120}
2121
2124 /*channel_type_name*/ "Camera Expander",
2125 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
2126
2127 /*get_backdrop_color*/ acf_generic_dataexpand_color,
2128 /*get_channel_color*/ nullptr,
2129 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
2130 /*get_indent_level*/ acf_generic_indentation_1,
2131 /*get_offset*/ acf_generic_basic_offset,
2132
2133 /*name*/ acf_generic_idblock_name,
2134 /*name_prop*/ acf_generic_idfill_name_prop,
2135 /*icon*/ acf_dscam_icon,
2136
2138 /*setting_flag*/ acf_dscam_setting_flag,
2139 /*setting_ptr*/ acf_dscam_setting_ptr,
2140 /*setting_post_update*/ nullptr,
2141};
2142
2143/* Curve Expander ------------------------------------------- */
2144
2145/* TODO: just get this from RNA? */
2147{
2148 Curve *cu = static_cast<Curve *>(ale->data);
2149 switch (cu->ob_type) {
2150 case OB_FONT:
2151 return ICON_FONT_DATA;
2152 case OB_SURF:
2153 return ICON_SURFACE_DATA;
2154 default:
2155 return ICON_CURVE_DATA;
2156 }
2157}
2158
2159/* Get the appropriate flag(s) for the setting when it is valid. */
2161 eAnimChannel_Settings setting,
2162 bool *r_neg)
2163{
2164 /* Clear extra return data first. */
2165 *r_neg = false;
2166
2167 switch (setting) {
2168 case ACHANNEL_SETTING_EXPAND: /* expanded */
2169 return CU_DS_EXPAND;
2170
2171 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2172 return ADT_NLA_EVAL_OFF;
2173
2174 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2175 *r_neg = true;
2177
2178 case ACHANNEL_SETTING_SELECT: /* selected */
2179 return ADT_UI_SELECTED;
2180
2181 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
2183
2184 default: /* unsupported */
2185 return 0;
2186 }
2187}
2188
2189/* get pointer to the setting */
2191 eAnimChannel_Settings setting,
2192 short *r_type)
2193{
2194 Curve *cu = static_cast<Curve *>(ale->data);
2195
2196 /* Clear extra return data first. */
2197 *r_type = 0;
2198
2199 switch (setting) {
2200 case ACHANNEL_SETTING_EXPAND: /* expanded */
2201 return GET_ACF_FLAG_PTR(cu->flag, r_type);
2202
2203 case ACHANNEL_SETTING_SELECT: /* selected */
2204 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2205 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2206 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
2207 if (cu->adt) {
2208 return GET_ACF_FLAG_PTR(cu->adt->flag, r_type);
2209 }
2210 return nullptr;
2211
2212 default: /* unsupported */
2213 return nullptr;
2214 }
2215}
2216
2219 /*channel_type_name*/ "Curve Expander",
2220 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
2221
2222 /*get_backdrop_color*/ acf_generic_dataexpand_color,
2223 /*get_channel_color*/ nullptr,
2224 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
2225 /*get_indent_level*/ acf_generic_indentation_1,
2226 /*get_offset*/ acf_generic_basic_offset,
2227
2228 /*name*/ acf_generic_idblock_name,
2229 /*name_prop*/ acf_generic_idblock_name_prop,
2230 /*icon*/ acf_dscur_icon,
2231
2233 /*setting_flag*/ acf_dscur_setting_flag,
2234 /*setting_ptr*/ acf_dscur_setting_ptr,
2235 /*setting_post_update*/ nullptr,
2236};
2237
2238/* Shape Key Expander ------------------------------------------- */
2239
2240/* TODO: just get this from RNA? */
2241static int acf_dsskey_icon(bAnimListElem * /*ale*/)
2242{
2243 return ICON_SHAPEKEY_DATA;
2244}
2245
2246/* check if some setting exists for this channel */
2248 bAnimListElem * /*ale*/,
2249 eAnimChannel_Settings setting)
2250{
2251 switch (setting) {
2254 return true;
2255
2256 /* mute is only supported for NLA */
2258 return ((ac) && (ac->spacetype == SPACE_NLA));
2259
2260 default:
2261 return false;
2262 }
2263}
2264
2265/* Get the appropriate flag(s) for the setting when it is valid. */
2267 eAnimChannel_Settings setting,
2268 bool *r_neg)
2269{
2270 /* Clear extra return data first. */
2271 *r_neg = false;
2272
2273 switch (setting) {
2274 case ACHANNEL_SETTING_EXPAND: /* expanded */
2275 return KEY_DS_EXPAND;
2276
2277 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2278 return ADT_NLA_EVAL_OFF;
2279
2280 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2281 *r_neg = true;
2283
2284 case ACHANNEL_SETTING_SELECT: /* selected */
2285 return ADT_UI_SELECTED;
2286
2287 default: /* unsupported */
2288 return 0;
2289 }
2290}
2291
2292/* get pointer to the setting */
2294 eAnimChannel_Settings setting,
2295 short *r_type)
2296{
2297 Key *key = static_cast<Key *>(ale->data);
2298
2299 /* Clear extra return data first. */
2300 *r_type = 0;
2301
2302 switch (setting) {
2303 case ACHANNEL_SETTING_EXPAND: /* expanded */
2304 return GET_ACF_FLAG_PTR(key->flag, r_type);
2305
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) */
2309 if (key->adt) {
2310 return GET_ACF_FLAG_PTR(key->adt->flag, r_type);
2311 }
2312 return nullptr;
2313
2314 default: /* unsupported */
2315 return nullptr;
2316 }
2317}
2318
2321 /*channel_type_name*/ "Shape Key Expander",
2322 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
2323
2324 /*get_backdrop_color*/ acf_generic_dataexpand_color,
2325 /*get_channel_color*/ nullptr,
2326 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
2327 /*get_indent_level*/ acf_generic_indentation_1,
2328 /*get_offset*/ acf_generic_basic_offset,
2329
2330 /*name*/ acf_generic_idblock_name,
2331 /*name_prop*/ acf_generic_idblock_name_prop,
2332 /*icon*/ acf_dsskey_icon,
2333
2334 /*has_setting*/ acf_dsskey_setting_valid,
2335 /*setting_flag*/ acf_dsskey_setting_flag,
2336 /*setting_ptr*/ acf_dsskey_setting_ptr,
2337 /*setting_post_update*/ nullptr,
2338};
2339
2340/* World Expander ------------------------------------------- */
2341
2342/* TODO: just get this from RNA? */
2343static int acf_dswor_icon(bAnimListElem * /*ale*/)
2344{
2345 return ICON_WORLD_DATA;
2346}
2347
2348/* Get the appropriate flag(s) for the setting when it is valid. */
2350 eAnimChannel_Settings setting,
2351 bool *r_neg)
2352{
2353 /* Clear extra return data first. */
2354 *r_neg = false;
2355
2356 switch (setting) {
2357 case ACHANNEL_SETTING_EXPAND: /* expanded */
2358 return WO_DS_EXPAND;
2359
2360 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2361 return ADT_NLA_EVAL_OFF;
2362
2363 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2364 *r_neg = true;
2366
2367 case ACHANNEL_SETTING_SELECT: /* selected */
2368 return ADT_UI_SELECTED;
2369
2370 default: /* unsupported */
2371 return 0;
2372 }
2373}
2374
2375/* get pointer to the setting */
2377 eAnimChannel_Settings setting,
2378 short *r_type)
2379{
2380 World *wo = static_cast<World *>(ale->data);
2381
2382 /* Clear extra return data first. */
2383 *r_type = 0;
2384
2385 switch (setting) {
2386 case ACHANNEL_SETTING_EXPAND: /* expanded */
2387 return GET_ACF_FLAG_PTR(wo->flag, r_type);
2388
2389 case ACHANNEL_SETTING_SELECT: /* selected */
2390 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2391 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2392 if (wo->adt) {
2393 return GET_ACF_FLAG_PTR(wo->adt->flag, r_type);
2394 }
2395 return nullptr;
2396
2397 default: /* unsupported */
2398 return nullptr;
2399 }
2400}
2401
2404 /*channel_type_name*/ "World Expander",
2405 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
2406
2407 /*get_backdrop_color*/ acf_generic_dataexpand_color,
2408 /*get_channel_color*/ nullptr,
2409 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
2410 /*get_indent_level*/ acf_generic_indentation_1,
2411 /*get_offset*/ acf_generic_basic_offset,
2412
2413 /*name*/ acf_generic_idblock_name,
2414 /*name_prop*/ acf_generic_idfill_name_prop,
2415 /*icon*/ acf_dswor_icon,
2416
2418 /*setting_flag*/ acf_dswor_setting_flag,
2419 /*setting_ptr*/ acf_dswor_setting_ptr,
2420 /*setting_post_update*/ nullptr,
2421};
2422
2423/* Particle Expander ------------------------------------------- */
2424
2425/* TODO: just get this from RNA? */
2426static int acf_dspart_icon(bAnimListElem * /*ale*/)
2427{
2428 return ICON_PARTICLE_DATA;
2429}
2430
2431/* Get the appropriate flag(s) for the setting when it is valid. */
2433 eAnimChannel_Settings setting,
2434 bool *r_neg)
2435{
2436 /* Clear extra return data first. */
2437 *r_neg = false;
2438
2439 switch (setting) {
2440 case ACHANNEL_SETTING_EXPAND: /* expanded */
2441 return PART_DS_EXPAND;
2442
2443 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2444 return ADT_NLA_EVAL_OFF;
2445
2446 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2447 *r_neg = true;
2449
2450 case ACHANNEL_SETTING_SELECT: /* selected */
2451 return ADT_UI_SELECTED;
2452
2453 default: /* unsupported */
2454 return 0;
2455 }
2456}
2457
2458/* get pointer to the setting */
2460 eAnimChannel_Settings setting,
2461 short *r_type)
2462{
2463 ParticleSettings *part = static_cast<ParticleSettings *>(ale->data);
2464
2465 /* Clear extra return data first. */
2466 *r_type = 0;
2467
2468 switch (setting) {
2469 case ACHANNEL_SETTING_EXPAND: /* expanded */
2470 return GET_ACF_FLAG_PTR(part->flag, r_type);
2471
2472 case ACHANNEL_SETTING_SELECT: /* selected */
2473 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2474 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2475 if (part->adt) {
2476 return GET_ACF_FLAG_PTR(part->adt->flag, r_type);
2477 }
2478 return nullptr;
2479
2480 default: /* unsupported */
2481 return nullptr;
2482 }
2483}
2484
2487 /*channel_type_name*/ "Particle Data Expander",
2488 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
2489
2490 /*get_backdrop_color*/ acf_generic_dataexpand_color,
2491 /*get_channel_color*/ nullptr,
2492 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
2493 /*get_indent_level*/ acf_generic_indentation_1,
2494 /*get_offset*/ acf_generic_basic_offset,
2495
2496 /*name*/ acf_generic_idblock_name,
2497 /*name_prop*/ acf_generic_idblock_name_prop,
2498 /*icon*/ acf_dspart_icon,
2499
2501 /*setting_flag*/ acf_dspart_setting_flag,
2502 /*setting_ptr*/ acf_dspart_setting_ptr,
2503 /*setting_post_update*/ nullptr,
2504};
2505
2506/* MetaBall Expander ------------------------------------------- */
2507
2508/* TODO: just get this from RNA? */
2509static int acf_dsmball_icon(bAnimListElem * /*ale*/)
2510{
2511 return ICON_META_DATA;
2512}
2513
2514/* Get the appropriate flag(s) for the setting when it is valid. */
2516 eAnimChannel_Settings setting,
2517 bool *r_neg)
2518{
2519 /* Clear extra return data first. */
2520 *r_neg = false;
2521
2522 switch (setting) {
2523 case ACHANNEL_SETTING_EXPAND: /* expanded */
2524 return MB_DS_EXPAND;
2525
2526 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2527 return ADT_NLA_EVAL_OFF;
2528
2529 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2530 *r_neg = true;
2532
2533 case ACHANNEL_SETTING_SELECT: /* selected */
2534 return ADT_UI_SELECTED;
2535
2536 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
2538
2539 default: /* unsupported */
2540 return 0;
2541 }
2542}
2543
2544/* get pointer to the setting */
2546 eAnimChannel_Settings setting,
2547 short *r_type)
2548{
2549 MetaBall *mb = static_cast<MetaBall *>(ale->data);
2550
2551 /* Clear extra return data first. */
2552 *r_type = 0;
2553
2554 switch (setting) {
2555 case ACHANNEL_SETTING_EXPAND: /* expanded */
2556 return GET_ACF_FLAG_PTR(mb->flag2, r_type);
2557
2558 case ACHANNEL_SETTING_SELECT: /* selected */
2559 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2560 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2561 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
2562 if (mb->adt) {
2563 return GET_ACF_FLAG_PTR(mb->adt->flag, r_type);
2564 }
2565 return nullptr;
2566
2567 default: /* unsupported */
2568 return nullptr;
2569 }
2570}
2571
2574 /*channel_type_name*/ "Metaball Expander",
2575 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
2576
2577 /*get_backdrop_color*/ acf_generic_dataexpand_color,
2578 /*get_channel_color*/ nullptr,
2579 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
2580 /*get_indent_level*/ acf_generic_indentation_1,
2581 /*get_offset*/ acf_generic_basic_offset,
2582
2583 /*name*/ acf_generic_idblock_name,
2584 /*name_prop*/ acf_generic_idblock_name_prop,
2585 /*icon*/ acf_dsmball_icon,
2586
2588 /*setting_flag*/ acf_dsmball_setting_flag,
2589 /*setting_ptr*/ acf_dsmball_setting_ptr,
2590 /*setting_post_update*/ nullptr,
2591};
2592
2593/* Armature Expander ------------------------------------------- */
2594
2595/* TODO: just get this from RNA? */
2596static int acf_dsarm_icon(bAnimListElem * /*ale*/)
2597{
2598 return ICON_ARMATURE_DATA;
2599}
2600
2601/* Get the appropriate flag(s) for the setting when it is valid. */
2603 eAnimChannel_Settings setting,
2604 bool *r_neg)
2605{
2606 /* Clear extra return data first. */
2607 *r_neg = false;
2608
2609 switch (setting) {
2610 case ACHANNEL_SETTING_EXPAND: /* expanded */
2611 return ARM_DS_EXPAND;
2612
2613 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2614 return ADT_NLA_EVAL_OFF;
2615
2616 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2617 *r_neg = true;
2619
2620 case ACHANNEL_SETTING_SELECT: /* selected */
2621 return ADT_UI_SELECTED;
2622
2623 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
2625
2626 default: /* unsupported */
2627 return 0;
2628 }
2629}
2630
2631/* get pointer to the setting */
2633 eAnimChannel_Settings setting,
2634 short *r_type)
2635{
2636 bArmature *arm = static_cast<bArmature *>(ale->data);
2637
2638 /* Clear extra return data first. */
2639 *r_type = 0;
2640
2641 switch (setting) {
2642 case ACHANNEL_SETTING_EXPAND: /* expanded */
2643 return GET_ACF_FLAG_PTR(arm->flag, r_type);
2644
2645 case ACHANNEL_SETTING_SELECT: /* selected */
2646 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2647 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2648 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
2649 if (arm->adt) {
2650 return GET_ACF_FLAG_PTR(arm->adt->flag, r_type);
2651 }
2652 return nullptr;
2653
2654 default: /* unsupported */
2655 return nullptr;
2656 }
2657}
2658
2661 /*channel_type_name*/ "Armature Expander",
2662 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
2663
2664 /*get_backdrop_color*/ acf_generic_dataexpand_color,
2665 /*get_channel_color*/ nullptr,
2666 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
2667 /*get_indent_level*/ acf_generic_indentation_1,
2668 /*get_offset*/ acf_generic_basic_offset,
2669
2670 /*name*/ acf_generic_idblock_name,
2671 /*name_prop*/ acf_generic_idblock_name_prop,
2672 /*icon*/ acf_dsarm_icon,
2673
2675 /*setting_flag*/ acf_dsarm_setting_flag,
2676 /*setting_ptr*/ acf_dsarm_setting_ptr,
2677 /*setting_post_update*/ nullptr,
2678};
2679
2680/* NodeTree Expander ------------------------------------------- */
2681
2682/* TODO: just get this from RNA? */
2683static int acf_dsntree_icon(bAnimListElem * /*ale*/)
2684{
2685 return ICON_NODETREE;
2686}
2687
2688/* offset for nodetree expanders */
2690{
2691 bNodeTree *ntree = static_cast<bNodeTree *>(ale->data);
2692 short offset = acf_generic_basic_offset(ac, ale);
2693
2694 offset += acf_nodetree_rootType_offset(ntree);
2695
2696 return offset;
2697}
2698
2699/* Get the appropriate flag(s) for the setting when it is valid. */
2701 eAnimChannel_Settings setting,
2702 bool *r_neg)
2703{
2704 /* Clear extra return data first. */
2705 *r_neg = false;
2706
2707 switch (setting) {
2708 case ACHANNEL_SETTING_EXPAND: /* expanded */
2709 return NTREE_DS_EXPAND;
2710
2711 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2712 return ADT_NLA_EVAL_OFF;
2713
2714 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2715 *r_neg = true;
2717
2718 case ACHANNEL_SETTING_SELECT: /* selected */
2719 return ADT_UI_SELECTED;
2720
2721 default: /* unsupported */
2722 return 0;
2723 }
2724}
2725
2726/* get pointer to the setting */
2728 eAnimChannel_Settings setting,
2729 short *r_type)
2730{
2731 bNodeTree *ntree = static_cast<bNodeTree *>(ale->data);
2732
2733 /* Clear extra return data first. */
2734 *r_type = 0;
2735
2736 switch (setting) {
2737 case ACHANNEL_SETTING_EXPAND: /* expanded */
2738 return GET_ACF_FLAG_PTR(ntree->flag, r_type);
2739
2740 case ACHANNEL_SETTING_SELECT: /* selected */
2741 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2742 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2743 if (ntree->adt) {
2744 return GET_ACF_FLAG_PTR(ntree->adt->flag, r_type);
2745 }
2746 return nullptr;
2747
2748 default: /* unsupported */
2749 return nullptr;
2750 }
2751}
2752
2755 /*channel_type_name*/ "Node Tree Expander",
2756 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
2757
2758 /*get_backdrop_color*/ acf_generic_dataexpand_color,
2759 /*get_channel_color*/ nullptr,
2760 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
2761 /*get_indent_level*/ acf_generic_indentation_1,
2762 /*get_offset*/ acf_dsntree_offset,
2763
2764 /*name*/ acf_generic_idblock_name,
2765 /*name_prop*/ acf_generic_idblock_name_prop,
2766 /*icon*/ acf_dsntree_icon,
2767
2769 /*setting_flag*/ acf_dsntree_setting_flag,
2770 /*setting_ptr*/ acf_dsntree_setting_ptr,
2771 /*setting_post_update*/ nullptr,
2772};
2773
2774/* LineStyle Expander ------------------------------------------- */
2775
2776/* TODO: just get this from RNA? */
2778{
2779 return ICON_LINE_DATA;
2780}
2781
2782/* Get the appropriate flag(s) for the setting when it is valid. */
2784 eAnimChannel_Settings setting,
2785 bool *r_neg)
2786{
2787 /* Clear extra return data first. */
2788 *r_neg = false;
2789
2790 switch (setting) {
2791 case ACHANNEL_SETTING_EXPAND: /* expanded */
2792 return LS_DS_EXPAND;
2793
2794 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2795 return ADT_NLA_EVAL_OFF;
2796
2797 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2798 *r_neg = true;
2800
2801 case ACHANNEL_SETTING_SELECT: /* selected */
2802 return ADT_UI_SELECTED;
2803
2804 default: /* unsupported */
2805 return 0;
2806 }
2807}
2808
2809/* get pointer to the setting */
2811 eAnimChannel_Settings setting,
2812 short *r_type)
2813{
2814 FreestyleLineStyle *linestyle = static_cast<FreestyleLineStyle *>(ale->data);
2815
2816 /* Clear extra return data first. */
2817 *r_type = 0;
2818
2819 switch (setting) {
2820 case ACHANNEL_SETTING_EXPAND: /* expanded */
2821 return GET_ACF_FLAG_PTR(linestyle->flag, r_type);
2822
2823 case ACHANNEL_SETTING_SELECT: /* selected */
2824 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2825 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2826 if (linestyle->adt) {
2827 return GET_ACF_FLAG_PTR(linestyle->adt->flag, r_type);
2828 }
2829 return nullptr;
2830
2831 default: /* unsupported */
2832 return nullptr;
2833 }
2834}
2835
2838 /*channel_type_name*/ "Line Style Expander",
2839 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
2840
2841 /*get_backdrop_color*/ acf_generic_dataexpand_color,
2842 /*get_channel_color*/ nullptr,
2843 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
2844 /*get_indent_level*/ acf_generic_indentation_1,
2845 /*get_offset*/ acf_generic_basic_offset,
2846
2847 /*name*/ acf_generic_idblock_name,
2848 /*name_prop*/ acf_generic_idblock_name_prop,
2849 /*icon*/ acf_dslinestyle_icon,
2850
2852 /*setting_flag*/ acf_dslinestyle_setting_flag,
2853 /*setting_ptr*/ acf_dslinestyle_setting_ptr,
2854 /*setting_post_update*/ nullptr,
2855};
2856
2857/* Mesh Expander ------------------------------------------- */
2858
2859/* TODO: just get this from RNA? */
2860static int acf_dsmesh_icon(bAnimListElem * /*ale*/)
2861{
2862 return ICON_MESH_DATA;
2863}
2864
2865/* Get the appropriate flag(s) for the setting when it is valid. */
2867 eAnimChannel_Settings setting,
2868 bool *r_neg)
2869{
2870 /* Clear extra return data first. */
2871 *r_neg = false;
2872
2873 switch (setting) {
2874 case ACHANNEL_SETTING_EXPAND: /* expanded */
2875 return ME_DS_EXPAND;
2876
2877 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2878 return ADT_NLA_EVAL_OFF;
2879
2880 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2881 *r_neg = true;
2883
2884 case ACHANNEL_SETTING_SELECT: /* selected */
2885 return ADT_UI_SELECTED;
2886
2887 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
2889
2890 default: /* unsupported */
2891 return 0;
2892 }
2893}
2894
2895/* get pointer to the setting */
2897 eAnimChannel_Settings setting,
2898 short *r_type)
2899{
2900 Mesh *mesh = static_cast<Mesh *>(ale->data);
2901
2902 /* Clear extra return data first. */
2903 *r_type = 0;
2904
2905 switch (setting) {
2906 case ACHANNEL_SETTING_EXPAND: /* expanded */
2907 return GET_ACF_FLAG_PTR(mesh->flag, r_type);
2908
2909 case ACHANNEL_SETTING_SELECT: /* selected */
2910 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2911 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2912 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
2913 if (mesh->adt) {
2914 return GET_ACF_FLAG_PTR(mesh->adt->flag, r_type);
2915 }
2916 return nullptr;
2917
2918 default: /* unsupported */
2919 return nullptr;
2920 }
2921}
2922
2925 /*channel_type_name*/ "Mesh Expander",
2926 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
2927
2928 /*get_backdrop_color*/ acf_generic_dataexpand_color,
2929 /*get_channel_color*/ nullptr,
2930 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
2931 /*get_indent_level*/ acf_generic_indentation_1,
2932 /* XXX: this only works for compositing. */
2933 /*get_offset*/ acf_generic_basic_offset,
2934
2935 /*name*/ acf_generic_idblock_name,
2936 /*name_prop*/ acf_generic_idblock_name_prop,
2937 /*icon*/ acf_dsmesh_icon,
2938
2940 /*setting_flag*/ acf_dsmesh_setting_flag,
2941 /*setting_ptr*/ acf_dsmesh_setting_ptr,
2942 /*setting_post_update*/ nullptr,
2943};
2944
2945/* Lattice Expander ------------------------------------------- */
2946
2947/* TODO: just get this from RNA? */
2948static int acf_dslat_icon(bAnimListElem * /*ale*/)
2949{
2950 return ICON_LATTICE_DATA;
2951}
2952
2953/* Get the appropriate flag(s) for the setting when it is valid. */
2955 eAnimChannel_Settings setting,
2956 bool *r_neg)
2957{
2958 /* Clear extra return data first. */
2959 *r_neg = false;
2960
2961 switch (setting) {
2962 case ACHANNEL_SETTING_EXPAND: /* expanded */
2963 return LT_DS_EXPAND;
2964
2965 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2966 return ADT_NLA_EVAL_OFF;
2967
2968 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2969 *r_neg = true;
2971
2972 case ACHANNEL_SETTING_SELECT: /* selected */
2973 return ADT_UI_SELECTED;
2974
2975 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
2977
2978 default: /* unsupported */
2979 return 0;
2980 }
2981}
2982
2983/* get pointer to the setting */
2985 eAnimChannel_Settings setting,
2986 short *r_type)
2987{
2988 Lattice *lt = static_cast<Lattice *>(ale->data);
2989
2990 /* Clear extra return data first. */
2991 *r_type = 0;
2992
2993 switch (setting) {
2994 case ACHANNEL_SETTING_EXPAND: /* expanded */
2995 return GET_ACF_FLAG_PTR(lt->flag, r_type);
2996
2997 case ACHANNEL_SETTING_SELECT: /* selected */
2998 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2999 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
3000 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
3001 if (lt->adt) {
3002 return GET_ACF_FLAG_PTR(lt->adt->flag, r_type);
3003 }
3004 return nullptr;
3005
3006 default: /* unsupported */
3007 return nullptr;
3008 }
3009}
3010
3013 /*channel_type_name*/ "Lattice Expander",
3014 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
3015
3016 /*get_backdrop_color*/ acf_generic_dataexpand_color,
3017 /*get_channel_color*/ nullptr,
3018 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
3019 /*get_indent_level*/ acf_generic_indentation_1,
3020 /* XXX: this only works for compositing. */
3021 /*get_offset*/ acf_generic_basic_offset,
3022
3023 /*name*/ acf_generic_idblock_name,
3024 /*name_prop*/ acf_generic_idblock_name_prop,
3025 /*icon*/ acf_dslat_icon,
3026
3028 /*setting_flag*/ acf_dslat_setting_flag,
3029 /*setting_ptr*/ acf_dslat_setting_ptr,
3030 /*setting_post_update*/ nullptr,
3031};
3032
3033/* Speaker Expander ------------------------------------------- */
3034
3035/* TODO: just get this from RNA? */
3036static int acf_dsspk_icon(bAnimListElem * /*ale*/)
3037{
3038 return ICON_SPEAKER;
3039}
3040
3041/* Get the appropriate flag(s) for the setting when it is valid. */
3043 eAnimChannel_Settings setting,
3044 bool *r_neg)
3045{
3046 /* Clear extra return data first. */
3047 *r_neg = false;
3048
3049 switch (setting) {
3050 case ACHANNEL_SETTING_EXPAND: /* expanded */
3051 return SPK_DS_EXPAND;
3052
3053 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
3054 return ADT_NLA_EVAL_OFF;
3055
3056 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
3057 *r_neg = true;
3059
3060 case ACHANNEL_SETTING_SELECT: /* selected */
3061 return ADT_UI_SELECTED;
3062
3063 default: /* unsupported */
3064 return 0;
3065 }
3066}
3067
3068/* get pointer to the setting */
3070 eAnimChannel_Settings setting,
3071 short *r_type)
3072{
3073 Speaker *spk = static_cast<Speaker *>(ale->data);
3074
3075 /* Clear extra return data first. */
3076 *r_type = 0;
3077
3078 switch (setting) {
3079 case ACHANNEL_SETTING_EXPAND: /* expanded */
3080 return GET_ACF_FLAG_PTR(spk->flag, r_type);
3081
3082 case ACHANNEL_SETTING_SELECT: /* selected */
3083 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
3084 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
3085 if (spk->adt) {
3086 return GET_ACF_FLAG_PTR(spk->adt->flag, r_type);
3087 }
3088 return nullptr;
3089
3090 default: /* unsupported */
3091 return nullptr;
3092 }
3093}
3094
3097 /*channel_type_name*/ "Speaker Expander",
3098 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
3099
3100 /*get_backdrop_color*/ acf_generic_dataexpand_color,
3101 /*get_channel_color*/ nullptr,
3102 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
3103 /*get_indent_level*/ acf_generic_indentation_1,
3104 /*get_offset*/ acf_generic_basic_offset,
3105
3106 /*name*/ acf_generic_idblock_name,
3107 /*name_prop*/ acf_generic_idblock_name_prop,
3108 /*icon*/ acf_dsspk_icon,
3109
3111 /*setting_flag*/ acf_dsspk_setting_flag,
3112 /*setting_ptr*/ acf_dsspk_setting_ptr,
3113 /*setting_post_update*/ nullptr,
3114};
3115
3116/* Curves Expander ------------------------------------------- */
3117
3118/* TODO: just get this from RNA? */
3120{
3121 return ICON_CURVES_DATA;
3122}
3123
3124/* Get the appropriate flag(s) for the setting when it is valid. */
3126 eAnimChannel_Settings setting,
3127 bool *r_neg)
3128{
3129 /* Clear extra return data first. */
3130 *r_neg = false;
3131
3132 switch (setting) {
3133 case ACHANNEL_SETTING_EXPAND: /* expanded */
3134 return VO_DS_EXPAND;
3135
3136 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
3137 return ADT_NLA_EVAL_OFF;
3138
3139 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
3140 *r_neg = true;
3142
3143 case ACHANNEL_SETTING_SELECT: /* selected */
3144 return ADT_UI_SELECTED;
3145
3146 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
3148
3149 default: /* unsupported */
3150 return 0;
3151 }
3152}
3153
3154/* get pointer to the setting */
3156 eAnimChannel_Settings setting,
3157 short *r_type)
3158{
3159 Curves *curves = static_cast<Curves *>(ale->data);
3160
3161 /* Clear extra return data first. */
3162 *r_type = 0;
3163
3164 switch (setting) {
3165 case ACHANNEL_SETTING_EXPAND: /* expanded */
3166 return GET_ACF_FLAG_PTR(curves->flag, r_type);
3167
3168 case ACHANNEL_SETTING_SELECT: /* selected */
3169 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
3170 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
3171 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
3172 if (curves->adt) {
3173 return GET_ACF_FLAG_PTR(curves->adt->flag, r_type);
3174 }
3175 return nullptr;
3176
3177 default: /* unsupported */
3178 return nullptr;
3179 }
3180}
3181
3184 /*channel_type_name*/ "Curves Expander",
3185 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
3186
3187 /*get_backdrop_color*/ acf_generic_dataexpand_color,
3188 /*get_channel_color*/ nullptr,
3189 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
3190 /*get_indent_level*/ acf_generic_indentation_1,
3191 /*get_offset*/ acf_generic_basic_offset,
3192
3193 /*name*/ acf_generic_idblock_name,
3194 /*name_prop*/ acf_generic_idblock_name_prop,
3195 /*icon*/ acf_dscurves_icon,
3196
3198 /*setting_flag*/ acf_dscurves_setting_flag,
3199 /*setting_ptr*/ acf_dscurves_setting_ptr,
3200 /*setting_post_update*/ nullptr,
3201};
3202
3203/* PointCloud Expander ------------------------------------------- */
3204
3205/* TODO: just get this from RNA? */
3207{
3208 return ICON_POINTCLOUD_DATA;
3209}
3210
3211/* Get the appropriate flag(s) for the setting when it is valid. */
3213 eAnimChannel_Settings setting,
3214 bool *r_neg)
3215{
3216 /* Clear extra return data first. */
3217 *r_neg = false;
3218
3219 switch (setting) {
3220 case ACHANNEL_SETTING_EXPAND: /* expanded */
3221 return VO_DS_EXPAND;
3222
3223 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
3224 return ADT_NLA_EVAL_OFF;
3225
3226 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
3227 *r_neg = true;
3229
3230 case ACHANNEL_SETTING_SELECT: /* selected */
3231 return ADT_UI_SELECTED;
3232
3233 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
3235
3236 default: /* unsupported */
3237 return 0;
3238 }
3239}
3240
3241/* get pointer to the setting */
3243 eAnimChannel_Settings setting,
3244 short *r_type)
3245{
3246 PointCloud *pointcloud = static_cast<PointCloud *>(ale->data);
3247
3248 /* Clear extra return data first. */
3249 *r_type = 0;
3250
3251 switch (setting) {
3252 case ACHANNEL_SETTING_EXPAND: /* expanded */
3253 return GET_ACF_FLAG_PTR(pointcloud->flag, r_type);
3254
3255 case ACHANNEL_SETTING_SELECT: /* selected */
3256 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
3257 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
3258 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
3259 if (pointcloud->adt) {
3260 return GET_ACF_FLAG_PTR(pointcloud->adt->flag, r_type);
3261 }
3262 return nullptr;
3263
3264 default: /* unsupported */
3265 return nullptr;
3266 }
3267}
3268
3271 /*channel_type_name*/ "PointCloud Expander",
3272 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
3273
3274 /*get_backdrop_color*/ acf_generic_dataexpand_color,
3275 /*get_channel_color*/ nullptr,
3276 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
3277 /*get_indent_level*/ acf_generic_indentation_1,
3278 /*get_offset*/ acf_generic_basic_offset,
3279
3280 /*name*/ acf_generic_idblock_name,
3281 /*name_prop*/ acf_generic_idblock_name_prop,
3282 /*icon*/ acf_dspointcloud_icon,
3283
3285 /*setting_flag*/ acf_dspointcloud_setting_flag,
3286 /*setting_ptr*/ acf_dspointcloud_setting_ptr,
3287 /*setting_post_update*/ nullptr,
3288};
3289
3290/* Volume Expander ------------------------------------------- */
3291
3292/* TODO: just get this from RNA? */
3294{
3295 return ICON_VOLUME_DATA;
3296}
3297
3298/* Get the appropriate flag(s) for the setting when it is valid. */
3300 eAnimChannel_Settings setting,
3301 bool *r_neg)
3302{
3303 /* Clear extra return data first. */
3304 *r_neg = false;
3305
3306 switch (setting) {
3307 case ACHANNEL_SETTING_EXPAND: /* expanded */
3308 return VO_DS_EXPAND;
3309
3310 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
3311 return ADT_NLA_EVAL_OFF;
3312
3313 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
3314 *r_neg = true;
3316
3317 case ACHANNEL_SETTING_SELECT: /* selected */
3318 return ADT_UI_SELECTED;
3319
3320 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
3322
3323 default: /* unsupported */
3324 return 0;
3325 }
3326}
3327
3328/* get pointer to the setting */
3330 eAnimChannel_Settings setting,
3331 short *r_type)
3332{
3333 Volume *volume = static_cast<Volume *>(ale->data);
3334
3335 /* Clear extra return data first. */
3336 *r_type = 0;
3337
3338 switch (setting) {
3339 case ACHANNEL_SETTING_EXPAND: /* expanded */
3340 return GET_ACF_FLAG_PTR(volume->flag, r_type);
3341
3342 case ACHANNEL_SETTING_SELECT: /* selected */
3343 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
3344 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
3345 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
3346 if (volume->adt) {
3347 return GET_ACF_FLAG_PTR(volume->adt->flag, r_type);
3348 }
3349 return nullptr;
3350
3351 default: /* unsupported */
3352 return nullptr;
3353 }
3354}
3355
3358 /*channel_type_name*/ "Volume Expander",
3359 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
3360
3361 /*get_backdrop_color*/ acf_generic_dataexpand_color,
3362 /*get_channel_color*/ nullptr,
3363 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
3364 /*get_indent_level*/ acf_generic_indentation_1,
3365 /*get_offset*/ acf_generic_basic_offset,
3366
3367 /*name*/ acf_generic_idblock_name,
3368 /*name_prop*/ acf_generic_idblock_name_prop,
3369 /*icon*/ acf_dsvolume_icon,
3370
3372 /*setting_flag*/ acf_dsvolume_setting_flag,
3373 /*setting_ptr*/ acf_dsvolume_setting_ptr,
3374 /*setting_post_update*/ nullptr,
3375};
3376
3377/* LightProbe Expander ------------------------------------------- */
3378
3379/* TODO: just get this from RNA? */
3381{
3382 const LightProbe *probe = static_cast<LightProbe *>(ale->data);
3383 switch (probe->type) {
3385 return ICON_LIGHTPROBE_SPHERE;
3387 return ICON_LIGHTPROBE_PLANE;
3389 return ICON_LIGHTPROBE_VOLUME;
3390 default:
3391 return ICON_LIGHTPROBE_SPHERE;
3392 }
3393}
3394
3395/* Get the appropriate flag(s) for the setting when it is valid. */
3397 eAnimChannel_Settings setting,
3398 bool *r_neg)
3399{
3400 /* Clear extra return data first. */
3401 *r_neg = false;
3402
3403 switch (setting) {
3404 case ACHANNEL_SETTING_EXPAND: /* expanded */
3405 return LIGHTPROBE_DS_EXPAND;
3406
3407 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
3408 return ADT_NLA_EVAL_OFF;
3409
3410 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
3411 *r_neg = true;
3413
3414 case ACHANNEL_SETTING_SELECT: /* selected */
3415 return ADT_UI_SELECTED;
3416
3417 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
3419
3420 default: /* unsupported */
3421 return 0;
3422 }
3423}
3424
3425/* get pointer to the setting */
3427 eAnimChannel_Settings setting,
3428 short *r_type)
3429{
3430 LightProbe *probe = static_cast<LightProbe *>(ale->data);
3431
3432 /* Clear extra return data first. */
3433 *r_type = 0;
3434
3435 switch (setting) {
3436 case ACHANNEL_SETTING_EXPAND: /* expanded */
3437 return GET_ACF_FLAG_PTR(probe->flag, r_type);
3438
3439 case ACHANNEL_SETTING_SELECT: /* selected */
3440 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
3441 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
3442 case ACHANNEL_SETTING_ALWAYS_VISIBLE: /* pin */
3443 if (probe->adt) {
3444 return GET_ACF_FLAG_PTR(probe->adt->flag, r_type);
3445 }
3446 return nullptr;
3447
3448 default: /* unsupported */
3449 return nullptr;
3450 }
3451}
3452
3455 /*channel_type_name*/ "LightProbe Expander",
3456 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
3457
3458 /*get_backdrop_color*/ acf_generic_dataexpand_color,
3459 /*get_channel_color*/ nullptr,
3460 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
3461 /*get_indent_level*/ acf_generic_indentation_1,
3462 /*get_offset*/ acf_generic_basic_offset,
3463
3464 /*name*/ acf_generic_idblock_name,
3465 /*name_prop*/ acf_generic_idblock_name_prop,
3466 /*icon*/ acf_dslightprobe_icon,
3467
3469 /*setting_flag*/ acf_dslightprobe_setting_flag,
3470 /*setting_ptr*/ acf_dslightprobe_setting_ptr,
3471 /*setting_post_update*/ nullptr,
3472};
3473
3474/* GPencil Expander ------------------------------------------- */
3475
3476/* TODO: just get this from RNA? */
3478{
3479 return ICON_OUTLINER_DATA_GREASEPENCIL;
3480}
3481
3482/* Get the appropriate flag(s) for the setting when it is valid. */
3484 eAnimChannel_Settings setting,
3485 bool *r_neg)
3486{
3487 /* Clear extra return data first. */
3488 *r_neg = false;
3489
3490 switch (setting) {
3491 case ACHANNEL_SETTING_EXPAND: /* expanded */
3492 return GP_DATA_EXPAND;
3493
3494 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
3495 return ADT_NLA_EVAL_OFF;
3496
3497 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
3498 *r_neg = true;
3500
3501 case ACHANNEL_SETTING_SELECT: /* selected */
3502 return ADT_UI_SELECTED;
3503
3504 default: /* unsupported */
3505 return 0;
3506 }
3507}
3508
3509/* get pointer to the setting */
3511 eAnimChannel_Settings setting,
3512 short *r_type)
3513{
3514 bGPdata *gpd = static_cast<bGPdata *>(ale->data);
3515
3516 /* Clear extra return data first. */
3517 *r_type = 0;
3518
3519 switch (setting) {
3520 case ACHANNEL_SETTING_EXPAND: /* expanded */
3521 return GET_ACF_FLAG_PTR(gpd->flag, r_type);
3522
3523 case ACHANNEL_SETTING_SELECT: /* selected */
3524 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
3525 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
3526 if (gpd->adt) {
3527 return GET_ACF_FLAG_PTR(gpd->adt->flag, r_type);
3528 }
3529 return nullptr;
3530
3531 default: /* unsupported */
3532 return nullptr;
3533 }
3534}
3535
3538 /*channel_type_name*/ "GPencil DS Expander",
3539 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
3540
3541 /*get_backdrop_color*/ acf_generic_dataexpand_color,
3542 /*get_channel_color*/ nullptr,
3543 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
3544 /*get_indent_level*/ acf_generic_indentation_1,
3545 /*get_offset*/ acf_generic_basic_offset,
3546
3547 /*name*/ acf_generic_idblock_name,
3548 /*name_prop*/ acf_generic_idblock_name_prop,
3549 /*icon*/ acf_dsgpencil_icon,
3550
3552 /*setting_flag*/ acf_dsgpencil_setting_flag,
3553 /*setting_ptr*/ acf_dsgpencil_setting_ptr,
3554 /*setting_post_update*/ nullptr,
3555};
3556
3557/* World Expander ------------------------------------------- */
3558
3559/* TODO: just get this from RNA? */
3560static int acf_dsmclip_icon(bAnimListElem * /*ale*/)
3561{
3562 return ICON_SEQUENCE;
3563}
3564
3565/* Get the appropriate flag(s) for the setting when it is valid. */
3567 eAnimChannel_Settings setting,
3568 bool *r_neg)
3569{
3570 /* Clear extra return data first. */
3571 *r_neg = false;
3572
3573 switch (setting) {
3574 case ACHANNEL_SETTING_EXPAND: /* expanded */
3575 return MCLIP_DATA_EXPAND;
3576
3577 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
3578 return ADT_NLA_EVAL_OFF;
3579
3580 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
3581 *r_neg = true;
3583
3584 case ACHANNEL_SETTING_SELECT: /* selected */
3585 return ADT_UI_SELECTED;
3586
3587 default: /* unsupported */
3588 return 0;
3589 }
3590}
3591
3592/* get pointer to the setting */
3594 eAnimChannel_Settings setting,
3595 short *r_type)
3596{
3597 MovieClip *clip = static_cast<MovieClip *>(ale->data);
3598
3599 /* Clear extra return data first. */
3600 *r_type = 0;
3601
3602 switch (setting) {
3603 case ACHANNEL_SETTING_EXPAND: /* expanded */
3604 return GET_ACF_FLAG_PTR(clip->flag, r_type);
3605
3606 case ACHANNEL_SETTING_SELECT: /* selected */
3607 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
3608 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
3609 if (clip->adt != nullptr) {
3610 return GET_ACF_FLAG_PTR(clip->adt->flag, r_type);
3611 }
3612 return nullptr;
3613
3614 default: /* unsupported */
3615 return nullptr;
3616 }
3617}
3618
3621 /*channel_type_name*/ "Movieclip Expander",
3622 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
3623
3624 /*get_backdrop_color*/ acf_generic_dataexpand_color,
3625 /*get_channel_color*/ nullptr,
3626 /*draw_backdrop*/ acf_generic_dataexpand_backdrop,
3627 /*get_indent_level*/ acf_generic_indentation_1,
3628 /*get_offset*/ acf_generic_basic_offset,
3629
3630 /*name*/ acf_generic_idblock_name,
3631 /*name_prop*/ acf_generic_idfill_name_prop,
3632 /*icon*/ acf_dsmclip_icon,
3633
3635 /*setting_flag*/ acf_dsmclip_setting_flag,
3636 /*setting_ptr*/ acf_dsmclip_setting_ptr,
3637 /*setting_post_update*/ nullptr,
3638};
3639
3640/* ShapeKey Entry ------------------------------------------- */
3641
3642/* name for ShapeKey */
3643static void acf_shapekey_name(bAnimListElem *ale, char *name)
3644{
3645 KeyBlock *kb = static_cast<KeyBlock *>(ale->data);
3646
3647 /* just copy the name... */
3648 if (kb && name) {
3649 /* if the KeyBlock had a name, use it, otherwise use the index */
3650 if (kb->name[0]) {
3652 }
3653 else {
3655 }
3656 }
3657}
3658
3659/* name property for ShapeKey entries */
3661{
3662 KeyBlock *kb = static_cast<KeyBlock *>(ale->data);
3663
3664 /* if the KeyBlock had a name, use it, otherwise use the index */
3665 if (kb && kb->name[0]) {
3666 *r_ptr = RNA_pointer_create_discrete(ale->id, &RNA_ShapeKey, kb);
3667 *r_prop = RNA_struct_name_property(r_ptr->type);
3668
3669 return (*r_prop != nullptr);
3670 }
3671
3672 return false;
3673}
3674
3675/* check if some setting exists for this channel */
3677 bAnimListElem * /*ale*/,
3678 eAnimChannel_Settings setting)
3679{
3680 switch (setting) {
3681 case ACHANNEL_SETTING_SELECT: /* selected */
3682 case ACHANNEL_SETTING_MUTE: /* muted */
3683 case ACHANNEL_SETTING_PROTECT: /* protected */
3684 return true;
3685
3686 /* nothing else is supported */
3687 default:
3688 return false;
3689 }
3690}
3691
3692/* Get the appropriate flag(s) for the setting when it is valid. */
3694 eAnimChannel_Settings setting,
3695 bool *r_neg)
3696{
3697 /* Clear extra return data first. */
3698 *r_neg = false;
3699
3700 switch (setting) {
3701 case ACHANNEL_SETTING_MUTE: /* mute */
3702 return KEYBLOCK_MUTE;
3703
3704 case ACHANNEL_SETTING_SELECT: /* selected */
3705 return KEYBLOCK_SEL;
3706
3707 case ACHANNEL_SETTING_PROTECT: /* locked */
3708 return KEYBLOCK_LOCKED;
3709
3710 default: /* unsupported */
3711 return 0;
3712 }
3713}
3714
3715/* get pointer to the setting */
3717 eAnimChannel_Settings setting,
3718 short *r_type)
3719{
3720 KeyBlock *kb = static_cast<KeyBlock *>(ale->data);
3721
3722 /* Clear extra return data first. */
3723 *r_type = 0;
3724
3725 switch (setting) {
3726 case ACHANNEL_SETTING_SELECT: /* selected */
3727 case ACHANNEL_SETTING_MUTE: /* muted */
3728 case ACHANNEL_SETTING_PROTECT: /* protected */
3729 return GET_ACF_FLAG_PTR(kb->flag, r_type);
3730
3731 default: /* unsupported */
3732 return nullptr;
3733 }
3734}
3735
3738 /*channel_type_name*/ "Shape Key",
3739 /*channel_role*/ ACHANNEL_ROLE_CHANNEL,
3740
3741 /*get_backdrop_color*/ acf_generic_channel_color,
3742 /*get_channel_color*/ nullptr,
3743 /*draw_backdrop*/ acf_generic_channel_backdrop,
3744 /*get_indent_level*/ acf_generic_indentation_0,
3745 /*get_offset*/ acf_generic_basic_offset,
3746
3747 /*name*/ acf_shapekey_name,
3748 /*name_prop*/ acf_shapekey_name_prop,
3749 /*icon*/ nullptr,
3750
3751 /*has_setting*/ acf_shapekey_setting_valid,
3752 /*setting_flag*/ acf_shapekey_setting_flag,
3753 /*setting_ptr*/ acf_shapekey_setting_ptr,
3754 /*setting_post_update*/ nullptr,
3755};
3756
3757/* GPencil Datablock (Legacy) ------------------------------------------- */
3758
3759/* TODO: just get this from RNA? */
3760static int acf_gpd_icon(bAnimListElem * /*ale*/)
3761{
3762 return ICON_OUTLINER_DATA_GREASEPENCIL;
3763}
3764
3765/* check if some setting exists for this channel */
3767 bAnimListElem * /*ale*/,
3768 eAnimChannel_Settings setting)
3769{
3770 switch (setting) {
3771 /* only select and expand supported */
3774 return true;
3775
3776 default:
3777 return false;
3778 }
3779}
3780
3781/* GPencil Layer (Legacy) ------------------------------------------- */
3782
3783/* name for grease pencil layer entries */
3785{
3786 bGPDlayer *gpl = static_cast<bGPDlayer *>(ale->data);
3787
3788 if (gpl && name) {
3790 }
3791}
3792
3793/* name property for grease pencil layer entries */
3795{
3796 if (ale->data) {
3797 *r_ptr = RNA_pointer_create_discrete(ale->id, &RNA_AnnotationLayer, ale->data);
3798 *r_prop = RNA_struct_name_property(r_ptr->type);
3799
3800 return (*r_prop != nullptr);
3801 }
3802
3803 return false;
3804}
3805
3806/* check if some setting exists for this channel */
3808 bAnimListElem * /*ale*/,
3809 eAnimChannel_Settings setting)
3810{
3811 switch (setting) {
3812 /* unsupported */
3813 case ACHANNEL_SETTING_EXPAND: /* gpencil layers are more like F-Curves than groups */
3814 case ACHANNEL_SETTING_SOLO: /* nla editor only */
3816 case ACHANNEL_SETTING_PINNED: /* nla actions only */
3817 return false;
3818
3819 /* always available */
3820 default:
3821 return true;
3822 }
3823}
3824
3825/* Get the appropriate flag(s) for the setting when it is valid. */
3827 eAnimChannel_Settings setting,
3828 bool *r_neg)
3829{
3830 /* Clear extra return data first. */
3831 *r_neg = false;
3832
3833 switch (setting) {
3834 case ACHANNEL_SETTING_SELECT: /* selected */
3835 return GP_LAYER_SELECT;
3836
3837 case ACHANNEL_SETTING_MUTE: /* animation muting - similar to frame lock... */
3838 return GP_LAYER_FRAMELOCK;
3839
3840 case ACHANNEL_SETTING_VISIBLE: /* visibility of the layers (NOT muting) */
3841 *r_neg = true;
3842 return GP_LAYER_HIDE;
3843
3844 case ACHANNEL_SETTING_PROTECT: /* protected */
3845 return GP_LAYER_LOCKED;
3846
3847 default: /* unsupported */
3848 return 0;
3849 }
3850}
3851
3852static bool acf_gpl_channel_color(const bAnimListElem *ale, uint8_t r_color[3])
3853{
3854 const bGPDlayer *gpl = static_cast<const bGPDlayer *>(ale->data);
3855 rgb_float_to_uchar(r_color, gpl->color);
3856 return true;
3857}
3858
3859/* get pointer to the setting */
3861 eAnimChannel_Settings /*setting*/,
3862 short *r_type)
3863{
3864 bGPDlayer *gpl = static_cast<bGPDlayer *>(ale->data);
3865
3866 /* all flags are just in gpl->flag for now... */
3867 return GET_ACF_FLAG_PTR(gpl->flag, r_type);
3868}
3869
3872 /*channel_type_name*/ "GPencil Layer",
3873 /*channel_role*/ ACHANNEL_ROLE_CHANNEL,
3874
3875 /*get_backdrop_color*/ acf_generic_channel_color,
3876 /*get_channel_color*/ acf_gpl_channel_color,
3877 /*draw_backdrop*/ acf_generic_channel_backdrop,
3878 /*get_indent_level*/ acf_generic_indentation_flexible,
3879 /*get_offset*/ acf_generic_group_offset,
3880
3881 /*name*/ acf_gpl_name_legacy,
3882 /*name_prop*/ acf_gpl_name_prop_legacy,
3883 /*icon*/ nullptr,
3884
3885 /*has_setting*/ acf_gpl_setting_valid_legacy,
3886 /*setting_flag*/ acf_gpl_setting_flag_legacy,
3887 /*setting_ptr*/ acf_gpl_setting_ptr_legacy,
3888 /*setting_post_update*/ nullptr,
3889};
3890
3891/* Grease Pencil Animation functions ------------------------------------------- */
3892
3894
3895/* Get pointer to the setting */
3897 eAnimChannel_Settings /*setting*/,
3898 short *r_type)
3899{
3900 GreasePencil *grease_pencil = (GreasePencil *)ale->data;
3901
3902 return GET_ACF_FLAG_PTR(grease_pencil->flag, r_type);
3903}
3904static void datablock_color(bAnimContext *ac, bAnimListElem * /*ale*/, float r_color[3])
3905{
3906 if (ac->datatype == ANIMCONT_GPENCIL) {
3908 }
3909 else {
3911 }
3912}
3913
3914/* Get the appropriate flag(s) for the setting when it is valid. */
3916 eAnimChannel_Settings setting,
3917 bool *r_neg)
3918{
3919 /* Clear extra return data first. */
3920 *r_neg = false;
3921
3922 switch (setting) {
3923 case ACHANNEL_SETTING_SELECT: /* Selected */
3924 return AGRP_SELECTED;
3925
3926 case ACHANNEL_SETTING_EXPAND: /* Expanded */
3928
3929 default:
3930 /* This shouldn't happen */
3931 BLI_assert_msg(true, "Unexpected channel flag");
3932 return 0;
3933 }
3934}
3935
3936/* Offset of the channel, defined by its depth in the tree hierarchy. */
3938{
3939 GreasePencilLayerTreeNode *node = static_cast<GreasePencilLayerTreeNode *>(ale->data);
3940
3941 short offset = acf_generic_basic_offset(ac, ale);
3942 offset += node->wrap().depth() * short(0.7f * U.widget_unit);
3943
3944 return offset;
3945}
3946
3947/* Name for grease pencil layer entries. */
3948static void layer_name(bAnimListElem *ale, char *name)
3949{
3950 GreasePencilLayer *layer = static_cast<GreasePencilLayer *>(ale->data);
3951
3952 if (layer && name) {
3953 BLI_strncpy_utf8(name, layer->wrap().name().c_str(), ANIM_CHAN_NAME_SIZE);
3954 }
3955}
3956
3957/* Name property for grease pencil layer entries.
3958 * Common for layers & layer groups.
3959 */
3960static bool layer_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
3961{
3962 if (ale->data == nullptr) {
3963 return false;
3964 }
3965
3966 *r_ptr = RNA_pointer_create_discrete(ale->id, &RNA_GreasePencilLayer, ale->data);
3967 *r_prop = RNA_struct_name_property(r_ptr->type);
3968
3969 return (*r_prop != nullptr);
3970}
3971
3973 bAnimListElem * /*ale*/,
3974 eAnimChannel_Settings setting)
3975{
3976 switch (setting) {
3978 case ACHANNEL_SETTING_SOLO: /* NLA editor only. */
3980 case ACHANNEL_SETTING_PINNED: /* NLA actions only. */
3981 return false;
3982
3983 default:
3984 return true;
3985 }
3986}
3987
3988/* Get the appropriate flag(s) for the setting when it is valid.
3989 * Common for layers & layer groups.
3990 */
3991static int layer_setting_flag(bAnimContext * /*ac*/, eAnimChannel_Settings setting, bool *r_neg)
3992{
3993 /* Clear extra return data first. */
3994 *r_neg = false;
3995
3996 switch (setting) {
3997 case ACHANNEL_SETTING_SELECT: /* Layer selected. */
3999
4000 case ACHANNEL_SETTING_MUTE: /* Animation muting. */
4002
4003 case ACHANNEL_SETTING_VISIBLE: /* Visibility of the layers. */
4004 *r_neg = true;
4006
4007 case ACHANNEL_SETTING_PROTECT: /* Layer locked. */
4009
4010 case ACHANNEL_SETTING_EXPAND: /* Layer expanded (for layer groups). */
4012
4013 default: /* Unsupported. */
4014 return 0;
4015 }
4016}
4017/* Get pointer to the setting. */
4019 eAnimChannel_Settings /*setting*/,
4020 short *r_type)
4021{
4022 GreasePencilLayer *layer = static_cast<GreasePencilLayer *>(ale->data);
4023 return GET_ACF_FLAG_PTR(layer->base.flag, r_type);
4024}
4025
4026static bool layer_channel_color(const bAnimListElem *ale, uint8_t r_color[3])
4027{
4028 using namespace bke::greasepencil;
4029 GreasePencilLayerTreeNode &node = *static_cast<GreasePencilLayerTreeNode *>(ale->data);
4030 rgb_float_to_uchar(r_color, node.color);
4031 return true;
4032}
4033
4035{
4036 using namespace bke::greasepencil;
4037 const LayerGroup &group = *static_cast<LayerGroup *>(ale->data);
4038 int icon = ICON_GREASEPENCIL_LAYER_GROUP;
4039 if (group.color_tag != LAYERGROUP_COLOR_NONE) {
4040 icon = ICON_LAYERGROUP_COLOR_01 + group.color_tag;
4041 }
4042 return icon;
4043}
4044
4045static void layer_group_color(bAnimContext * /*ac*/, bAnimListElem * /*ale*/, float r_color[3])
4046{
4047 UI_GetThemeColor3fv(TH_GROUP, r_color);
4048}
4049
4050/* Name for grease pencil layer entries */
4051static void layer_group_name(bAnimListElem *ale, char *name)
4052{
4053 GreasePencilLayerTreeGroup *layer_group = static_cast<GreasePencilLayerTreeGroup *>(ale->data);
4054
4055 if (layer_group && name) {
4056 BLI_strncpy_utf8(name, layer_group->wrap().name().c_str(), ANIM_CHAN_NAME_SIZE);
4057 }
4058}
4059
4060/* Get pointer to the setting. */
4062 eAnimChannel_Settings /*setting*/,
4063 short *r_type)
4064{
4065 GreasePencilLayerTreeGroup *layer_group = static_cast<GreasePencilLayerTreeGroup *>(ale->data);
4066 return GET_ACF_FLAG_PTR(layer_group->base.flag, r_type);
4067}
4068
4069/* Check if some setting exists for this channel. */
4071 bAnimListElem * /*ale*/,
4072 eAnimChannel_Settings setting)
4073{
4074 switch (setting) {
4079 return true;
4080
4081 default:
4082 return false;
4083 }
4084}
4085
4086} // namespace blender::ed::animation::greasepencil
4087
4088using namespace blender::ed::animation;
4089
4090/* Grease Pencil Datablock ------------------------------------------- */
4092 /*channel_type_name*/ "Grease Pencil Datablock",
4093 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
4094
4095 /*get_backdrop_color*/ greasepencil::datablock_color,
4096 /*get_channel_color*/ nullptr,
4097 /*draw_backdrop*/ acf_group_backdrop,
4098 /*get_indent_level*/ acf_generic_indentation_1,
4099 /*get_offset*/ acf_generic_basic_offset,
4100
4101 /*name*/ acf_generic_idblock_name,
4102 /*name_prop*/ acf_generic_idfill_name_prop,
4103 /*icon*/ acf_gpd_icon,
4104
4105 /*has_setting*/ acf_gpd_setting_valid,
4108 /*setting_post_update*/ nullptr,
4109};
4110
4111/* Grease Pencil Layer ------------------------------------------- */
4113 /*channel_type_name*/ "Grease Pencil Layer",
4114 /*channel_role*/ ACHANNEL_ROLE_CHANNEL,
4115
4116 /*get_backdrop_color*/ acf_generic_channel_color,
4117 /*get_channel_color*/ greasepencil::layer_channel_color,
4118 /*draw_backdrop*/ acf_generic_channel_backdrop,
4119 /*get_indent_level*/ acf_generic_indentation_flexible,
4120 /*get_offset*/ greasepencil::layer_offset,
4121
4122 /*name*/ greasepencil::layer_name,
4123 /*name_prop*/ greasepencil::layer_name_prop,
4124 /*icon*/ nullptr,
4125
4126 /*has_setting*/ greasepencil::layer_setting_valid,
4127 /*setting_flag*/ greasepencil::layer_setting_flag,
4128 /*setting_ptr*/ greasepencil::layer_setting_ptr,
4129 /*setting_post_update*/ nullptr,
4130};
4131
4132/* Grease Pencil Layer Group -------------------------------- */
4134 /*channel_type_name*/ "Grease Pencil Layer Group",
4135 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
4136
4137 /*get_backdrop_color*/ greasepencil::layer_group_color,
4138 /*get_channel_color*/ greasepencil::layer_channel_color,
4139 /*draw_backdrop*/ acf_group_backdrop,
4140 /*get_indent_level*/ acf_generic_indentation_0,
4141 /*get_offset*/ greasepencil::layer_offset,
4142
4144 /*name_prop*/ greasepencil::layer_name_prop,
4146
4148 /*setting_flag*/ greasepencil::layer_setting_flag,
4150 /*setting_post_update*/ nullptr,
4151};
4152
4153/* Mask Datablock ------------------------------------------- */
4154
4155/* get backdrop color for mask datablock widget */
4156static void acf_mask_color(bAnimContext * /*ac*/, bAnimListElem * /*ale*/, float r_color[3])
4157{
4158 /* these are ID-blocks, but not exactly standalone... */
4160}
4161
4162/* TODO: just get this from RNA? */
4163static int acf_mask_icon(bAnimListElem * /*ale*/)
4164{
4165 return ICON_MOD_MASK;
4166}
4167
4168/* check if some setting exists for this channel */
4170 bAnimListElem * /*ale*/,
4171 eAnimChannel_Settings setting)
4172{
4173 switch (setting) {
4174 /* only select and expand supported */
4177 return true;
4178
4179 default:
4180 return false;
4181 }
4182}
4183
4184/* Get the appropriate flag(s) for the setting when it is valid. */
4185static int acf_mask_setting_flag(bAnimContext * /*ac*/, eAnimChannel_Settings setting, bool *r_neg)
4186{
4187 /* Clear extra return data first. */
4188 *r_neg = false;
4189
4190 switch (setting) {
4191 case ACHANNEL_SETTING_SELECT: /* selected */
4192 return AGRP_SELECTED;
4193
4194 case ACHANNEL_SETTING_EXPAND: /* expanded */
4195 return MASK_ANIMF_EXPAND;
4196
4197 default:
4198 /* this shouldn't happen */
4199 return 0;
4200 }
4201}
4202
4203/* get pointer to the setting */
4205 eAnimChannel_Settings /*setting*/,
4206 short *r_type)
4207{
4208 Mask *mask = static_cast<Mask *>(ale->data);
4209
4210 /* all flags are just in mask->flag for now... */
4211 return GET_ACF_FLAG_PTR(mask->flag, r_type);
4212}
4213
4216 /*channel_type_name*/ "Mask Datablock",
4217 /*channel_role*/ ACHANNEL_ROLE_EXPANDER,
4218
4219 /*get_backdrop_color*/ acf_mask_color,
4220 /*get_channel_color*/ nullptr,
4221 /*draw_backdrop*/ acf_group_backdrop,
4222 /*get_indent_level*/ acf_generic_indentation_0,
4223 /*get_offset*/ acf_generic_group_offset,
4224
4225 /*name*/ acf_generic_idblock_name,
4226 /*name_prop*/ acf_generic_idfill_name_prop,
4227 /*icon*/ acf_mask_icon,
4228
4229 /*has_setting*/ acf_mask_setting_valid,
4230 /*setting_flag*/ acf_mask_setting_flag,
4231 /*setting_ptr*/ acf_mask_setting_ptr,
4232 /*setting_post_update*/ nullptr,
4233};
4234
4235/* Mask Layer ------------------------------------------- */
4236
4237/* name for grease pencil layer entries */
4238static void acf_masklay_name(bAnimListElem *ale, char *name)
4239{
4240 MaskLayer *masklay = static_cast<MaskLayer *>(ale->data);
4241
4242 if (masklay && name) {
4244 }
4245}
4246
4247/* name property for grease pencil layer entries */
4249{
4250 if (ale->data) {
4251 *r_ptr = RNA_pointer_create_discrete(ale->id, &RNA_MaskLayer, ale->data);
4252 *r_prop = RNA_struct_name_property(r_ptr->type);
4253
4254 return (*r_prop != nullptr);
4255 }
4256
4257 return false;
4258}
4259
4260/* check if some setting exists for this channel */
4262 bAnimListElem * /*ale*/,
4263 eAnimChannel_Settings setting)
4264{
4265 switch (setting) {
4266 /* unsupported */
4267 case ACHANNEL_SETTING_EXPAND: /* mask layers are more like F-Curves than groups */
4268 case ACHANNEL_SETTING_VISIBLE: /* graph editor only */
4269 case ACHANNEL_SETTING_SOLO: /* nla editor only */
4271 case ACHANNEL_SETTING_PINNED: /* nla actions only */
4273 return false;
4274
4275 /* always available */
4276 default:
4277 return true;
4278 }
4279}
4280
4281/* Get the appropriate flag(s) for the setting when it is valid. */
4283 eAnimChannel_Settings setting,
4284 bool *r_neg)
4285{
4286 /* Clear extra return data first. */
4287 *r_neg = false;
4288
4289 switch (setting) {
4290 case ACHANNEL_SETTING_SELECT: /* selected */
4291 return MASK_LAYERFLAG_SELECT;
4292
4293 case ACHANNEL_SETTING_PROTECT: /* protected */
4294 return MASK_LAYERFLAG_LOCKED;
4295
4296 default: /* unsupported */
4297 return 0;
4298 }
4299}
4300
4301/* get pointer to the setting */
4303 eAnimChannel_Settings /*setting*/,
4304 short *r_type)
4305{
4306 MaskLayer *masklay = static_cast<MaskLayer *>(ale->data);
4307
4308 /* all flags are just in masklay->flag for now... */
4309 return GET_ACF_FLAG_PTR(masklay->flag, r_type);
4310}
4311
4314 /*channel_type_name*/ "Mask Layer",
4315 /*channel_role*/ ACHANNEL_ROLE_CHANNEL,
4316
4317 /*get_backdrop_color*/ acf_generic_channel_color,
4318 /*get_channel_color*/ nullptr,
4319 /*draw_backdrop*/ acf_generic_channel_backdrop,
4320 /*get_indent_level*/ acf_generic_indentation_flexible,
4321 /*get_offset*/ acf_generic_group_offset,
4322
4323 /*name*/ acf_masklay_name,
4324 /*name_prop*/ acf_masklay_name_prop,
4325 /*icon*/ nullptr,
4326
4327 /*has_setting*/ acf_masklay_setting_valid,
4328 /*setting_flag*/ acf_masklay_setting_flag,
4329 /*setting_ptr*/ acf_masklay_setting_ptr,
4330 /*setting_post_update*/ nullptr,
4331};
4332
4333/* NLA Track ----------------------------------------------- */
4334
4335/* get backdrop color for nla track channels */
4336static void acf_nlatrack_color(bAnimContext * /*ac*/, bAnimListElem *ale, float r_color[3])
4337{
4338 NlaTrack *nlt = static_cast<NlaTrack *>(ale->data);
4339 AnimData *adt = ale->adt;
4340 bool nonSolo = false;
4341
4342 /* is track enabled for solo drawing? */
4343 if ((adt) && (adt->flag & ADT_NLA_SOLO_TRACK)) {
4344 if ((nlt->flag & NLATRACK_SOLO) == 0) {
4345 /* tag for special non-solo handling */
4346 nonSolo = true;
4347 }
4348 }
4349
4350 /* set color for nla track */
4351 UI_GetThemeColorShade3fv(TH_NLA_TRACK, ((nonSolo == false) ? 20 : -20), r_color);
4352}
4353
4354/* name for nla track entries */
4355static void acf_nlatrack_name(bAnimListElem *ale, char *name)
4356{
4357 NlaTrack *nlt = static_cast<NlaTrack *>(ale->data);
4358
4359 if (nlt && name) {
4361 }
4362}
4363
4364/* name property for nla track entries */
4366{
4367 if (ale->data) {
4368 *r_ptr = RNA_pointer_create_discrete(ale->id, &RNA_NlaTrack, ale->data);
4369 *r_prop = RNA_struct_name_property(r_ptr->type);
4370
4371 return (*r_prop != nullptr);
4372 }
4373
4374 return false;
4375}
4376
4377/* check if some setting exists for this channel */
4379 bAnimListElem *ale,
4380 eAnimChannel_Settings setting)
4381{
4382 NlaTrack *nlt = static_cast<NlaTrack *>(ale->data);
4383 AnimData *adt = ale->adt;
4384
4385 /* visibility of settings depends on various states... */
4386 switch (setting) {
4387 /* always supported */
4390 return true;
4391
4392 /* conditionally supported... */
4395 /* if this track is active and we're tweaking it, don't draw these toggles */
4396 if (((nlt->flag & NLATRACK_ACTIVE) && (nlt->flag & NLATRACK_DISABLED)) == 0) {
4397 /* is track enabled for solo drawing? */
4398 if ((adt) && (adt->flag & ADT_NLA_SOLO_TRACK)) {
4399 if (nlt->flag & NLATRACK_SOLO) {
4400 /* ok - we've got a solo track, and this is it */
4401 return true;
4402 }
4403 /* not ok - we've got a solo track, but this isn't it, so make it more obvious */
4404 return false;
4405 }
4406
4407 /* Ok - no tracks are soloed, and this isn't being tweaked. */
4408 return true;
4409 }
4410 /* unsupported - this track is being tweaked */
4411 return false;
4412
4413 /* unsupported */
4414 default:
4415 return false;
4416 }
4417}
4418
4419/* Get the appropriate flag(s) for the setting when it is valid. */
4421 eAnimChannel_Settings setting,
4422 bool *neg)
4423{
4424 /* Clear extra return data first. */
4425 *neg = false;
4426
4427 switch (setting) {
4428 case ACHANNEL_SETTING_SELECT: /* selected */
4429 return NLATRACK_SELECTED;
4430
4431 case ACHANNEL_SETTING_MUTE: /* muted */
4432 return NLATRACK_MUTED;
4433
4434 case ACHANNEL_SETTING_PROTECT: /* protected */
4435 return NLATRACK_PROTECTED;
4436
4437 case ACHANNEL_SETTING_SOLO: /* solo */
4438 return NLATRACK_SOLO;
4439
4440 default: /* unsupported */
4441 return 0;
4442 }
4443}
4444
4445/* get pointer to the setting */
4447 eAnimChannel_Settings /*setting*/,
4448 short *r_type)
4449{
4450 NlaTrack *nlt = static_cast<NlaTrack *>(ale->data);
4451 return GET_ACF_FLAG_PTR(nlt->flag, r_type);
4452}
4453
4455 const bAnimListElem & /*ale*/,
4456 const eAnimChannel_Settings setting)
4457{
4458 switch (setting) {
4461 /* Changing these settings can change whether data-blocks are animated at all. */
4463 break;
4464
4472 break;
4473 }
4474}
4475
4478 /*channel_type_name*/ "NLA Track",
4479 /*channel_role*/ ACHANNEL_ROLE_CHANNEL,
4480
4481 /*get_backdrop_color*/ acf_nlatrack_color,
4482 /*get_channel_color*/ nullptr,
4483 /*draw_backdrop*/ acf_generic_channel_backdrop,
4484 /*get_indent_level*/ acf_generic_indentation_flexible,
4485 /*get_offset*/ acf_generic_group_offset, /* XXX? */
4486
4487 /*name*/ acf_nlatrack_name,
4488 /*name_prop*/ acf_nlatrack_name_prop,
4489 /*icon*/ nullptr,
4490
4491 /*has_setting*/ acf_nlatrack_setting_valid,
4492 /*setting_flag*/ acf_nlatrack_setting_flag,
4493 /*setting_ptr*/ acf_nlatrack_setting_ptr,
4494 /*setting_post_update*/ acf_nlatrack_setting_post_update,
4495};
4496
4497/* NLA Action ----------------------------------------------- */
4498
4499/* icon for action depends on whether it's in tweaking mode */
4501{
4502 AnimData *adt = ale->adt;
4503
4504 /* indicate tweaking-action state by changing the icon... */
4505 if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) {
4506 return ICON_ACTION_TWEAK;
4507 }
4508
4509 return ICON_ACTION;
4510}
4511
4512/* Backdrop color for nla action track
4513 * Although this can't be used directly for NLA Action drawing,
4514 * it is still needed for use behind the RHS toggles
4515 */
4516static void acf_nlaaction_color(bAnimContext * /*ac*/, bAnimListElem *ale, float r_color[3])
4517{
4518 float color[4];
4519
4520 /* Action Line
4521 * The alpha values action_get_color returns are only useful for drawing
4522 * strips backgrounds but here we're doing track list backgrounds instead
4523 * so we ignore that and use our own when needed
4524 */
4525 nla_action_get_color(ale->adt, static_cast<bAction *>(ale->data), color);
4526
4527 /* NOTE: since the return types only allow rgb, we cannot do the alpha-blending we'd
4528 * like for the solo-drawing case. Hence, this method isn't actually used for drawing
4529 * most of the track...
4530 */
4531 copy_v3_v3(r_color, color);
4532}
4533
4534/* backdrop for nla action track */
4535static void acf_nlaaction_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
4536{
4538 View2D *v2d = &ac->region->v2d;
4539 AnimData *adt = ale->adt;
4540 short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
4541 float color[4];
4542
4543 /* Action Line
4544 * The alpha values action_get_color returns are only useful for drawing
4545 * strips backgrounds but here we're doing track list backgrounds instead
4546 * so we ignore that and use our own when needed
4547 */
4548 nla_action_get_color(adt, (bAction *)ale->data, color);
4549
4550 if (adt && (adt->flag & ADT_NLA_EDIT_ON)) {
4551 color[3] = 1.0f;
4552 }
4553 else {
4554 color[3] = (adt && (adt->flag & ADT_NLA_SOLO_TRACK)) ? 0.3f : 1.0f;
4555 }
4556
4557 /* only on top left corner, to show that this track sits on top of the preceding ones
4558 * while still linking into the action line strip to the right
4559 */
4561
4562 /* draw slightly shifted up vertically to look like it has more separation from other tracks,
4563 * but we then need to slightly shorten it so that it doesn't look like it overlaps
4564 */
4565 rctf box;
4566 box.xmin = offset;
4567 box.xmax = v2d->cur.xmax;
4568 box.ymin = yminc + NLATRACK_SKIP;
4569 box.ymax = ymaxc + NLATRACK_SKIP - 1;
4570 UI_draw_roundbox_4fv(&box, true, 8, color);
4571}
4572
4573/* name for nla action entries */
4574static void acf_nlaaction_name(bAnimListElem *ale, char *name)
4575{
4576 bAction *act = static_cast<bAction *>(ale->data);
4577
4578 if (name) {
4579 if (act) {
4580 /* TODO: add special decoration when doing this in tweaking mode? */
4582 }
4583 else {
4585 }
4586 }
4587}
4588
4589/* name property for nla action entries */
4591{
4592 if (ale->data) {
4593 *r_ptr = RNA_pointer_create_discrete(ale->fcurve_owner_id, &RNA_Action, ale->data);
4594 *r_prop = RNA_struct_name_property(r_ptr->type);
4595
4596 return (*r_prop != nullptr);
4597 }
4598
4599 return false;
4600}
4601
4602/* check if some setting exists for this track */
4604 bAnimListElem *ale,
4605 eAnimChannel_Settings setting)
4606{
4607 AnimData *adt = ale->adt;
4608
4609 /* visibility of settings depends on various states... */
4610 switch (setting) {
4611 /* conditionally supported */
4612 case ACHANNEL_SETTING_PINNED: /* pinned - map/unmap */
4613 if ((adt) && (adt->flag & ADT_NLA_EDIT_ON)) {
4614 /* This should only appear in tweak-mode. */
4615 return true;
4616 }
4617 else {
4618 return false;
4619 }
4620 case ACHANNEL_SETTING_SELECT: /* selected */
4621 return true;
4622
4623 /* unsupported */
4624 default:
4625 return false;
4626 }
4627}
4628
4629/* Get the appropriate flag(s) for the setting when it is valid. */
4631 eAnimChannel_Settings setting,
4632 bool *r_neg)
4633{
4634 /* Clear extra return data first. */
4635 *r_neg = false;
4636
4637 switch (setting) {
4638 case ACHANNEL_SETTING_PINNED: /* pinned - map/unmap */
4639 *r_neg = true; /* XXX */
4640 return ADT_NLA_EDIT_NOMAP;
4641
4642 case ACHANNEL_SETTING_SELECT: /* selected */
4643 return ADT_UI_SELECTED;
4644
4645 default: /* unsupported */
4646 return 0;
4647 }
4648}
4649
4650/* get pointer to the setting */
4652 eAnimChannel_Settings /*setting*/,
4653 short *r_type)
4654{
4655 AnimData *adt = ale->adt;
4656 return GET_ACF_FLAG_PTR(adt->flag, r_type);
4657}
4658
4659/* nla action type define */
4661 /*channel_type_name*/ "NLA Active Action",
4662 /*channel_role*/ ACHANNEL_ROLE_CHANNEL,
4663 /* NOTE: the backdrop handles this too, since it needs special hacks. */
4664 /*get_backdrop_color*/ acf_nlaaction_color,
4665 /*get_channel_color*/ nullptr,
4666
4667 /*draw_backdrop*/ acf_nlaaction_backdrop,
4668 /*get_indent_level*/ acf_generic_indentation_flexible,
4669 /*get_offset*/ acf_generic_group_offset, /* XXX? */
4670
4671 /*name*/ acf_nlaaction_name,
4672 /*name_prop*/ acf_nlaaction_name_prop,
4673 /*icon*/ acf_nlaaction_icon,
4674
4675 /*has_setting*/ acf_nlaaction_setting_valid,
4676 /*setting_flag*/ acf_nlaaction_setting_flag,
4677 /*setting_ptr*/ acf_nlaaction_setting_ptr,
4678 /*setting_post_update*/ nullptr,
4679};
4680
4681/* *********************************************** */
4682/* Type Registration and General Access */
4683
4684/* These globals only ever get directly accessed in this file */
4686static short ACF_INIT = 1; /* when non-zero, the list needs to be updated */
4687
4688/* Initialize type info definitions */
4690{
4691 int type = 0;
4692
4693 /* start initializing if necessary... */
4694 if (ACF_INIT) {
4695 ACF_INIT = 0;
4696
4697 /* NOTE: need to keep the order of these synchronized with the definition of
4698 * channel types (eAnim_ChannelType) in ED_anim_api.hh
4699 */
4700 animchannelTypeInfo[type++] = nullptr; /* None */
4701 animchannelTypeInfo[type++] = nullptr; /* AnimData */
4702 animchannelTypeInfo[type++] = nullptr; /* Special */
4703
4704 animchannelTypeInfo[type++] = &ACF_SUMMARY; /* Motion Summary */
4705
4706 animchannelTypeInfo[type++] = &ACF_SCENE; /* Scene */
4707 animchannelTypeInfo[type++] = &ACF_OBJECT; /* Object */
4708 animchannelTypeInfo[type++] = &ACF_GROUP; /* Group */
4709 animchannelTypeInfo[type++] = &ACF_FCURVE; /* F-Curve */
4710
4711 animchannelTypeInfo[type++] = &ACF_NLACONTROLS; /* NLA Control FCurve Expander */
4712 animchannelTypeInfo[type++] = &ACF_NLACURVE; /* NLA Control FCurve Channel */
4713
4714 animchannelTypeInfo[type++] = &ACF_FILLANIM; /* Object's Layered Action Expander */
4715 animchannelTypeInfo[type++] = &ACF_ACTION_SLOT; /* Action Slot Expander */
4716 animchannelTypeInfo[type++] = &ACF_FILLACTD; /* Object Action Expander */
4717 animchannelTypeInfo[type++] = &ACF_FILLDRIVERS; /* Drivers Expander */
4718
4719 animchannelTypeInfo[type++] = &ACF_DSMAT; /* Material Channel */
4720 animchannelTypeInfo[type++] = &ACF_DSLIGHT; /* Light Channel */
4721 animchannelTypeInfo[type++] = &ACF_DSCAM; /* Camera Channel */
4722 animchannelTypeInfo[type++] = &ACF_DSCACHEFILE; /* CacheFile Channel */
4723 animchannelTypeInfo[type++] = &ACF_DSCUR; /* Curve Channel */
4724 animchannelTypeInfo[type++] = &ACF_DSSKEY; /* ShapeKey Channel */
4725 animchannelTypeInfo[type++] = &ACF_DSWOR; /* World Channel */
4726 animchannelTypeInfo[type++] = &ACF_DSNTREE; /* NodeTree Channel */
4727 animchannelTypeInfo[type++] = &ACF_DSPART; /* Particle Channel */
4728 animchannelTypeInfo[type++] = &ACF_DSMBALL; /* MetaBall Channel */
4729 animchannelTypeInfo[type++] = &ACF_DSARM; /* Armature Channel */
4730 animchannelTypeInfo[type++] = &ACF_DSMESH; /* Mesh Channel */
4731 animchannelTypeInfo[type++] = &ACF_DSTEX; /* Texture Channel */
4732 animchannelTypeInfo[type++] = &ACF_DSLAT; /* Lattice Channel */
4733 animchannelTypeInfo[type++] = &ACF_DSLINESTYLE; /* LineStyle Channel */
4734 animchannelTypeInfo[type++] = &ACF_DSSPK; /* Speaker Channel */
4735 animchannelTypeInfo[type++] = &ACF_DSGPENCIL; /* GreasePencil Channel */
4736 animchannelTypeInfo[type++] = &ACF_DSMCLIP; /* MovieClip Channel */
4737 animchannelTypeInfo[type++] = &ACF_DSCURVES; /* Curves Channel */
4738 animchannelTypeInfo[type++] = &ACF_DSPOINTCLOUD; /* PointCloud Channel */
4739 animchannelTypeInfo[type++] = &ACF_DSVOLUME; /* Volume Channel */
4740 animchannelTypeInfo[type++] = &ACF_DSLIGHTPROBE; /* Light Probe */
4741
4742 animchannelTypeInfo[type++] = &ACF_SHAPEKEY; /* ShapeKey */
4743
4744 animchannelTypeInfo[type++] = &ACF_GPL_LEGACY; /* Grease Pencil Layer (Legacy) */
4745
4746 animchannelTypeInfo[type++] = &ACF_GPD; /* Grease Pencil Datablock. */
4747 animchannelTypeInfo[type++] = &ACF_GPLGROUP; /* Grease Pencil Layer Group. */
4748 animchannelTypeInfo[type++] = &ACF_GPL; /* Grease Pencil Layer. */
4749
4750 animchannelTypeInfo[type++] = &ACF_MASKDATA; /* Mask Datablock */
4751 animchannelTypeInfo[type++] = &ACF_MASKLAYER; /* Mask Layer */
4752
4753 animchannelTypeInfo[type++] = &ACF_NLATRACK; /* NLA Track */
4754 animchannelTypeInfo[type++] = &ACF_NLAACTION; /* NLA Action */
4755
4757 "ANIMTYPE_FILLACT_LAYERED does not match ACF_FILLANIM");
4759 "ANIMTYPE_ACTION_SLOT does not match ACF_ACTION_SLOT");
4760 }
4761}
4762
4764{
4765 /* Sanity checks. */
4766 if (ale == nullptr) {
4767 return nullptr;
4768 }
4769
4770 /* init the typeinfo if not available yet... */
4772
4774 if (ale->type >= ANIMTYPE_NUM_TYPES) {
4775 return nullptr;
4776 }
4777
4778 return animchannelTypeInfo[ale->type];
4779}
4780
4781/* --------------------------- */
4782
4784{
4785 switch (setting) {
4787 return "SELECT";
4789 return "PROTECT";
4791 return "MUTE";
4793 return "EXPAND";
4795 return "VISIBLE";
4797 return "SOLO";
4799 return "PINNED";
4801 return "MOD_OFF";
4803 return "ALWAYS_VISIBLE";
4804 }
4805
4806 return "unknown setting";
4807}
4808
4810{
4812
4813 /* print indents */
4814 for (; indent_level > 0; indent_level--) {
4815 printf(" ");
4816 }
4817
4818 /* print info */
4819 if (!ale) {
4820 printf("<Invalid channel - nullptr>\n");
4821 return;
4822 }
4823
4824 if (!acf) {
4825 printf("ChanType: <Unknown - %d>\n", ale->type);
4826 return;
4827 }
4828
4829 /* Get UI name. */
4831 if (acf->name) {
4832 acf->name(ale, name);
4833 }
4834 else {
4835 STRNCPY_UTF8(name, "<No name>");
4836 }
4837
4838 printf("ChanType: <%-25s> Name: \"%s\"\n ", acf->channel_type_name, name);
4839
4840 /* Print settings. */
4851 };
4852 for (const eAnimChannel_Settings setting : settings) {
4853 if (!acf->has_setting(&ac, ale, setting)) {
4854 continue;
4855 }
4856
4857 bool is_neg = false;
4858 const int setting_flag = acf->setting_flag(&ac, setting, &is_neg);
4859
4860 short setting_type = 0;
4861 const void *setting_ptr = acf->setting_ptr(ale, setting, &setting_type);
4862
4863 bool setting_value = false;
4864 switch (setting_type) {
4865 case sizeof(int): {
4866 const int as_int = *static_cast<const int *>(setting_ptr);
4867 setting_value = bool(as_int & setting_flag) != is_neg;
4868 break;
4869 }
4870 case sizeof(short): {
4871 const short as_short = *static_cast<const short *>(setting_ptr);
4872 setting_value = bool(as_short & short(setting_flag)) != is_neg;
4873 break;
4874 }
4875 default:
4877 }
4878
4879 std::string show_name = setting_name(setting);
4880 if (!setting_value) {
4881 BLI_str_tolower_ascii(show_name.data(), show_name.length());
4882 }
4883 printf("%-15s", show_name.c_str());
4884 }
4885 printf("\n");
4886}
4887
4889{
4890 if (ale->datatype == ALE_ACT) {
4891 return static_cast<bAction *>(ale->key_data);
4892 }
4893
4895 ID *owner = ale->fcurve_owner_id;
4896
4897 if (owner && GS(owner->name) == ID_AC) {
4898 return reinterpret_cast<bAction *>(owner);
4899 }
4900 }
4901
4902 return nullptr;
4903}
4904
4905/* --------------------------- */
4906
4908{
4910
4911 /* 1) check that the setting exists for the current context */
4912 if ((acf) && (!acf->has_setting || acf->has_setting(ac, ale, setting))) {
4913 /* 2) get pointer to check for flag in, and the flag to check for */
4914 short ptrsize;
4915 bool negflag;
4916 int flag;
4917 void *ptr;
4918
4919 flag = acf->setting_flag(ac, setting, &negflag);
4920 ptr = acf->setting_ptr(ale, setting, &ptrsize);
4921
4922 /* check if flag is enabled */
4923 if (ptr && flag) {
4924 switch (ptrsize) {
4925 case sizeof(int): /* integer pointer for setting */
4926 {
4927 const int *val = (int *)ptr;
4928
4929 if (negflag) {
4930 return ((*val) & flag) == 0;
4931 }
4932 return ((*val) & flag) != 0;
4933 }
4934 case sizeof(short): /* short pointer for setting */
4935 {
4936 const short *val = (short *)ptr;
4937
4938 if (negflag) {
4939 return ((*val) & flag) == 0;
4940 }
4941 return ((*val) & flag) != 0;
4942 }
4943 case sizeof(char): /* char pointer for setting */
4944 {
4945 const char *val = (char *)ptr;
4946
4947 if (negflag) {
4948 return ((*val) & flag) == 0;
4949 }
4950 return ((*val) & flag) != 0;
4951 }
4952 }
4953 }
4954 }
4955
4956 /* not found... */
4957 return -1;
4958}
4959
4960/* Quick macro for use in ANIM_channel_setting_set -
4961 * set flag for setting according the mode given. */
4962#define ACF_SETTING_SET(sval, sflag, smode) \
4963 { \
4964 if (negflag) { \
4965 if (smode == ACHANNEL_SETFLAG_INVERT) { \
4966 (sval) ^= (sflag); \
4967 } \
4968 else if (smode == ACHANNEL_SETFLAG_ADD) { \
4969 (sval) &= ~(sflag); \
4970 } \
4971 else { \
4972 (sval) |= (sflag); \
4973 } \
4974 } \
4975 else { \
4976 if (smode == ACHANNEL_SETFLAG_INVERT) { \
4977 (sval) ^= (sflag); \
4978 } \
4979 else if (smode == ACHANNEL_SETFLAG_ADD) { \
4980 (sval) |= (sflag); \
4981 } \
4982 else { \
4983 (sval) &= ~(sflag); \
4984 } \
4985 } \
4986 } \
4987 (void)0
4988
4990 bAnimListElem *ale,
4991 eAnimChannel_Settings setting,
4993{
4995
4996 /* 1) check that the setting exists for the current context */
4997 if ((acf) && (!acf->has_setting || acf->has_setting(ac, ale, setting))) {
4998 /* 2) get pointer to check for flag in, and the flag to check for */
4999 short ptrsize;
5000 bool negflag;
5001 int flag;
5002 void *ptr;
5003
5004 flag = acf->setting_flag(ac, setting, &negflag);
5005 ptr = acf->setting_ptr(ale, setting, &ptrsize);
5006
5007 /* check if flag is enabled */
5008 if (ptr && flag) {
5009 switch (ptrsize) {
5010 case sizeof(int): /* integer pointer for setting */
5011 {
5012 int *val = (int *)ptr;
5013 ACF_SETTING_SET(*val, flag, mode);
5014 break;
5015 }
5016 case sizeof(short): /* short pointer for setting */
5017 {
5018 short *val = (short *)ptr;
5019 ACF_SETTING_SET(*val, flag, mode);
5020 break;
5021 }
5022 case sizeof(char): /* char pointer for setting */
5023 {
5024 char *val = (char *)ptr;
5025 ACF_SETTING_SET(*val, flag, mode);
5026 break;
5027 }
5028 }
5029
5030 if (acf->setting_post_update) {
5031 BLI_assert(ale);
5032 BLI_assert(ac->bmain);
5033 acf->setting_post_update(*ac->bmain, *ale, setting);
5034 }
5035 }
5036 }
5037}
5038
5039/* --------------------------- */
5040
5042#define ICON_WIDTH (0.85f * U.widget_unit)
5044#define SLIDER_WIDTH (4 * U.widget_unit)
5046#define RENAME_TEXT_MIN_WIDTH (U.widget_unit)
5048#define GRAPH_COLOR_BAND_WIDTH (0.3f * U.widget_unit)
5050#define GRAPH_ICON_VISIBILITY_OFFSET (GRAPH_COLOR_BAND_WIDTH * 1.5f)
5051
5052#define CHANNEL_COLOR_RECT_WIDTH (0.5f * ICON_WIDTH)
5053#define CHANNEL_COLOR_RECT_MARGIN (2.0f * UI_SCALE_FAC)
5054
5055/* Helper - Check if a channel needs renaming */
5057 const bAnimChannelType *acf,
5058 size_t channel_index)
5059{
5060 if (acf->name_prop && ac->ads) {
5061 /* if rename index matches, this channel is being renamed */
5062 if (ac->ads->renameIndex == channel_index + 1) {
5063 return true;
5064 }
5065 }
5066
5067 /* not being renamed */
5068 return false;
5069}
5070
5076{
5077 BLI_assert(ale->bmain != nullptr);
5078 if (ale->bmain == nullptr) {
5079 return false;
5080 }
5081
5082 switch (ale->type) {
5083 case ANIMTYPE_ACTION_SLOT: {
5084 const animrig::Slot &slot = static_cast<const ActionSlot *>(ale->data)->wrap();
5085
5086 return slot.users(*ale->bmain).is_empty();
5087 }
5088
5089 case ANIMTYPE_GROUP:
5090 case ANIMTYPE_FCURVE: {
5091 if (ale->fcurve_owner_id == nullptr || GS(ale->fcurve_owner_id->name) != ID_AC) {
5092 return false;
5093 }
5094
5095 const animrig::Action &action =
5096 reinterpret_cast<const bAction *>(ale->fcurve_owner_id)->wrap();
5097 if (action.is_action_legacy()) {
5098 return false;
5099 }
5100
5101 const animrig::Slot *slot = action.slot_for_handle(ale->slot_handle);
5102 if (slot == nullptr) {
5103 return false;
5104 }
5105
5106 return slot->users(*ale->bmain).is_empty();
5107 }
5108
5109 /* No other types are currently drawn as children of action slots. */
5110 default:
5111 return false;
5112 }
5113}
5114
5116static bool achannel_is_broken(const bAnimListElem *ale)
5117{
5118 switch (ale->type) {
5119 case ANIMTYPE_FCURVE:
5120 case ANIMTYPE_NLACURVE: {
5121 const FCurve *fcu = static_cast<const FCurve *>(ale->data);
5122
5123 /* The channel is disabled (has a bad rna path), or it's a driver that failed to evaluate. */
5124 return (fcu->flag & FCURVE_DISABLED) ||
5125 (fcu->driver != nullptr && (fcu->driver->flag & DRIVER_FLAG_INVALID));
5126 }
5127 default:
5128 return false;
5129 }
5130}
5131
5133{
5134 bTheme *btheme = UI_GetTheme();
5135 const float yscale_fac = btheme->space_action.keyframe_scale_fac;
5136
5137 /* clamp to avoid problems with uninitialized values... */
5138 if (yscale_fac < 0.1f) {
5139 return 1.0f;
5140 }
5141 return yscale_fac;
5142}
5143
5145{
5146 return 0.8f * ANIM_UI_get_keyframe_scale_factor() * U.widget_unit;
5147}
5148
5150{
5151 return 0.1f * U.widget_unit;
5152}
5153
5158
5163
5164float ANIM_UI_get_channels_total_height(View2D *v2d, const int item_count)
5165{
5166 return -ANIM_UI_get_first_channel_top(v2d) + ANIM_UI_get_channel_step() * (item_count + 1);
5167}
5168
5170{
5171 return 10 * U.widget_unit;
5172}
5173
5175{
5176 return 0.8f * U.widget_unit;
5177}
5178
5180 bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc, size_t channel_index)
5181{
5183 View2D *v2d = &ac->region->v2d;
5184 short selected, offset;
5185 float y, ymid, ytext;
5186
5187 /* sanity checks - don't draw anything */
5188 if (ELEM(nullptr, acf, ale)) {
5189 return;
5190 }
5191
5192 /* get initial offset */
5193 if (acf->get_offset) {
5194 offset = acf->get_offset(ac, ale);
5195 }
5196 else {
5197 offset = 0;
5198 }
5199
5200 /* calculate appropriate y-coordinates for icon buttons */
5201 y = (ymaxc - yminc) / 2 + yminc;
5202 ymid = y - 0.5f * ICON_WIDTH;
5203 /* y-coordinates for text is only 4 down from middle */
5204 ytext = y - 0.2f * U.widget_unit;
5205
5206 /* check if channel is selected */
5207 if (acf->has_setting(ac, ale, ACHANNEL_SETTING_SELECT)) {
5209 }
5210 else {
5211 selected = 0;
5212 }
5213
5214 /* set blending again, as may not be set in previous step */
5216
5217 /* step 1) draw backdrop ........................................... */
5218 if (acf->draw_backdrop) {
5219 acf->draw_backdrop(ac, ale, yminc, ymaxc);
5220 }
5221
5222 /* step 2) draw expand widget ....................................... */
5223 if (acf->has_setting(ac, ale, ACHANNEL_SETTING_EXPAND)) {
5224 /* just skip - drawn as widget now */
5225 offset += ICON_WIDTH;
5226 }
5227 else if (!ELEM(ale->type, ANIMTYPE_FCURVE, ANIMTYPE_NLACURVE)) {
5228 /* A bit of padding when there is no expand widget. */
5229 offset += short(0.2f * U.widget_unit);
5230 }
5231
5232 /* step 3) draw icon ............................................... */
5233 if (acf->icon) {
5234 UI_icon_draw(offset, ymid, acf->icon(ale));
5235 offset += ICON_WIDTH;
5236 }
5237
5238 /* step 4) draw special toggles .................................
5239 * - in Graph Editor, check-boxes for visibility in curves area
5240 * - in NLA Editor, glowing dots for solo/not solo...
5241 * - in Grease Pencil mode, color swatches for layer color
5242 */
5243 if (ac->sl) {
5245 (acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE) ||
5247 !ELEM(ale->type,
5252 {
5253 /* for F-Curves, draw color-preview of curve left to the visibility icon */
5255 FCurve *fcu = static_cast<FCurve *>(ale->data);
5257 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
5258
5260
5261 /* F-Curve channels need to have a special 'color code' box drawn,
5262 * which is colored with whatever color the curve has stored.
5263 */
5264
5265 /* If the curve is hidden, make the rect less opaque. */
5266 float rect_alpha = (fcu->flag & FCURVE_VISIBLE) ? 1 : 0.3f;
5267 immUniformColor3fvAlpha(fcu->color, rect_alpha);
5268
5269 immRectf(pos, offset, yminc, offset + GRAPH_COLOR_BAND_WIDTH, ymaxc);
5271 }
5272
5273 /* turn off blending, since not needed anymore... */
5275
5276 /* icon is drawn as widget now... */
5277 if (acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE)) {
5280 }
5281 else {
5282 offset += ICON_WIDTH;
5283 }
5284 }
5285 if (acf->has_setting(ac, ale, ACHANNEL_SETTING_ALWAYS_VISIBLE)) {
5286 offset += ICON_WIDTH;
5287 }
5288 }
5289 }
5290
5291 /* step 5) draw name ............................................... */
5292 /* Don't draw this if renaming... */
5293 if (acf->name && !achannel_is_being_renamed(ac, acf, channel_index)) {
5294 const uiFontStyle *fstyle = UI_FSTYLE_WIDGET;
5295 char name[ANIM_CHAN_NAME_SIZE]; /* hopefully this will be enough! */
5296 uchar col[4];
5297
5298 /* set text color */
5299 /* XXX: if active, highlight differently? */
5300
5301 if (selected) {
5303 }
5304 else {
5306 }
5307
5308 /* Gray out disconnected action slots and their children. */
5309 if (!selected && achannel_is_part_of_disconnected_slot(ale)) {
5310 col[3] = col[3] / 3 * 2;
5311 }
5312
5313 /* get name */
5314 acf->name(ale, name);
5315
5316 offset += 3;
5317 UI_fontstyle_draw_simple(fstyle, offset, ytext, name, col);
5318
5319 /* draw red underline if channel is disabled */
5320 if (achannel_is_broken(ale)) {
5322 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
5323
5325
5326 /* FIXME: replace hardcoded color here, and check on extents! */
5327 immUniformColor3f(1.0f, 0.0f, 0.0f);
5328
5329 GPU_line_width(2.0f);
5330
5332 immVertex2f(pos, float(offset), yminc);
5333 immVertex2f(pos, v2d->cur.xmax, yminc);
5334 immEnd();
5335
5337 }
5338 }
5339
5340 /* step 6) draw backdrops behind mute+protection toggles + (sliders) ....................... */
5341 /* - Reset offset - now goes from RHS of panel.
5342 * - Exception for graph editor, which needs extra space for the scroll bar.
5343 */
5344 if (ac->spacetype == SPACE_GRAPH &&
5346 {
5347 offset = V2D_SCROLL_WIDTH;
5348 }
5349 else {
5350 offset = 0;
5351 }
5352
5353 /* TODO: when drawing sliders, make those draw instead of these toggles if not enough space */
5354
5355 if (v2d) {
5356 short draw_sliders = 0;
5357 float ymin_ofs = 0.0f;
5358 float color[3];
5360 immVertexFormat(), "pos", blender::gpu::VertAttrType::SFLOAT_32_32);
5361
5363
5364 /* get and set backdrop color */
5365 acf->get_backdrop_color(ac, ale, color);
5367
5368 /* check if we need to show the sliders */
5369 if ((ac->sl) && ELEM(ac->spacetype, SPACE_ACTION, SPACE_GRAPH)) {
5370 switch (ac->spacetype) {
5371 case SPACE_ACTION: {
5372 SpaceAction *saction = reinterpret_cast<SpaceAction *>(ac->sl);
5373 draw_sliders = (saction->flag & SACTION_SLIDERS);
5374 break;
5375 }
5376 case SPACE_GRAPH: {
5377 SpaceGraph *sipo = reinterpret_cast<SpaceGraph *>(ac->sl);
5378 draw_sliders = (sipo->flag & SIPO_SLIDERS);
5379 break;
5380 }
5381 default:
5383 }
5384 }
5385
5386 /* check if there's enough space for the toggles if the sliders are drawn too */
5387 if (!(draw_sliders) || (BLI_rcti_size_x(&v2d->mask) > ANIM_UI_get_channel_button_width() / 2))
5388 {
5389 /* NOTE: The comments here match the comments in ANIM_channel_draw_widgets(), as that
5390 * function and this one are strongly coupled. */
5391
5392 /* Little channel color rectangle. */
5395 }
5396
5397 /* solo... */
5398 if ((ac->spacetype == SPACE_NLA) && acf->has_setting(ac, ale, ACHANNEL_SETTING_SOLO)) {
5399 /* A touch of padding because the star icon is so wide. */
5400 offset += short(1.2f * ICON_WIDTH);
5401 }
5402
5403 /* protect... */
5404 if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
5405 offset += ICON_WIDTH;
5406 }
5407
5408 /* mute... */
5409 if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) {
5410 offset += ICON_WIDTH;
5411 }
5412
5413 /* grease pencil visibility... */
5414 if (ELEM(ale->type,
5418 {
5419 offset += ICON_WIDTH;
5420 }
5421
5422 /* modifiers toggle... */
5423 if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MOD_OFF)) {
5424 offset += ICON_WIDTH;
5425 }
5426
5427 /* pinned... */
5428 if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PINNED)) {
5429 offset += ICON_WIDTH;
5430 }
5431
5432 /* NOTE: technically, NLA Action "pushdown" should be here too,
5433 * but there are no sliders there. */
5434
5435 /* NLA action tracks have slightly different spacing requirements... */
5436 if (ale->type == ANIMTYPE_NLAACTION) {
5437 ymin_ofs = NLATRACK_SKIP;
5438 }
5439 }
5440
5441 /* Draw slider:
5442 * - Even if we can draw sliders for this view,
5443 * we must also check that the channel-type supports them
5444 * (only F-Curves really can support them for now).
5445 * - Slider should start before the toggles (if they're visible)
5446 * to keep a clean line down the side.
5447 */
5448 if ((draw_sliders) && ELEM(ale->type,
5455 {
5456 /* adjust offset */
5457 offset += SLIDER_WIDTH;
5458 }
5459
5460 /* Finally draw a backdrop rect behind these:
5461 * - Starts from the point where the first toggle/slider starts.
5462 * - Ends past the space that might be reserved for a scroller.
5463 */
5464 immRectf(pos,
5465 v2d->cur.xmax - float(offset),
5466 yminc + ymin_ofs,
5467 v2d->cur.xmax + EXTRA_SCROLL_PAD,
5468 ymaxc);
5469
5471 }
5472}
5473
5474/* ------------------ */
5475
5476/* callback for (normal) widget settings - send notifiers */
5477static void achannel_setting_widget_cb(bContext *C, void *ale_npoin, void *setting_wrap)
5478{
5480
5481 const bAnimListElem *ale_setting = static_cast<bAnimListElem *>(ale_npoin);
5482 const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale_setting);
5483 if (!acf) {
5484 /* Any channel with settings should have a type, because it is the type that
5485 * tells the system which settings are supported. */
5487 return;
5488 }
5489
5490 /* When the button in the UI changes the setting, it does NOT call `ANIM_channel_setting_set()`,
5491 * but actually manipulates the data directly via a pointer (see `ui_but_value_set()` in
5492 * `source/blender/editors/interface/interface.cc`).
5493 *
5494 * As a result, `setting_post_update()` was not called yet and we need to call it here. */
5495 if (acf->setting_post_update) {
5496 const eAnimChannel_Settings setting = eAnimChannel_Settings(POINTER_AS_INT(setting_wrap));
5497 Main *bmain = CTX_data_main(C);
5498
5499 BLI_assert(ale_setting);
5500 BLI_assert(bmain);
5501 acf->setting_post_update(*bmain, *ale_setting, setting);
5502 }
5503}
5504
5505/* callback for widget settings that need flushing */
5506static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void *setting_wrap)
5507{
5508 bAnimListElem *ale_setting = static_cast<bAnimListElem *>(ale_npoin);
5509 bAnimContext ac;
5510 ListBase anim_data = {nullptr, nullptr};
5511 int filter;
5512 const eAnimChannel_Settings setting = eAnimChannel_Settings(POINTER_AS_INT(setting_wrap));
5513 short on = 0;
5514
5515 /* Before flushing, just do the regular notification & callback. */
5516 achannel_setting_widget_cb(C, ale_npoin, setting_wrap);
5517
5518 /* verify that we have a channel to operate on. */
5519 if (!ale_setting) {
5520 return;
5521 }
5524 }
5525
5526 if (ale_setting->type == ANIMTYPE_GPLAYER) {
5527 /* draw cache updates for settings that affect the visible strokes */
5528 if (setting == ACHANNEL_SETTING_VISIBLE) {
5529 bGPdata *gpd = reinterpret_cast<bGPdata *>(ale_setting->id);
5531 }
5532
5533 /* UI updates */
5535 }
5536
5537 /* Tag for full animation update, so that the settings will have an effect. */
5538 if (ale_setting->id) {
5540 }
5541 if (ale_setting->adt && ale_setting->adt->action) {
5542 /* Action is its own datablock, so has to be tagged specifically. */
5544 }
5545
5546 /* verify animation context */
5547 if (ANIM_animdata_get_context(C, &ac) == 0) {
5548 return;
5549 }
5550
5551 /* Don't flush setting changes to grease pencil layers in a layer group. */
5552 if (ale_setting->type == ANIMTYPE_GREASE_PENCIL_LAYER_GROUP) {
5553 return;
5554 }
5555
5556 /* check if the setting is on... */
5557 on = ANIM_channel_setting_get(&ac, ale_setting, eAnimChannel_Settings(setting));
5558
5559 /* on == -1 means setting not found... */
5560 if (on == -1) {
5561 return;
5562 }
5563
5564 /* get all channels that can possibly be chosen - but ignore hierarchy */
5567 &ac, &anim_data, eAnimFilter_Flags(filter), ac.data, eAnimCont_Types(ac.datatype));
5568
5569 /* call API method to flush the setting */
5571 &ac, &anim_data, ale_setting, eAnimChannel_Settings(setting), eAnimChannels_SetFlag(on));
5572
5573 /* free temp data */
5574 ANIM_animdata_freelist(&anim_data);
5575}
5576
5577/* callback for wrapping NLA Track "solo" toggle logic */
5578static void achannel_nlatrack_solo_widget_cb(bContext *C, void *ale_poin, void *setting_wrap)
5579{
5580 bAnimListElem *ale = static_cast<bAnimListElem *>(ale_poin);
5581 AnimData *adt = ale->adt;
5582 NlaTrack *nlt = static_cast<NlaTrack *>(ale->data);
5583
5584 /* Before the special handling, just do the regular notification & callback. */
5585 achannel_setting_widget_cb(C, ale_poin, setting_wrap);
5586
5587 /* Toggle 'solo' mode. There are several complications here which need explaining:
5588 * - The method call is needed to perform a few additional validation operations
5589 * to ensure that the mode is applied properly
5590 * - BUT, since the button already toggles the value, we need to un-toggle it
5591 * before the API call gets to it, otherwise it will end up clearing the result
5592 * again!
5593 */
5594 nlt->flag ^= NLATRACK_SOLO;
5595 BKE_nlatrack_solo_toggle(adt, nlt);
5596
5598}
5599
5600/* callback for widget sliders - insert keyframes */
5601static void achannel_setting_slider_cb(bContext *C, void *id_poin, void *fcu_poin)
5602{
5603 ID *id = static_cast<ID *>(id_poin);
5604 AnimData *adt = BKE_animdata_from_id(id);
5605 FCurve *fcu = static_cast<FCurve *>(fcu_poin);
5606
5607 ReportList *reports = CTX_wm_reports(C);
5608 Scene *scene = CTX_data_scene(C);
5610 ToolSettings *ts = scene->toolsettings;
5611 ListBase nla_cache = {nullptr, nullptr};
5613 PropertyRNA *prop;
5615 bool done = false;
5616 float cfra;
5617
5618 /* Get RNA pointer */
5619 PointerRNA id_ptr = RNA_id_pointer_create(id);
5620
5621 /* Get NLA context for value remapping */
5623 depsgraph, float(scene->r.cfra));
5625 &nla_cache, &id_ptr, adt, &anim_eval_context);
5626
5627 /* get current frame and apply NLA-mapping to it (if applicable) */
5628 cfra = BKE_nla_tweakedit_remap(adt, float(scene->r.cfra), NLATIME_CONVERT_UNMAP);
5629
5630 /* Get flags for keyframing. */
5632
5633 /* try to resolve the path stored in the F-Curve */
5634 if (RNA_path_resolve_property(&id_ptr, fcu->rna_path, &ptr, &prop)) {
5635 /* set the special 'replace' flag if on a keyframe */
5638 }
5639
5640 /* insert a keyframe for this F-Curve */
5642 ptr,
5643 prop,
5644 fcu,
5645 &anim_eval_context,
5647 nla_context,
5648 flag);
5649
5650 if (done) {
5651 if (adt->action != nullptr) {
5653 }
5656 }
5657 }
5658
5660}
5661
5662/* callback for shapekey widget sliders - insert keyframes */
5663static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, void *kb_poin)
5664{
5665 Main *bmain = CTX_data_main(C);
5666 Scene *scene = CTX_data_scene(C);
5669 depsgraph, float(scene->r.cfra));
5670
5671 Key *key = static_cast<Key *>(key_poin);
5672 KeyBlock *kb = static_cast<KeyBlock *>(kb_poin);
5673 PointerRNA id_ptr = RNA_id_pointer_create(reinterpret_cast<ID *>(key));
5674 std::optional<std::string> rna_path = BKE_keyblock_curval_rnapath_get(key, kb);
5675
5676 /* Since this is only ever called from moving a slider for an existing
5677 * shapekey in the shapekey animation editor, it shouldn't be possible for the
5678 * RNA path to fail to resolve. */
5679 BLI_assert(rna_path.has_value());
5680
5681 /* TODO: should this use the flags from user settings? For now leaving as-is,
5682 * since it was already this way and might have a reason for it. This is
5683 * basically a UX question about how the shape key animation editor should
5684 * behave. */
5686
5688 &id_ptr,
5689 std::nullopt,
5690 {{*rna_path}},
5691 std::nullopt,
5692 anim_eval_context,
5694 flag);
5695}
5696
5697/* callback for NLA Control Curve widget sliders - insert keyframes */
5698static void achannel_setting_slider_nla_curve_cb(bContext *C, void * /*id_poin*/, void *fcu_poin)
5699{
5700 // ID *id = (ID *)id_poin;
5701 FCurve *fcu = static_cast<FCurve *>(fcu_poin);
5702
5704 PropertyRNA *prop;
5705 int index;
5706
5707 ReportList *reports = CTX_wm_reports(C);
5708 Scene *scene = CTX_data_scene(C);
5709 ToolSettings *ts = scene->toolsettings;
5711 bool done = false;
5712 float cfra;
5713
5714 /* get current frame - *no* NLA mapping should be done */
5715 cfra = float(scene->r.cfra);
5716
5717 /* get flags for keyframing */
5719
5720 /* Get pointer and property from the slider -
5721 * this should all match up with the NlaStrip required. */
5722 UI_context_active_but_prop_get(C, &ptr, &prop, &index);
5723
5724 if (fcu && prop) {
5725 /* set the special 'replace' flag if on a keyframe */
5728 }
5729
5730 /* insert a keyframe for this F-Curve */
5733 cfra);
5735 ptr,
5736 prop,
5737 fcu,
5738 &anim_eval_context,
5740 nullptr,
5741 flag);
5742
5743 if (done) {
5745 }
5746 }
5747}
5748
5749/* Draw a widget for some setting */
5751 bAnimListElem *ale,
5752 const bAnimChannelType *acf,
5753 uiBlock *block,
5754 const int xpos,
5755 const int ypos,
5756 const eAnimChannel_Settings setting)
5757{
5758 bool usetoggle = true;
5759 int icon;
5760 std::optional<StringRef> tooltip;
5761
5762 /* get the flag and the pointer to that flag */
5763 bool negflag;
5764 const int flag = acf->setting_flag(ac, setting, &negflag);
5765
5766 short ptrsize;
5767 void *ptr = acf->setting_ptr(ale, setting, &ptrsize);
5768
5769 if (!ptr || !flag) {
5770 return;
5771 }
5772
5773 const bool enabled = ANIM_channel_setting_get(ac, ale, setting);
5774
5775 /* get the base icon for the setting */
5776 switch (setting) {
5777 case ACHANNEL_SETTING_VISIBLE: /* visibility eyes */
5778 // icon = (enabled ? ICON_HIDE_OFF : ICON_HIDE_ON);
5779 icon = ICON_HIDE_ON;
5780
5782 tooltip = TIP_("F-Curve visibility in Graph Editor");
5783 }
5785 tooltip = TIP_("Grease Pencil layer is visible in the viewport");
5786 }
5787 else {
5788 tooltip = TIP_("Toggle visibility of Channels in Graph Editor for editing");
5789 }
5790 break;
5791
5793 icon = ICON_UNPINNED;
5794 tooltip = TIP_("Display channel regardless of object selection");
5795 break;
5796
5797 case ACHANNEL_SETTING_MOD_OFF: /* modifiers disabled */
5798 icon = ICON_MODIFIER_OFF;
5799 tooltip = TIP_("Enable F-Curve modifiers");
5800 break;
5801
5802 case ACHANNEL_SETTING_EXPAND: /* expanded triangle */
5803 // icon = (enabled ? ICON_TRIA_DOWN : ICON_TRIA_RIGHT);
5804 icon = ICON_RIGHTARROW;
5805 tooltip = TIP_("Make channels grouped under this channel visible");
5806 break;
5807
5808 case ACHANNEL_SETTING_SOLO: /* NLA Tracks only */
5809 // icon = (enabled ? ICON_SOLO_OFF : ICON_SOLO_ON);
5810 icon = ICON_SOLO_OFF;
5811 tooltip = TIP_(
5812 "NLA Track is the only one evaluated in this animation data-block, with all others "
5813 "muted");
5814 break;
5815
5816 /* --- */
5817
5818 case ACHANNEL_SETTING_PROTECT: /* protected lock */
5819 /* TODO: what about when there's no protect needed? */
5820 // icon = (enabled ? ICON_LOCKED : ICON_UNLOCKED);
5821 icon = ICON_UNLOCKED;
5822
5823 if (ale->datatype != ALE_NLASTRIP) {
5824 tooltip = TIP_("Editability of keyframes for this channel");
5825 }
5826 else {
5827 tooltip = TIP_("Editability of NLA Strips in this track");
5828 }
5829 break;
5830
5831 case ACHANNEL_SETTING_MUTE: /* muted speaker */
5832 icon = (enabled ? ICON_CHECKBOX_DEHLT : ICON_CHECKBOX_HLT);
5833 usetoggle = false;
5834
5836 tooltip = TIP_("Does F-Curve contribute to result");
5837 }
5838 else if ((ac) && (ac->spacetype == SPACE_NLA) && (ale->type != ANIMTYPE_NLATRACK)) {
5839 tooltip = TIP_(
5840 "Temporarily disable NLA stack evaluation (i.e. only the active action is evaluated)");
5841 }
5843 tooltip = TIP_(
5844 "Show all keyframes during animation playback and enable all frames for editing "
5845 "(uncheck to use only the current keyframe during animation playback and editing)");
5846 }
5847 else {
5848 tooltip = TIP_("Do channels contribute to result (toggle channel muting)");
5849 }
5850 break;
5851
5852 case ACHANNEL_SETTING_PINNED: /* pin icon */
5853 // icon = (enabled ? ICON_PINNED : ICON_UNPINNED);
5854 icon = ICON_UNPINNED;
5855
5856 if (ale->type == ANIMTYPE_NLAACTION) {
5857 tooltip = TIP_("Display action without any time remapping (when unpinned)");
5858 }
5859 else {
5860 /* TODO: there are no other tools which require the 'pinning' concept yet */
5861 tooltip = std::nullopt;
5862 }
5863 break;
5864
5865 default:
5866 tooltip = std::nullopt;
5867 icon = 0;
5868 break;
5869 }
5870
5871 /* type of button */
5872 ButType butType;
5873 if (usetoggle) {
5874 if (negflag) {
5875 butType = ButType::IconToggleN;
5876 }
5877 else {
5878 butType = ButType::IconToggle;
5879 }
5880 }
5881 else {
5882 if (negflag) {
5883 butType = ButType::ToggleN;
5884 }
5885 else {
5886 butType = ButType::Toggle;
5887 }
5888 }
5889
5890 /* draw button for setting */
5891 uiBut *but = nullptr;
5892 switch (ptrsize) {
5893 case sizeof(int): /* integer pointer for setting */
5894 but = uiDefIconButBitI(block,
5895 butType,
5896 flag,
5897 0,
5898 icon,
5899 xpos,
5900 ypos,
5901 ICON_WIDTH,
5902 ICON_WIDTH,
5903 static_cast<int *>(ptr),
5904 0,
5905 0,
5906 tooltip);
5907 break;
5908
5909 case sizeof(short): /* short pointer for setting */
5910 but = uiDefIconButBitS(block,
5911 butType,
5912 flag,
5913 0,
5914 icon,
5915 xpos,
5916 ypos,
5917 ICON_WIDTH,
5918 ICON_WIDTH,
5919 static_cast<short *>(ptr),
5920 0,
5921 0,
5922 tooltip);
5923 break;
5924
5925 case sizeof(char): /* char pointer for setting */
5926 but = uiDefIconButBitC(block,
5927 butType,
5928 flag,
5929 0,
5930 icon,
5931 xpos,
5932 ypos,
5933 ICON_WIDTH,
5934 ICON_WIDTH,
5935 static_cast<char *>(ptr),
5936 0,
5937 0,
5938 tooltip);
5939 break;
5940 }
5941 if (!but) {
5942 return;
5943 }
5944
5945 /* Set callback to send relevant notifiers and/or perform type-specific updates */
5946 {
5947 uiButHandleNFunc button_callback;
5948 switch (setting) {
5949 /* Settings needing flushing up/down hierarchy. */
5950 case ACHANNEL_SETTING_VISIBLE: /* Graph Editor - "visibility" toggles. */
5951 case ACHANNEL_SETTING_PROTECT: /* General - protection flags. */
5952 case ACHANNEL_SETTING_MUTE: /* General - muting flags. */
5953 case ACHANNEL_SETTING_PINNED: /* NLA Actions - "map/no-map". */
5956 button_callback = achannel_setting_flush_widget_cb;
5957 break;
5958
5959 /* settings needing special attention */
5960 case ACHANNEL_SETTING_SOLO: /* NLA Tracks - Solo toggle */
5961 button_callback = achannel_nlatrack_solo_widget_cb;
5962 break;
5963
5964 /* no flushing */
5965 case ACHANNEL_SETTING_EXPAND: /* expanding - cannot flush,
5966 * otherwise all would open/close at once */
5967 default:
5968 button_callback = achannel_setting_widget_cb;
5969 break;
5970 }
5971 UI_but_funcN_set(but, button_callback, MEM_dupallocN(ale), POINTER_FROM_INT(setting));
5972 }
5973
5974 if ((ale->fcurve_owner_id != nullptr && !BKE_id_is_editable(ac->bmain, ale->fcurve_owner_id)) ||
5975 (ale->fcurve_owner_id == nullptr && ale->id != nullptr &&
5976 !BKE_id_is_editable(ac->bmain, ale->id)))
5977 {
5978 if (setting != ACHANNEL_SETTING_EXPAND) {
5979 UI_but_disable(but, "Cannot edit this property from a linked data-block");
5980 }
5981 }
5982
5983 /* Post-button-creation modifications of the button. */
5984 switch (setting) {
5986 /* Deactivate the button when there are no FCurve modifiers. */
5987 if (ale->datatype == ALE_FCURVE) {
5988 const FCurve *fcu = static_cast<const FCurve *>(ale->key_data);
5989 if (BLI_listbase_is_empty(&fcu->modifiers)) {
5991 }
5992 }
5993 break;
5994
5995 default:
5996 break;
5997 }
5998}
5999
6001 uiBlock *block,
6002 const rctf *rect,
6003 short &offset,
6004 const short channel_height,
6005 const int array_index)
6006{
6007 using namespace blender::bke::greasepencil;
6008 Layer *layer = static_cast<Layer *>(ale->data);
6009
6010 if (layer == nullptr) {
6011 return;
6012 }
6013
6014 /* Reset slider offset, in order to add special grease pencil icons. */
6015 offset += SLIDER_WIDTH;
6016
6017 /* Create the RNA pointers. */
6018 PointerRNA ptr = RNA_pointer_create_discrete(ale->id, &RNA_GreasePencilLayer, ale->data);
6019 PointerRNA id_ptr = RNA_id_pointer_create(ale->id);
6020
6021 /* Layer onion skinning switch. */
6022 offset -= ICON_WIDTH;
6024 PropertyRNA *onion_skinning_prop = RNA_struct_find_property(&ptr, "use_onion_skinning");
6025
6026 const std::optional<std::string> onion_skinning_rna_path = RNA_path_from_ID_to_property(
6027 &ptr, onion_skinning_prop);
6029 &id_ptr, onion_skinning_rna_path->c_str(), &ptr, &onion_skinning_prop))
6030 {
6031 uiDefAutoButR(block,
6032 &ptr,
6033 onion_skinning_prop,
6034 array_index,
6035 "",
6036 ICON_ONIONSKIN_OFF,
6037 offset,
6038 rect->ymin,
6039 ICON_WIDTH,
6040 channel_height);
6041 }
6042
6043 /* Mask layer. */
6044 offset -= ICON_WIDTH;
6046 PropertyRNA *layer_mask_prop = RNA_struct_find_property(&ptr, "use_masks");
6047
6048 const std::optional<std::string> layer_mask_rna_path = RNA_path_from_ID_to_property(
6049 &ptr, layer_mask_prop);
6050 if (RNA_path_resolve_property(&id_ptr, layer_mask_rna_path->c_str(), &ptr, &layer_mask_prop)) {
6051 uiDefAutoButR(block,
6052 &ptr,
6053 layer_mask_prop,
6054 array_index,
6055 "",
6056 ICON_CLIPUV_HLT,
6057 offset,
6058 rect->ymin,
6059 ICON_WIDTH,
6060 channel_height);
6061 }
6062
6063 /* Layer opacity. */
6064 const short width = SLIDER_WIDTH * 0.6;
6065 offset -= width;
6067 PropertyRNA *opacity_prop = RNA_struct_find_property(&ptr, "opacity");
6068 const std::optional<std::string> opacity_rna_path = RNA_path_from_ID_to_property(&ptr,
6069 opacity_prop);
6070 if (RNA_path_resolve_property(&id_ptr, opacity_rna_path->c_str(), &ptr, &opacity_prop)) {
6071 uiDefAutoButR(block,
6072 &ptr,
6073 opacity_prop,
6074 array_index,
6075 "",
6076 ICON_NONE,
6077 offset,
6078 rect->ymin,
6079 width,
6080 channel_height);
6081 }
6082}
6083
6085 bAnimContext *ac,
6086 bAnimListElem *ale,
6087 uiBlock *block,
6088 const rctf *rect,
6089 size_t channel_index)
6090{
6092 View2D *v2d = &ac->region->v2d;
6093 float ymid;
6094 const short channel_height = round_fl_to_int(BLI_rctf_size_y(rect));
6095 const bool is_being_renamed = achannel_is_being_renamed(ac, acf, channel_index);
6096
6097 /* sanity checks - don't draw anything */
6098 if (ELEM(nullptr, acf, ale, block)) {
6099 return;
6100 }
6101
6102 /* get initial offset */
6103 short offset = rect->xmin;
6104 if (acf->get_offset) {
6105 offset += acf->get_offset(ac, ale);
6106 }
6107
6108 /* calculate appropriate y-coordinates for icon buttons */
6109 ymid = BLI_rctf_cent_y(rect) - 0.5f * ICON_WIDTH;
6110
6111 /* no button backdrop behind icons */
6113
6114 /* step 1) draw expand widget ....................................... */
6115 if (acf->has_setting(ac, ale, ACHANNEL_SETTING_EXPAND)) {
6116 draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_EXPAND);
6117 offset += ICON_WIDTH;
6118 }
6119
6120 /* step 2) draw icon ............................................... */
6121 if (acf->icon) {
6122 /* icon is not drawn here (not a widget) */
6123 offset += ICON_WIDTH;
6124 }
6125
6126 /* step 3) draw special toggles .................................
6127 * - in Graph Editor, check-boxes for visibility in curves area
6128 * - in NLA Editor, glowing dots for solo/not solo...
6129 * - in Grease Pencil mode, color swatches for layer color
6130 */
6131 if (ac->sl) {
6133 (acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE) ||
6135 !ELEM(ale->type,
6139 {
6140 /* Pin toggle. */
6141 if (acf->has_setting(ac, ale, ACHANNEL_SETTING_ALWAYS_VISIBLE)) {
6142 draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_ALWAYS_VISIBLE);
6143 offset += ICON_WIDTH;
6144 }
6145 /* Visibility toggle. */
6146 if (acf->has_setting(ac, ale, ACHANNEL_SETTING_VISIBLE)) {
6147 /* For F-Curves, add the extra space for the color bands. */
6150 }
6151 draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_VISIBLE);
6152 offset += ICON_WIDTH;
6153 }
6154 }
6155 }
6156
6157 /* step 4) draw text - check if renaming widget is in use... */
6158 if (is_being_renamed) {
6159 PointerRNA ptr = {};
6160 PropertyRNA *prop = nullptr;
6161
6162 /* draw renaming widget if we can get RNA pointer for it
6163 * NOTE: property may only be available in some cases, even if we have
6164 * a callback available (e.g. broken F-Curve rename)
6165 */
6166 if (acf->name_prop(ale, &ptr, &prop)) {
6167 const short margin_x = 3 * round_fl_to_int(UI_SCALE_FAC);
6168 const short width = ac->region->winx - offset - (margin_x * 2);
6169 uiBut *but;
6170
6172
6173 but = uiDefButR(block,
6175 1,
6176 "",
6177 offset + margin_x,
6178 rect->ymin,
6179 std::max(width, RENAME_TEXT_MIN_WIDTH),
6180 channel_height,
6181 &ptr,
6183 -1,
6184 0,
6185 0,
6186 std::nullopt);
6187
6188 /* copy what outliner does here, see outliner_buttons */
6189 if (UI_but_active_only(C, ac->region, block, but) == false) {
6190 ac->ads->renameIndex = 0;
6191
6192 /* send notifiers */
6194 }
6195
6197 }
6198 else {
6199 /* Cannot get property/cannot or rename for some reason, so clear rename index
6200 * so that this doesn't hang around, and the name can be drawn normally - #47492
6201 */
6202 ac->ads->renameIndex = 0;
6204 }
6205 }
6206
6207 /* step 5) draw mute+protection toggles + (sliders) ....................... */
6208 /* reset offset - now goes from RHS of panel */
6209 offset = int(rect->xmax);
6210
6211 /* TODO: when drawing sliders, make those draw instead of these toggles if not enough space. */
6212 if (!is_being_renamed) {
6213 short draw_sliders = 0;
6214
6215 /* check if we need to show the sliders */
6216 if ((ac->sl) && ELEM(ac->spacetype, SPACE_ACTION, SPACE_GRAPH)) {
6217 switch (ac->spacetype) {
6218 case SPACE_ACTION: {
6219 SpaceAction *saction = reinterpret_cast<SpaceAction *>(ac->sl);
6220 draw_sliders = (saction->flag & SACTION_SLIDERS);
6221 break;
6222 }
6223 case SPACE_GRAPH: {
6224 SpaceGraph *sipo = reinterpret_cast<SpaceGraph *>(ac->sl);
6225 draw_sliders = (sipo->flag & SIPO_SLIDERS);
6226 break;
6227 }
6228 default:
6230 }
6231 }
6232
6233 /* check if there's enough space for the toggles if the sliders are drawn too */
6234 if (!(draw_sliders) || (BLI_rcti_size_x(&v2d->mask) > ANIM_UI_get_channel_button_width() / 2))
6235 {
6236 /* NOTE: The comments here match the comments in ANIM_channel_draw(), as that
6237 * function and this one are strongly coupled. */
6238
6239 /* Little channel color rectangle. */
6240 const bool show_group_colors = acf_show_channel_colors();
6241 if (show_group_colors) {
6243 const float rect_margin = CHANNEL_COLOR_RECT_MARGIN;
6244 uint8_t color[3];
6245 if (acf->get_channel_color && acf->get_channel_color(ale, color)) {
6248
6249 GPUVertFormat format = {0};
6250 uint pos = GPU_vertformat_attr_add(&format, "pos", gpu::VertAttrType::SFLOAT_32_32);
6251 immRectf(pos,
6252 rect->xmax - rect_width - rect_margin,
6253 rect->ymin + rect_margin,
6254 rect->xmax - rect_margin,
6255 rect->ymax - rect_margin);
6256
6258 }
6259 offset -= rect_width + 2 * rect_margin;
6260 }
6261
6262 /* solo... */
6263 if ((ac->spacetype == SPACE_NLA) && acf->has_setting(ac, ale, ACHANNEL_SETTING_SOLO)) {
6264 offset -= ICON_WIDTH;
6265 draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_SOLO);
6266 /* A touch of padding because the star icon is so wide. */
6267 offset -= short(0.2f * ICON_WIDTH);
6268 }
6269 /* protect... */
6270 if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PROTECT)) {
6271 offset -= ICON_WIDTH;
6272 if (ale->type == ANIMTYPE_FCURVE) {
6273 FCurve *fcu = static_cast<FCurve *>(ale->data);
6274 /* Don't draw lock icon when curve is baked.
6275 * Still using the offset so icons are aligned. */
6276 if (fcu->bezt) {
6277 draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_PROTECT);
6278 }
6279 }
6280 else {
6281 draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_PROTECT);
6282 }
6283 }
6284 /* mute... */
6285 if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MUTE)) {
6286 offset -= ICON_WIDTH;
6287 draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_MUTE);
6288 }
6289 if (ELEM(ale->type,
6293 {
6294 /* Not technically "mute"
6295 * (in terms of anim channels, but this sets layer visibility instead). */
6296 offset -= ICON_WIDTH;
6297 draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_VISIBLE);
6298 }
6299
6300 /* modifiers disable */
6301 if (acf->has_setting(ac, ale, ACHANNEL_SETTING_MOD_OFF)) {
6302 offset -= ICON_WIDTH;
6303 draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_MOD_OFF);
6304 }
6305
6306 /* ----------- */
6307
6308 /* pinned... */
6309 if (acf->has_setting(ac, ale, ACHANNEL_SETTING_PINNED)) {
6310 offset -= ICON_WIDTH;
6311 draw_setting_widget(ac, ale, acf, block, offset, ymid, ACHANNEL_SETTING_PINNED);
6312 }
6313
6314 /* NLA Action "pushdown" */
6315 if ((ale->type == ANIMTYPE_NLAACTION) && (ale->adt && ale->adt->action) &&
6316 !(ale->adt->flag & ADT_NLA_EDIT_ON))
6317 {
6318 uiBut *but;
6319 PointerRNA *opptr_b;
6320
6322
6323 offset -= UI_UNIT_X;
6324 but = uiDefIconButO(block,
6326 "NLA_OT_action_pushdown",
6328 ICON_NLA_PUSHDOWN,
6329 offset,
6330 ymid,
6331 UI_UNIT_X,
6332 UI_UNIT_X,
6333 std::nullopt);
6334
6335 opptr_b = UI_but_operator_ptr_ensure(but);
6336 RNA_int_set(opptr_b, "track_index", channel_index);
6337
6339 }
6340
6341 /* Slot ID type indicator. */
6342 if (ale->type == ANIMTYPE_ACTION_SLOT) {
6343 offset -= ICON_WIDTH;
6344 UI_icon_draw(offset, ymid, acf_action_slot_idtype_icon(ale));
6345 }
6346 }
6347
6348 /* Draw slider:
6349 * - Even if we can draw sliders for this view, we must also check that the channel-type
6350 * supports them (only F-Curves really can support them for now).
6351 * - To make things easier, we use RNA-auto-buttons for this so that changes are
6352 * reflected immediately, wherever they occurred.
6353 * BUT, we don't use the layout engine, otherwise we'd get wrong alignment,
6354 * and wouldn't be able to auto-keyframe.
6355 * - Slider should start before the toggles (if they're visible)
6356 * to keep a clean line down the side.
6357 * - Sliders are always drawn in Shape-key mode now. Prior to this
6358 * the SACTION_SLIDERS flag would be set when changing into shape-key mode.
6359 */
6360 if (((draw_sliders) && ELEM(ale->type,
6367 ale->type == ANIMTYPE_SHAPEKEY)
6368 {
6369 /* adjust offset */
6370 /* TODO: make slider width dynamic,
6371 * so that they can be easier to use when the view is wide enough. */
6372 offset -= SLIDER_WIDTH;
6373
6374 /* need backdrop behind sliders... */
6376
6377 if (ale->owner) { /* Slider using custom RNA Access ---------- */
6378 if (ale->type == ANIMTYPE_NLACURVE) {
6379 NlaStrip *strip = static_cast<NlaStrip *>(ale->owner);
6380 FCurve *fcu = static_cast<FCurve *>(ale->data);
6381 PropertyRNA *prop;
6382
6383 /* create RNA pointers */
6384 PointerRNA ptr = RNA_pointer_create_discrete(ale->id, &RNA_NlaStrip, strip);
6385 prop = RNA_struct_find_property(&ptr, fcu->rna_path);
6386
6387 /* create property slider */
6388 if (prop) {
6389 uiBut *but;
6390
6391 /* Create the slider button,
6392 * and assign relevant callback to ensure keyframes are inserted. */
6393 but = uiDefAutoButR(block,
6394 &ptr,
6395 prop,
6396 fcu->array_index,
6397 "",
6398 ICON_NONE,
6399 offset,
6400 rect->ymin,
6402 channel_height);
6404 }
6405 }
6406 }
6407 else if (ale->id) { /* Slider using RNA Access --------------- */
6409 PropertyRNA *prop;
6410 std::optional<std::string> rna_path;
6411 int array_index = 0;
6412
6413 /* get destination info */
6414 if (ale->type == ANIMTYPE_FCURVE) {
6415 FCurve *fcu = static_cast<FCurve *>(ale->data);
6416
6417 rna_path = fcu->rna_path;
6418 array_index = fcu->array_index;
6419 }
6420 else if (ale->type == ANIMTYPE_SHAPEKEY) {
6421 KeyBlock *kb = static_cast<KeyBlock *>(ale->data);
6422 Key *key = reinterpret_cast<Key *>(ale->id);
6423
6424 rna_path = BKE_keyblock_curval_rnapath_get(key, kb);
6425 }
6426 /* Special for Grease Pencil Layer. */
6427 else if (ale->type == ANIMTYPE_GPLAYER) {
6428 bGPdata *gpd = reinterpret_cast<bGPdata *>(ale->id);
6429 if ((gpd->flag & GP_DATA_ANNOTATIONS) == 0) {
6430 /* Reset slider offset, in order to add special gp icons. */
6431 offset += SLIDER_WIDTH;
6432
6433 bGPDlayer *gpl = static_cast<bGPDlayer *>(ale->data);
6434
6435 /* Create the RNA pointers. */
6436 ptr = RNA_pointer_create_discrete(ale->id, &RNA_AnnotationLayer, ale->data);
6437 PointerRNA id_ptr = RNA_id_pointer_create(ale->id);
6438 int icon;
6439
6440 /* Layer onion skinning switch. */
6441 offset -= ICON_WIDTH;
6443 prop = RNA_struct_find_property(&ptr, "use_annotation_onion_skinning");
6444 if (const std::optional<std::string> gp_rna_path = RNA_path_from_ID_to_property(&ptr,
6445 prop))
6446 {
6447 if (RNA_path_resolve_property(&id_ptr, gp_rna_path->c_str(), &ptr, &prop)) {
6448 icon = (gpl->onion_flag & GP_LAYER_ONIONSKIN) ? ICON_ONIONSKIN_ON :
6449 ICON_ONIONSKIN_OFF;
6450 uiDefAutoButR(block,
6451 &ptr,
6452 prop,
6453 array_index,
6454 "",
6455 icon,
6456 offset,
6457 rect->ymin,
6458 ICON_WIDTH,
6459 channel_height);
6460 }
6461 }
6462
6463 /* Layer opacity. */
6464 const short width = SLIDER_WIDTH * 0.6;
6465 offset -= width;
6467 prop = RNA_struct_find_property(&ptr, "annotation_opacity");
6468 if (const std::optional<std::string> gp_rna_path = RNA_path_from_ID_to_property(&ptr,
6469 prop))
6470 {
6471 if (RNA_path_resolve_property(&id_ptr, gp_rna_path->c_str(), &ptr, &prop)) {
6472 uiDefAutoButR(block,
6473 &ptr,
6474 prop,
6475 array_index,
6476 "",
6477 ICON_NONE,
6478 offset,
6479 rect->ymin,
6480 width,
6481 channel_height);
6482 }
6483 }
6484 }
6485 }
6486 else if (ale->type == ANIMTYPE_GREASE_PENCIL_LAYER) {
6487 draw_grease_pencil_layer_widgets(ale, block, rect, offset, channel_height, array_index);
6488 }
6489
6490 /* Only if RNA-Path found. */
6491 if (rna_path) {
6492 /* get RNA pointer, and resolve the path */
6493 PointerRNA id_ptr = RNA_id_pointer_create(ale->id);
6494
6495 /* try to resolve the path */
6496 if (RNA_path_resolve_property(&id_ptr, rna_path->c_str(), &ptr, &prop)) {
6497 uiBut *but;
6498
6499 /* Create the slider button,
6500 * and assign relevant callback to ensure keyframes are inserted. */
6501 but = uiDefAutoButR(block,
6502 &ptr,
6503 prop,
6504 array_index,
6505 RNA_property_type(prop) == PROP_ENUM ? std::nullopt :
6506 std::optional(""),
6507 ICON_NONE,
6508 offset,
6509 rect->ymin,
6511 channel_height);
6512
6513 /* assign keyframing function according to slider type */
6514 if (ale->type == ANIMTYPE_SHAPEKEY) {
6516 }
6517 else {
6519 }
6520 }
6521 }
6522 }
6523 else { /* Special Slider for stuff without RNA Access ---------- */
6524 /* TODO: only implement this case when we really need it... */
6525 }
6526 }
6527 }
6528}
6529
6530/* *********************************************** */
Functions and classes to work with Actions.
Functions to work with AnimData.
Functions to modify FCurves.
Functions to insert, delete or modify keyframes.
AnimData * BKE_animdata_from_id(const ID *id)
Definition anim_data.cc:83
void BKE_animsys_free_nla_keyframing_context_cache(struct ListBase *cache)
Definition anim_sys.cc:3887
AnimationEvalContext BKE_animsys_eval_context_construct(struct Depsgraph *depsgraph, float eval_time) ATTR_WARN_UNUSED_RESULT
Definition anim_sys.cc:738
struct NlaKeyframingContext * BKE_animsys_get_nla_keyframing_context(struct ListBase *cache, struct PointerRNA *ptr, struct AnimData *adt, const struct AnimationEvalContext *anim_eval_context)
ReportList * CTX_wm_reports(const bContext *C)
Depsgraph * CTX_data_depsgraph_pointer(const bContext *C)
Scene * CTX_data_scene(const bContext *C)
Main * CTX_data_main(const bContext *C)
Low-level operations for grease pencil.
std::optional< std::string > BKE_keyblock_curval_rnapath_get(const Key *key, const KeyBlock *kb)
Definition key.cc:1942
bool BKE_id_is_editable(const Main *bmain, const ID *id)
Definition lib_id.cc:2523
void BKE_nlatrack_solo_toggle(AnimData *adt, NlaTrack *nlt)
@ NLATIME_CONVERT_UNMAP
Definition BKE_nla.hh:549
float BKE_nla_tweakedit_remap(AnimData *adt, float cframe, eNlaTime_ConvertModes mode)
#define BLI_assert_unreachable()
Definition BLI_assert.h:93
#define BLI_assert(a)
Definition BLI_assert.h:46
#define BLI_assert_msg(a, msg)
Definition BLI_assert.h:53
BLI_INLINE bool BLI_listbase_is_empty(const ListBase *lb)
MINLINE int round_fl_to_int(float a)
MINLINE void rgb_float_to_uchar(unsigned char r_col[3], const float col_f[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
BLI_INLINE float BLI_rctf_cent_y(const struct rctf *rct)
Definition BLI_rect.h:189
BLI_INLINE int BLI_rcti_size_x(const struct rcti *rct)
Definition BLI_rect.h:194
BLI_INLINE float BLI_rctf_size_y(const struct rctf *rct)
Definition BLI_rect.h:206
void BLI_str_tolower_ascii(char *str, size_t len) ATTR_NONNULL(1)
Definition string.cc:956
size_t size_t size_t BLI_snprintf_utf8(char *__restrict dst, size_t dst_maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_strncpy_utf8(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define STRNCPY_UTF8(dst, src)
unsigned char uchar
unsigned int uint
#define UNUSED_VARS(...)
#define POINTER_FROM_INT(i)
#define POINTER_AS_INT(i)
#define ELEM(...)
#define TIP_(msgid)
#define IFACE_(msgid)
int rect_width(int rect[2][2])
Definition Basic.c:43
void DEG_id_tag_update(ID *id, unsigned int flags)
void DEG_relations_tag_update(Main *bmain)
@ ID_RECALC_TRANSFORM
Definition DNA_ID.h:1054
@ ID_RECALC_ANIMATION
Definition DNA_ID.h:1077
@ ID_RECALC_GEOMETRY
Definition DNA_ID.h:1074
@ ID_RECALC_ANIMATION_NO_FLUSH
Definition DNA_ID.h:1176
@ ID_TE
@ ID_NT
@ ID_MA
@ ID_AC
@ ID_PA
@ AGRP_ACTIVE
@ AGRP_SELECTED
@ AGRP_EXPANDED_G
@ AGRP_EXPANDED
@ AGRP_PROTECTED
@ AGRP_MODIFIERS_OFF
@ AGRP_MUTED
@ AGRP_NOTVISIBLE
@ ACT_COLLAPSED
@ ADS_FLAG_SUMMARY_COLLAPSED
@ SACTION_SLIDERS
@ ADT_NLA_SOLO_TRACK
@ ADT_UI_EXPANDED
@ ADT_CURVES_ALWAYS_VISIBLE
@ ADT_CURVES_NOT_VISIBLE
@ ADT_DRIVERS_COLLAPSED
@ ADT_NLA_SKEYS_COLLAPSED
@ ADT_NLA_EVAL_OFF
@ ADT_NLA_EDIT_NOMAP
@ ADT_UI_SELECTED
@ ADT_NLA_EDIT_ON
eInsertKeyFlags
@ INSERTKEY_REPLACE
@ INSERTKEY_NOFLAGS
@ DRIVER_FLAG_INVALID
@ FCURVE_DISABLED
@ FCURVE_MUTED
@ FCURVE_MOD_OFF
@ FCURVE_SELECTED
@ FCURVE_PROTECTED
@ FCURVE_VISIBLE
@ NLATRACK_SOLO
@ NLATRACK_ACTIVE
@ NLATRACK_MUTED
@ NLATRACK_DISABLED
@ NLATRACK_SELECTED
@ NLATRACK_PROTECTED
@ ARM_DS_EXPAND
@ CACHEFILE_DS_EXPAND
@ CAM_DS_EXPAND
@ CU_DS_EXPAND
eBezTriple_KeyframeType
@ LAYERGROUP_COLOR_NONE
@ GP_LAYER_TREE_NODE_EXPANDED
@ GP_LAYER_TREE_NODE_LOCKED
@ GP_LAYER_TREE_NODE_MUTE
@ GP_LAYER_TREE_NODE_HIDE
@ GP_LAYER_TREE_NODE_SELECT
@ GREASE_PENCIL_ANIM_CHANNEL_EXPANDED
@ KEYBLOCK_SEL
@ KEYBLOCK_MUTE
@ KEYBLOCK_LOCKED
@ KEY_DS_EXPAND
@ LT_DS_EXPAND
@ LA_DS_EXPAND
@ LIGHTPROBE_DS_EXPAND
@ LIGHTPROBE_TYPE_PLANE
@ LIGHTPROBE_TYPE_VOLUME
@ LIGHTPROBE_TYPE_SPHERE
@ LS_DS_EXPAND
@ MASK_ANIMF_EXPAND
@ MASK_LAYERFLAG_LOCKED
@ MASK_LAYERFLAG_SELECT
@ MA_DS_EXPAND
@ ME_DS_EXPAND
@ MB_DS_EXPAND
@ MCLIP_DATA_EXPAND
@ NTREE_DS_EXPAND
@ NTREE_TEXTURE
@ NTREE_SHADER
@ NTREE_COMPOSIT
Object is a sort of wrapper for general info.
@ OB_SPEAKER
@ OB_LATTICE
@ OB_MBALL
@ OB_EMPTY
@ OB_SURF
@ OB_CAMERA
@ OB_FONT
@ OB_GREASE_PENCIL
@ OB_ARMATURE
@ OB_LAMP
@ OB_MESH
@ OB_POINTCLOUD
@ OB_VOLUME
@ OB_CURVES_LEGACY
@ OB_CURVES
@ OB_LIGHTPROBE
@ OB_ADS_COLLAPSED
@ PART_DS_EXPAND
#define BASE_SELECTED(v3d, base)
@ SCE_DS_COLLAPSED
@ SCE_DS_SELECTED
@ SPACE_ACTION
@ SPACE_NLA
@ SPACE_GRAPH
@ SIPO_SLIDERS
@ SPK_DS_EXPAND
@ TEX_DS_EXPAND
#define UI_SCALE_FAC
@ USER_ANIM_SHOW_CHANNEL_GROUP_COLORS
@ VO_DS_EXPAND
@ WO_DS_EXPAND
eAnimChannels_SetFlag
@ ANIMTYPE_SUMMARY
@ ANIMTYPE_NLACURVE
@ ANIMTYPE_SHAPEKEY
@ ANIMTYPE_GROUP
@ ANIMTYPE_ACTION_SLOT
@ ANIMTYPE_GPLAYER
@ ANIMTYPE_DSGPENCIL
@ ANIMTYPE_NLAACTION
@ ANIMTYPE_NUM_TYPES
@ ANIMTYPE_FCURVE
@ ANIMTYPE_GREASE_PENCIL_LAYER
@ ANIMTYPE_FILLACT_LAYERED
@ ANIMTYPE_GREASE_PENCIL_LAYER_GROUP
@ ANIMTYPE_NLATRACK
#define NLATRACK_SKIP
@ ACHANNEL_ROLE_CHANNEL
@ ACHANNEL_ROLE_EXPANDER
@ ALE_FCURVE
@ ALE_NLASTRIP
@ ALE_ACT
eAnimCont_Types
@ ANIMCONT_ACTION
@ ANIMCONT_GPENCIL
eAnimChannel_Settings
@ ACHANNEL_SETTING_ALWAYS_VISIBLE
@ ACHANNEL_SETTING_PINNED
@ ACHANNEL_SETTING_MUTE
@ ACHANNEL_SETTING_PROTECT
@ ACHANNEL_SETTING_VISIBLE
@ ACHANNEL_SETTING_EXPAND
@ ACHANNEL_SETTING_SOLO
@ ACHANNEL_SETTING_MOD_OFF
@ ACHANNEL_SETTING_SELECT
void nla_action_get_color(AnimData *adt, bAction *act, float color[4])
Definition nla_draw.cc:53
eAnimFilter_Flags
@ ANIMFILTER_DATA_VISIBLE
@ ANIMFILTER_LIST_CHANNELS
void immEnd()
void immUnbindProgram()
void immBindBuiltinProgram(GPUBuiltinShader shader_id)
void immVertex2f(uint attr_id, float x, float y)
void immUniformColor3ubv(const unsigned char rgb[3])
GPUVertFormat * immVertexFormat()
void immUniformColor3f(float r, float g, float b)
void immBegin(GPUPrimType, uint vertex_len)
void immUniformColor3fvAlpha(const float rgb[3], float a)
void immUniformColor3fv(const float rgb[3])
void immRectf(uint pos, float x1, float y1, float x2, float y2)
@ GPU_PRIM_LINES
@ GPU_SHADER_3D_UNIFORM_COLOR
void GPU_line_width(float width)
Definition gpu_state.cc:166
@ GPU_BLEND_NONE
Definition GPU_state.hh:85
@ GPU_BLEND_ALPHA
Definition GPU_state.hh:87
void GPU_blend(GPUBlend blend)
Definition gpu_state.cc:42
uint GPU_vertformat_attr_add(GPUVertFormat *format, blender::StringRef name, blender::gpu::VertAttrType type)
Read Guarded memory(de)allocation.
@ PROP_ENUM
Definition RNA_types.hh:166
#define C
Definition RandGen.cpp:29
void UI_but_func_set(uiBut *but, std::function< void(bContext &)> func)
void UI_but_disable(uiBut *but, const char *disabled_hint)
uiBut * uiDefButR(uiBlock *block, ButType type, int retval, std::optional< blender::StringRef > str, int x, int y, short width, short height, PointerRNA *ptr, blender::StringRefNull propname, int index, float min, float max, std::optional< blender::StringRef > tip)
void UI_draw_roundbox_4fv(const rctf *rect, bool filled, float rad, const float col[4])
void UI_block_emboss_set(uiBlock *block, blender::ui::EmbossType emboss)
uiBut * uiDefIconButBitI(uiBlock *block, ButType type, int bit, int retval, int icon, int x, int y, short width, short height, int *poin, float min, float max, std::optional< blender::StringRef > tip)
void UI_fontstyle_draw_simple(const uiFontStyle *fs, float x, float y, const char *str, const uchar col[4])
@ UI_BUT_INACTIVE
uiBut * uiDefIconButBitS(uiBlock *block, ButType type, int bit, int retval, int icon, int x, int y, short width, short height, short *poin, float min, float max, std::optional< blender::StringRef > tip)
void UI_draw_roundbox_corner_set(int type)
uiBut * uiDefIconButBitC(uiBlock *block, ButType type, int bit, int retval, int icon, int x, int y, short width, short height, char *poin, float min, float max, std::optional< blender::StringRef > tip)
uiBut * uiDefIconButO(uiBlock *block, ButType type, blender::StringRefNull opname, blender::wm::OpCallContext opcontext, int icon, int x, int y, short width, short height, std::optional< blender::StringRef > tip)
uiBut * uiDefAutoButR(uiBlock *block, PointerRNA *ptr, PropertyRNA *prop, int index, std::optional< blender::StringRef > name, int icon, int x, int y, int width, int height)
void UI_draw_roundbox_3fv_alpha(const rctf *rect, bool filled, float rad, const float col[3], float alpha)
uiBut * UI_context_active_but_prop_get(const bContext *C, PointerRNA *r_ptr, PropertyRNA **r_prop, int *r_index)
PointerRNA * UI_but_operator_ptr_ensure(uiBut *but)
@ UI_CNR_BOTTOM_LEFT
@ UI_CNR_TOP_LEFT
bool UI_but_active_only(const bContext *C, ARegion *region, uiBlock *block, uiBut *but)
void(*)(bContext *C, void *argN, void *arg2) uiButHandleNFunc
#define UI_FSTYLE_WIDGET
#define UI_UNIT_X
void UI_but_funcN_set(uiBut *but, uiButHandleNFunc funcN, void *argN, void *arg2, uiButArgNFree func_argN_free_fn=MEM_freeN, uiButArgNCopy func_argN_copy_fn=MEM_dupallocN)
void UI_but_flag_enable(uiBut *but, int flag)
void UI_icon_draw(float x, float y, int icon_id)
int UI_icon_from_idcode(int idcode)
void UI_GetThemeColor3fv(int colorid, float col[3])
@ TH_NLA_TRACK
@ TH_HEADER
@ TH_GROUP
@ TH_DOPESHEET_CHANNELSUBOB
@ TH_ANIM_ACTIVE
@ TH_CHANNEL
@ TH_GROUP_ACTIVE
@ TH_TEXT
@ TH_DOPESHEET_CHANNELOB
@ TH_TEXT_HI
void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3])
bTheme * UI_GetTheme()
void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
#define V2D_SCROLL_WIDTH
Definition UI_view2d.hh:54
#define UI_TIME_SCRUB_MARGIN_Y
Definition UI_view2d.hh:479
float UI_view2d_scale_get_y(const View2D *v2d)
Definition view2d.cc:1925
#define ND_DATA
Definition WM_types.hh:509
#define NC_ANIMATION
Definition WM_types.hh:388
#define NA_EDITED
Definition WM_types.hh:584
#define NC_GPENCIL
Definition WM_types.hh:399
#define NA_RENAME
Definition WM_types.hh:588
#define ND_ANIMCHAN
Definition WM_types.hh:496
static void ANIM_init_channel_typeinfo_data()
static int acf_dsvolume_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static bAnimChannelType ACF_DSWOR
static void acf_nla_controls_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
static bAnimChannelType ACF_DSPART
static bAnimChannelType ACF_DSNTREE
static int acf_dsgpencil_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static short acf_generic_group_offset(bAnimContext *ac, bAnimListElem *ale)
static int acf_dscachefile_setting_flag(bAnimContext *ac, eAnimChannel_Settings setting, bool *r_neg)
static void acf_action_slot_name(bAnimListElem *ale, char *r_name)
float ANIM_UI_get_channels_total_height(View2D *v2d, const int item_count)
static bAnimChannelType ACF_GPL_LEGACY
static void * acf_dslat_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static int acf_object_icon(bAnimListElem *ale)
static bool acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *, eAnimChannel_Settings setting)
static void * acf_dsmball_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static int acf_dspointcloud_icon(bAnimListElem *)
static void acf_object_name(bAnimListElem *ale, char *name)
static bAnimChannelType ACF_SCENE
static void acf_nlaaction_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
static void acf_summary_name(bAnimListElem *, char *name)
static short acf_generic_basic_offset(bAnimContext *ac, bAnimListElem *ale)
static int acf_fillactd_icon(bAnimListElem *)
static int acf_action_slot_icon(bAnimListElem *)
static bAnimChannelType ACF_MASKLAYER
#define GRAPH_ICON_VISIBILITY_OFFSET
#define GET_ACF_FLAG_PTR(ptr, type)
static int acf_group_setting_flag(bAnimContext *ac, eAnimChannel_Settings setting, bool *r_neg)
static bAnimChannelType ACF_NLACURVE
static int acf_dsarm_icon(bAnimListElem *)
static bAnimChannelType ACF_FILLANIM
static int acf_dsmclip_icon(bAnimListElem *)
static void * acf_filldrivers_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static int acf_dstex_icon(bAnimListElem *)
static int acf_dscur_icon(bAnimListElem *ale)
static bAnimChannelType ACF_GPD
static bAnimChannelType ACF_DSLAT
static bAnimChannelType ACF_DSLIGHTPROBE
void ANIM_channel_setting_set(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting, eAnimChannels_SetFlag mode)
static bool acf_masklay_setting_valid(bAnimContext *, bAnimListElem *, eAnimChannel_Settings setting)
#define INDENT_STEP_SIZE
static int acf_dsspk_icon(bAnimListElem *)
float ANIM_UI_get_channel_skip()
void ANIM_channel_draw_widgets(const bContext *C, bAnimContext *ac, bAnimListElem *ale, uiBlock *block, const rctf *rect, size_t channel_index)
static int acf_dscurves_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static bool acf_nlatrack_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
static void acf_nla_curve_name(bAnimListElem *ale, char *name)
static bAnimChannelType ACF_DSVOLUME
static int acf_filldrivers_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
float ANIM_UI_get_keyframe_scale_factor()
static int acf_nlaaction_icon(bAnimListElem *ale)
float ANIM_UI_get_channel_name_width()
static bAnimChannelType ACF_DSMCLIP
static void acf_summary_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
static void * acf_dsmat_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static int acf_dslinestyle_icon(bAnimListElem *)
static bAnimChannelType ACF_NLATRACK
static int acf_dsgpencil_icon(bAnimListElem *)
void ANIM_channel_debug_print_info(bAnimContext &ac, bAnimListElem *ale, short indent_level)
static void * acf_nlaaction_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings, short *r_type)
#define SLIDER_WIDTH
static bAnimChannelType ACF_DSPOINTCLOUD
static bool acf_summary_setting_valid(bAnimContext *, bAnimListElem *, eAnimChannel_Settings setting)
static bAnimChannelType ACF_SUMMARY
static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
static bool acf_fillactd_setting_valid(bAnimContext *, bAnimListElem *, eAnimChannel_Settings setting)
static int acf_gpl_setting_flag_legacy(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static int acf_dscachefile_icon(bAnimListElem *ale)
static int acf_dsmball_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static bool acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *, eAnimChannel_Settings setting)
static bAnimChannelType ACF_DSMBALL
static int acf_dslat_icon(bAnimListElem *)
void ANIM_channel_draw(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc, size_t channel_index)
static bAnimChannelType ACF_DSLINESTYLE
static int acf_fcurve_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static void * acf_dscurves_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static void acf_generic_idblock_name(bAnimListElem *ale, char *name)
static int acf_dsntree_icon(bAnimListElem *)
static short acf_generic_indentation_flexible(bAnimContext *, bAnimListElem *ale)
static int acf_dscam_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static int acf_dscur_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static bool acf_masklay_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
static int acf_action_slot_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static int acf_dsmclip_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static bool acf_generic_idfill_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
static int acf_dsmesh_icon(bAnimListElem *)
static bool acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *, eAnimChannel_Settings setting)
static bool acf_nlaaction_setting_valid(bAnimContext *, bAnimListElem *ale, eAnimChannel_Settings setting)
static void * acf_shapekey_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static bool acf_dsskey_setting_valid(bAnimContext *ac, bAnimListElem *, eAnimChannel_Settings setting)
static void acf_filldrivers_name(bAnimListElem *, char *name)
static bool achannel_is_being_renamed(const bAnimContext *ac, const bAnimChannelType *acf, size_t channel_index)
static void * acf_dsmclip_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static void acf_group_name(bAnimListElem *ale, char *name)
static int acf_dslinestyle_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
#define CHANNEL_COLOR_RECT_WIDTH
#define RENAME_TEXT_MIN_WIDTH
static void acf_nla_controls_name(bAnimListElem *, char *name)
static bool acf_fcurve_channel_color(const bAnimListElem *ale, uint8_t r_color[3])
static bool acf_gpl_setting_valid_legacy(bAnimContext *, bAnimListElem *, eAnimChannel_Settings setting)
static int acf_dspart_icon(bAnimListElem *)
static bAnimChannelType ACF_FCURVE
static bAnimChannelType ACF_DSSPK
static void acf_generic_root_color(bAnimContext *, bAnimListElem *, float r_color[3])
static int acf_dsarm_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
float ANIM_UI_get_channel_step()
static void * acf_gpl_setting_ptr_legacy(bAnimListElem *ale, eAnimChannel_Settings, short *r_type)
static void acf_nlatrack_name(bAnimListElem *ale, char *name)
static bool acf_mask_setting_valid(bAnimContext *, bAnimListElem *, eAnimChannel_Settings setting)
static bAnimChannelType ACF_DSTEX
static void achannel_setting_slider_cb(bContext *C, void *id_poin, void *fcu_poin)
static void * acf_nlatrack_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings, short *r_type)
static void * acf_dspointcloud_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static int acf_dsmat_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static short acf_dsntree_offset(bAnimContext *ac, bAnimListElem *ale)
static int acf_dsvolume_icon(bAnimListElem *)
static int acf_shapekey_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static void acf_nlatrack_color(bAnimContext *, bAnimListElem *ale, float r_color[3])
#define ICON_WIDTH
static void * acf_dstex_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static void * acf_dsvolume_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static bAnimChannelType ACF_FILLACTD
static int acf_fillanim_icon(bAnimListElem *)
static int acf_dslight_icon(bAnimListElem *)
static bool acf_filldrivers_setting_valid(bAnimContext *, bAnimListElem *, eAnimChannel_Settings setting)
static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
float ANIM_UI_get_first_channel_top(View2D *v2d)
static bool acf_nla_controls_setting_valid(bAnimContext *, bAnimListElem *, eAnimChannel_Settings setting)
static int acf_dswor_icon(bAnimListElem *)
static void * acf_dsarm_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static bAnimChannelType ACF_GPLGROUP
static int acf_filldrivers_icon(bAnimListElem *)
static bAnimChannelType ACF_DSCURVES
static short acf_nodetree_rootType_offset(bNodeTree *ntree)
static void * acf_dsspk_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
#define ACF_SETTING_SET(sval, sflag, smode)
static bool acf_shapekey_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
static int acf_dsmat_icon(bAnimListElem *)
static int acf_mask_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static void acf_generic_dataexpand_color(bAnimContext *, bAnimListElem *, float r_color[3])
float ANIM_UI_get_channel_height()
static int acf_scene_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static void acf_nlaaction_name(bAnimListElem *ale, char *name)
static bool acf_object_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
static bool acf_action_slot_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
static bAnimChannelType ACF_DSGPENCIL
static bool acf_gpl_name_prop_legacy(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
static bAnimChannelType ACF_MASKDATA
static int acf_nla_controls_icon(bAnimListElem *)
static bool acf_shapekey_setting_valid(bAnimContext *, bAnimListElem *, eAnimChannel_Settings setting)
static int acf_gpd_icon(bAnimListElem *)
static bool acf_generic_idblock_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
static int acf_dslightprobe_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static int acf_dsmball_icon(bAnimListElem *)
#define GRAPH_COLOR_BAND_WIDTH
static void * acf_dsntree_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static int acf_nlaaction_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static bAnimChannelType ACF_GROUP
static bAnimChannelType ACF_OBJECT
static void * acf_dscur_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static int acf_fillactd_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static int acf_dsskey_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static bAnimChannelType ACF_FILLDRIVERS
static short acf_dstex_offset(bAnimContext *, bAnimListElem *)
static int acf_masklay_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static bool acf_nlatrack_setting_valid(bAnimContext *, bAnimListElem *ale, eAnimChannel_Settings setting)
static int acf_dspart_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static bool get_actiongroup_color(const bActionGroup *agrp, uint8_t r_color[3])
bAction * ANIM_channel_action_get(const bAnimListElem *ale)
static void * acf_group_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings, short *r_type)
static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
static void * acf_fillactd_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static bool acf_group_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
static void acf_mask_color(bAnimContext *, bAnimListElem *, float r_color[3])
static int acf_summary_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static bAnimChannelType ACF_NLAACTION
static int acf_dscam_icon(bAnimListElem *)
static bAnimChannelType ACF_DSMAT
static bAnimChannelType ACF_DSCUR
static bool acf_fillanim_setting_valid(bAnimContext *, bAnimListElem *, eAnimChannel_Settings setting)
static void * acf_dspart_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static void draw_setting_widget(bAnimContext *ac, bAnimListElem *ale, const bAnimChannelType *acf, uiBlock *block, const int xpos, const int ypos, const eAnimChannel_Settings setting)
static void achannel_nlatrack_solo_widget_cb(bContext *C, void *ale_poin, void *setting_wrap)
static void * acf_mask_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings, short *r_type)
static void * acf_masklay_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings, short *r_type)
static int acf_object_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static void acf_gpl_name_legacy(bAnimListElem *ale, char *name)
short ANIM_channel_setting_get(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
static short acf_generic_indentation_0(bAnimContext *, bAnimListElem *)
static void achannel_setting_slider_nla_curve_cb(bContext *C, void *, void *fcu_poin)
static bool acf_group_channel_color(const bAnimListElem *ale, uint8_t r_color[3])
static bool acf_show_channel_colors()
static void achannel_setting_widget_cb(bContext *C, void *ale_npoin, void *setting_wrap)
static void acf_nlatrack_setting_post_update(Main &bmain, const bAnimListElem &, const eAnimChannel_Settings setting)
static bAnimChannelType ACF_DSLIGHT
static bAnimChannelType ACF_DSCACHEFILE
static int acf_dsntree_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static bAnimChannelType ACF_DSARM
static bool achannel_is_part_of_disconnected_slot(const bAnimListElem *ale)
static void acf_nlaaction_color(bAnimContext *, bAnimListElem *ale, float r_color[3])
static int acf_dslat_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static void * acf_summary_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static bAnimChannelType ACF_GPL
static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
static bool acf_gpl_channel_color(const bAnimListElem *ale, uint8_t r_color[3])
static int acf_dscurves_icon(bAnimListElem *)
static bAnimChannelType ACF_DSCAM
static bAnimChannelType ACF_DSMESH
static int acf_dslightprobe_icon(bAnimListElem *ale)
static void * acf_scene_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static int acf_dsspk_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static int acf_action_slot_idtype_icon(bAnimListElem *ale)
static bool acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
static void * acf_dslinestyle_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static void * acf_dsskey_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static int acf_scene_icon(bAnimListElem *)
static blender::StringRefNull setting_name(const eAnimChannel_Settings setting)
static int acf_dsmesh_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static void achannel_setting_slider_shapekey_cb(bContext *C, void *key_poin, void *kb_poin)
float ANIM_UI_get_channel_button_width()
static bool acf_action_slot_setting_valid(bAnimContext *, bAnimListElem *, const eAnimChannel_Settings setting)
static void acf_fcurve_name(bAnimListElem *ale, char *name)
static int acf_mask_icon(bAnimListElem *)
static bool acf_fcurve_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
static void * acf_dscachefile_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static void draw_grease_pencil_layer_widgets(bAnimListElem *ale, uiBlock *block, const rctf *rect, short &offset, const short channel_height, const int array_index)
static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
static bool acf_gpd_setting_valid(bAnimContext *, bAnimListElem *, eAnimChannel_Settings setting)
static void acf_group_color(bAnimContext *, bAnimListElem *ale, float r_color[3])
static void * acf_dslight_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static bool acf_group_setting_valid(bAnimContext *ac, bAnimListElem *, eAnimChannel_Settings setting)
static void * acf_action_slot_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings, short *r_type)
static void * acf_fillanim_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static bAnimChannelType ACF_SHAPEKEY
static int acf_dslight_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static void * acf_nla_controls_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings, short *r_type)
static void * acf_fcurve_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings, short *r_type)
static bAnimChannelType * animchannelTypeInfo[ANIMTYPE_NUM_TYPES]
static void * acf_object_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static bool achannel_is_broken(const bAnimListElem *ale)
static short acf_generic_indentation_1(bAnimContext *, bAnimListElem *)
static int acf_dsskey_icon(bAnimListElem *)
static int acf_dswor_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
static int acf_nla_controls_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static void achannel_setting_flush_widget_cb(bContext *C, void *ale_npoin, void *setting_wrap)
static int acf_dspointcloud_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static int acf_nlatrack_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *neg)
static bAnimChannelType ACF_NLACONTROLS
static bool acf_nlaaction_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
static void acf_nla_controls_color(bAnimContext *, bAnimListElem *, float r_color[3])
static void * acf_dscam_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static int acf_fillanim_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static short ACF_INIT
static int acf_dstex_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static void acf_shapekey_name(bAnimListElem *ale, char *name)
static bAnimChannelType ACF_DSSKEY
#define CHANNEL_COLOR_RECT_MARGIN
static void acf_masklay_name(bAnimListElem *ale, char *name)
static void * acf_dswor_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static void * acf_dsgpencil_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static void * acf_dslightprobe_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static void * acf_dsmesh_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
static bAnimChannelType ACF_ACTION_SLOT
#define EXTRA_SCROLL_PAD
const bAnimChannelType * ANIM_channel_get_typeinfo(const bAnimListElem *ale)
void ANIM_flush_setting_anim_channels(bAnimContext *ac, ListBase *anim_data, bAnimListElem *ale_setting, eAnimChannel_Settings setting, eAnimChannels_SetFlag mode)
void ANIM_animdata_freelist(ListBase *anim_data)
Definition anim_deps.cc:463
bool ANIM_animdata_get_context(const bContext *C, bAnimContext *ac)
size_t ANIM_animdata_filter(bAnimContext *ac, ListBase *anim_data, const eAnimFilter_Flags filter_mode, void *data, const eAnimCont_Types datatype)
#define ANIM_CHAN_NAME_SIZE
std::string getname_anim_fcurve_for_slot(Main &bmain, const blender::animrig::Slot &slot, FCurve &fcurve)
std::optional< int > getname_anim_fcurve(char *name, ID *id, FCurve *fcu)
#define U
BPy_StructRNA * depsgraph
constexpr int64_t size() const
Definition BLI_span.hh:252
constexpr bool is_empty() const
Definition BLI_span.hh:260
constexpr bool contains(const T &value) const
Definition BLI_span.hh:277
constexpr const char * c_str() const
Slot * slot_for_handle(slot_handle_t handle)
Span< ID * > users(Main &bmain) const
static constexpr slot_handle_t unassigned
StringRefNull identifier_without_prefix() const
nullptr float
#define GS(x)
uint pos
uint col
#define filter
#define printf(...)
bool enabled
format
void * MEM_dupallocN(const void *vmemh)
Definition mallocn.cc:143
ccl_device_inline int as_int(const uint i)
Definition math_base.h:226
ccl_device_inline float2 mask(const MaskType mask, const float2 a)
bool fcurve_frame_has_keyframe(const FCurve *fcu, float frame)
CombinedKeyingResult insert_keyframes(Main *bmain, PointerRNA *struct_pointer, std::optional< StringRefNull > channel_group, const blender::Span< RNAPath > rna_paths, std::optional< float > scene_frame, const AnimationEvalContext &anim_eval_context, eBezTriple_KeyframeType key_type, eInsertKeyFlags insert_key_flags)
Main key-frame insertion API.
bool insert_keyframe_direct(ReportList *reports, PointerRNA ptr, PropertyRNA *prop, FCurve *fcu, const AnimationEvalContext *anim_eval_context, eBezTriple_KeyframeType keytype, NlaKeyframingContext *nla_context, eInsertKeyFlags flag)
Secondary Insert Key-framing API call.
eInsertKeyFlags get_keyframing_flags(Scene *scene)
static short layer_offset(bAnimContext *ac, bAnimListElem *ale)
static void layer_name(bAnimListElem *ale, char *name)
static bool layer_name_prop(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
static int layer_group_icon(bAnimListElem *ale)
static void * data_block_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings, short *r_type)
static bool layer_setting_valid(bAnimContext *, bAnimListElem *, eAnimChannel_Settings setting)
static bool layer_group_setting_valid(bAnimContext *, bAnimListElem *, eAnimChannel_Settings setting)
static int layer_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static void * layer_group_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings, short *r_type)
static void * layer_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings, short *r_type)
static int data_block_setting_flag(bAnimContext *, eAnimChannel_Settings setting, bool *r_neg)
static void layer_group_color(bAnimContext *, bAnimListElem *, float r_color[3])
static void layer_group_name(bAnimListElem *ale, char *name)
static void datablock_color(bAnimContext *ac, bAnimListElem *, float r_color[3])
static bool layer_channel_color(const bAnimListElem *ale, uint8_t r_color[3])
float wrap(float value, float max, float min)
Definition node_math.h:103
const char * name
PropertyRNA * RNA_struct_type_find_property(StructRNA *srna, const char *identifier)
PropertyRNA * RNA_struct_find_property(PointerRNA *ptr, const char *identifier)
PropertyType RNA_property_type(PropertyRNA *prop)
void RNA_int_set(PointerRNA *ptr, const char *name, int value)
const char * RNA_property_ui_name(const PropertyRNA *prop, const PointerRNA *ptr)
PropertyRNA * RNA_struct_name_property(const StructRNA *type)
PointerRNA RNA_pointer_create_discrete(ID *id, StructRNA *type, void *data)
const char * RNA_property_identifier(const PropertyRNA *prop)
PointerRNA RNA_id_pointer_create(ID *id)
std::optional< std::string > RNA_path_from_ID_to_property(const PointerRNA *ptr, PropertyRNA *prop)
Definition rna_path.cc:1173
bool RNA_path_resolve_property(const PointerRNA *ptr, const char *path, PointerRNA *r_ptr, PropertyRNA **r_prop)
Definition rna_path.cc:560
bAction * action
short flag
struct Object * object
struct AnimData * adt
struct AnimData * adt
struct AnimData * adt
short ob_type
struct AnimData * adt
bActionGroup * grp
char * rna_path
ChannelDriver * driver
BezTriple * bezt
float color[3]
int array_index
ListBase modifiers
struct AnimData * adt
GreasePencilLayerTreeNode base
GreasePencilLayerTreeNode base
Definition DNA_ID.h:414
char name[258]
Definition DNA_ID.h:432
char name[64]
short flag
struct AnimData * adt
struct AnimData * adt
struct AnimData * adt
struct AnimData * adt
short flag
char name[64]
struct AnimData * adt
struct AnimData * adt
uint16_t flag
struct AnimData * adt
struct AnimData * adt
char name[64]
char name[64]
struct AnimData * adt
struct AnimData * adt
struct AnimData * adt
StructRNA * type
Definition RNA_types.hh:52
struct ToolSettings * toolsettings
struct RenderData r
struct AnimData * adt
struct AnimData * adt
struct AnimData * adt
float keyframe_scale_fac
unsigned char solid[4]
struct AnimData * adt
struct AnimData * adt
short flag
ThemeWireColor cs
void(* name)(bAnimListElem *ale, char *name)
void(* get_backdrop_color)(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
short(* get_offset)(bAnimContext *ac, bAnimListElem *ale)
bool(* name_prop)(bAnimListElem *ale, PointerRNA *r_ptr, PropertyRNA **r_prop)
void(* draw_backdrop)(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
int(* setting_flag)(bAnimContext *ac, eAnimChannel_Settings setting, bool *r_neg)
const char * channel_type_name
bool(* has_setting)(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
short(* get_indent_level)(bAnimContext *ac, bAnimListElem *ale)
bool(* get_channel_color)(const bAnimListElem *ale, uint8_t r_color[3])
int(* icon)(bAnimListElem *ale)
void(* setting_post_update)(Main &bmain, const bAnimListElem &ale, eAnimChannel_Settings setting)
void *(* setting_ptr)(bAnimListElem *ale, eAnimChannel_Settings setting, short *r_type)
SpaceLink * sl
eAnimCont_Types datatype
bDopeSheet * ads
eSpace_Type spacetype
ARegion * region
int32_t slot_handle
AnimData * adt
eAnim_ChannelType type
eAnim_KeyType datatype
struct AnimData * adt
struct AnimData * adt
struct AnimData * adt
ThemeSpace space_action
ThemeWireColor tarm[20]
float xmax
float xmin
float ymax
float ymin
void WM_event_add_notifier(const bContext *C, uint type, void *reference)
PointerRNA * ptr
Definition wm_files.cc:4238
uint8_t flag
Definition wm_window.cc:145