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