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