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