4163cbfe1135fb2f8d2d03ef4df5ee64342cf622
[blender.git] / source / blender / editors / animation / anim_channels_defines.c
1 /*
2  * ***** BEGIN GPL LICENSE BLOCK *****
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License
6  * as published by the Free Software Foundation; either version 2
7  * of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software Foundation,
16  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17  *
18  * The Original Code is Copyright (C) 2009 Blender Foundation, Joshua Leung
19  * All rights reserved.
20  *
21  * Contributor(s): Joshua Leung
22  *
23  * ***** END GPL LICENSE BLOCK *****
24  */
25
26 /** \file blender/editors/animation/anim_channels_defines.c
27  *  \ingroup edanimation
28  */
29
30
31 #include <stdio.h>
32
33 #include "MEM_guardedalloc.h"
34
35 #include "BLI_blenlib.h"
36 #include "BLI_math.h"
37 #include "BLI_utildefines.h"
38
39 #include "BLT_translation.h"
40
41 #include "DNA_anim_types.h"
42 #include "DNA_armature_types.h"
43 #include "DNA_cachefile_types.h"
44 #include "DNA_camera_types.h"
45 #include "DNA_object_types.h"
46 #include "DNA_particle_types.h"
47 #include "DNA_screen_types.h"
48 #include "DNA_scene_types.h"
49 #include "DNA_space_types.h"
50 #include "DNA_key_types.h"
51 #include "DNA_lamp_types.h"
52 #include "DNA_lattice_types.h"
53 #include "DNA_linestyle_types.h"
54 #include "DNA_mesh_types.h"
55 #include "DNA_material_types.h"
56 #include "DNA_meta_types.h"
57 #include "DNA_node_types.h"
58 #include "DNA_world_types.h"
59 #include "DNA_gpencil_types.h"
60 #include "DNA_speaker_types.h"
61 #include "DNA_mask_types.h"
62
63 #include "RNA_access.h"
64
65 #include "BKE_animsys.h"
66 #include "BKE_curve.h"
67 #include "BKE_key.h"
68 #include "BKE_nla.h"
69 #include "BKE_context.h"
70
71 #include "GPU_immediate.h"
72
73 #include "UI_interface.h"
74 #include "UI_interface_icons.h"
75 #include "UI_resources.h"
76
77 #include "ED_anim_api.h"
78 #include "ED_keyframing.h"
79
80 #include "BIF_gl.h"
81 #include "BIF_glutil.h"
82
83 #include "WM_api.h"
84 #include "WM_types.h"
85
86 /* *********************************************** */
87 // XXX constant defines to be moved elsewhere?
88
89 /* extra padding for lengths (to go under scrollers) */
90 #define EXTRA_SCROLL_PAD    100.0f
91
92 /* size of indent steps */
93 #define INDENT_STEP_SIZE    (0.35f * U.widget_unit)
94
95 /* size of string buffers used for animation channel displayed names */
96 #define ANIM_CHAN_NAME_SIZE 256
97
98 /* get the pointer used for some flag */
99 #define GET_ACF_FLAG_PTR(ptr, type) ((*(type) = sizeof((ptr))), &(ptr))
100
101 /* *********************************************** */
102 /* Generic Functions (Type independent) */
103
104 /* Draw Backdrop ---------------------------------- */
105
106 /* get backdrop color for top-level widgets (Scene and Object only) */
107 static void acf_generic_root_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
108 {
109         /* darker blue for top-level widgets */
110         UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELOB, r_color);
111 }
112
113 /* backdrop for top-level widgets (Scene and Object only) */
114 static void acf_generic_root_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
115 {
116         const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
117         View2D *v2d = &ac->ar->v2d;
118         short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
119         short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
120         float color[3];
121         
122         /* set backdrop drawing color */
123         acf->get_backdrop_color(ac, ale, color);
124         
125         /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
126         UI_draw_roundbox_corner_set((expanded) ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
127         UI_draw_roundbox_gl_mode_3fvAlpha(GL_TRIANGLE_FAN, offset,  yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8, color, 1.0f);
128 }
129
130
131 /* get backdrop color for data expanders under top-level Scene/Object */
132 static void acf_generic_dataexpand_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
133 {
134         /* lighter color than top-level widget */
135         UI_GetThemeColor3fv(TH_DOPESHEET_CHANNELSUBOB, r_color);
136 }
137
138 /* backdrop for data expanders under top-level Scene/Object */
139 static void acf_generic_dataexpand_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
140 {
141         const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
142         View2D *v2d = &ac->ar->v2d;
143         short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
144         float color[3];
145
146         VertexFormat *format = immVertexFormat();
147         unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
148         
149         /* set backdrop drawing color */
150         acf->get_backdrop_color(ac, ale, color);
151
152         immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
153         immUniformColor3fv(color);
154         
155         /* no rounded corner - just rectangular box */
156         immRectf(pos, offset, yminc,  v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
157
158         immUnbindProgram();
159 }
160
161 /* helper method to test if group colors should be drawn */
162 static bool acf_show_channel_colors(bAnimContext *ac)
163 {
164         bool showGroupColors = false;
165         
166         if (ac->sl) {
167                 switch (ac->spacetype) {
168                         case SPACE_ACTION:
169                         {
170                                 SpaceAction *saction = (SpaceAction *)ac->sl;
171                                 showGroupColors = !(saction->flag & SACTION_NODRAWGCOLORS);
172
173                                 break;
174                         }
175                         case SPACE_IPO:
176                         {
177                                 SpaceIpo *sipo = (SpaceIpo *)ac->sl;
178                                 showGroupColors = !(sipo->flag & SIPO_NODRAWGCOLORS);
179
180                                 break;
181                         }
182                 }
183         }
184         
185         return showGroupColors;
186 }
187
188 /* get backdrop color for generic channels */
189 static void acf_generic_channel_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
190 {
191         const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
192         bActionGroup *grp = NULL;
193         short indent = (acf->get_indent_level) ? acf->get_indent_level(ac, ale) : 0;
194         bool showGroupColors = acf_show_channel_colors(ac);
195         
196         if (ale->type == ANIMTYPE_FCURVE) {
197                 FCurve *fcu = (FCurve *)ale->data;
198                 grp = fcu->grp;
199         }
200         
201         /* set color for normal channels 
202          *      - use 3 shades of color group/standard color for 3 indention level
203          *      - only use group colors if allowed to, and if actually feasible
204          */
205         if (showGroupColors && (grp) && (grp->customCol)) {
206                 unsigned char cp[3];
207                 
208                 if (indent == 2) {
209                         copy_v3_v3_char((char *)cp, grp->cs.solid);
210                 }
211                 else if (indent == 1) {
212                         copy_v3_v3_char((char *)cp, grp->cs.select);
213                 }
214                 else {
215                         copy_v3_v3_char((char *)cp, grp->cs.active);
216                 }
217                 
218                 /* copy the colors over, transforming from bytes to floats */
219                 rgb_uchar_to_float(r_color, cp);
220         }
221         else {
222                 // FIXME: what happens when the indention is 1 greater than what it should be (due to grouping)?
223                 int colOfs = 20 - 20 * indent;
224                 UI_GetThemeColorShade3fv(TH_HEADER, colOfs, r_color);
225         }
226 }
227
228 /* backdrop for generic channels */
229 static void acf_generic_channel_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
230 {
231         const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
232         View2D *v2d = &ac->ar->v2d;
233         short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
234         float color[3];
235
236         VertexFormat *format = immVertexFormat();
237         unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
238         
239         /* set backdrop drawing color */
240         acf->get_backdrop_color(ac, ale, color);
241
242         immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
243         immUniformColor3fv(color);
244         
245         /* no rounded corners - just rectangular box */
246         immRectf(pos, offset, yminc,  v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc);
247
248         immUnbindProgram();
249 }
250
251 /* Indention + Offset ------------------------------------------- */
252
253 /* indention level is always the value in the name */
254 static short acf_generic_indention_0(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale))
255 {
256         return 0;
257 }
258 static short acf_generic_indention_1(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale))
259 {
260         return 1;
261 }
262 #if 0 // XXX not used
263 static short acf_generic_indention_2(bAnimContext *ac, bAnimListElem *ale)
264 {
265         return 2;
266 }
267 #endif
268
269 /* indention which varies with the grouping status */
270 static short acf_generic_indention_flexible(bAnimContext *UNUSED(ac), bAnimListElem *ale)
271 {
272         short indent = 0;
273         
274         /* grouped F-Curves need extra level of indention */
275         if (ale->type == ANIMTYPE_FCURVE) {
276                 FCurve *fcu = (FCurve *)ale->data;
277                 
278                 // TODO: we need some way of specifying that the indention color should be one less...
279                 if (fcu->grp)
280                         indent++;
281         }
282         
283         /* no indention */
284         return indent;
285 }
286
287 /* basic offset for channels derived from indention */
288 static short acf_generic_basic_offset(bAnimContext *ac, bAnimListElem *ale)
289 {
290         const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
291         
292         if (acf && acf->get_indent_level)
293                 return acf->get_indent_level(ac, ale) * INDENT_STEP_SIZE;
294         else
295                 return 0;
296 }
297
298 /* offset based on nodetree type */
299 static short acf_nodetree_rootType_offset(bNodeTree *ntree)
300 {
301         if (ntree) {
302                 switch (ntree->type) {
303                         case NTREE_SHADER:
304                                 /* 1 additional level (i.e. is indented one level in from material, 
305                                  * so shift all right by one step) 
306                                  */
307                                 return INDENT_STEP_SIZE; 
308                                 
309                         case NTREE_COMPOSIT:
310                                 /* no additional levels needed */
311                                 return 0; 
312                                 
313                         case NTREE_TEXTURE:
314                                 /* 2 additional levels */
315                                 return INDENT_STEP_SIZE * 2;
316                 }
317         }
318         
319         /* unknown */
320         return 0;
321 }
322
323 /* offset for groups + grouped entities */
324 static short acf_generic_group_offset(bAnimContext *ac, bAnimListElem *ale)
325 {
326         short offset = acf_generic_basic_offset(ac, ale);
327         
328         if (ale->id) {
329                 /* texture animdata */
330                 if (GS(ale->id->name) == ID_TE) {
331                         offset += U.widget_unit;
332                 }
333                 /* materials and particles animdata */
334                 else if (ELEM(GS(ale->id->name), ID_MA, ID_PA))
335                         offset += (short)(0.7f * U.widget_unit);
336                         
337                 /* if not in Action Editor mode, action-groups (and their children) must carry some offset too... */
338                 else if (ac->datatype != ANIMCONT_ACTION)
339                         offset += (short)(0.7f * U.widget_unit);
340                         
341                 /* nodetree animdata */
342                 if (GS(ale->id->name) == ID_NT) {
343                         offset += acf_nodetree_rootType_offset((bNodeTree *)ale->id);
344                 }
345         }
346         
347         /* offset is just the normal type - i.e. based on indention */
348         return offset;
349 }
350
351 /* Name ------------------------------------------- */
352
353 /* name for ID block entries */
354 static void acf_generic_idblock_name(bAnimListElem *ale, char *name)
355 {
356         ID *id = (ID *)ale->data;    /* data pointed to should be an ID block */
357         
358         /* just copy the name... */
359         if (id && name)
360                 BLI_strncpy(name, id->name + 2, ANIM_CHAN_NAME_SIZE);
361 }
362
363 /* name property for ID block entries */
364 static bool acf_generic_idblock_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
365 {
366         RNA_id_pointer_create(ale->data, ptr);
367         *prop = RNA_struct_name_property(ptr->type);
368         
369         return (*prop != NULL);
370 }
371
372
373 /* name property for ID block entries which are just subheading "fillers" */
374 static bool acf_generic_idfill_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
375 {
376         /* actual ID we're representing is stored in ale->data not ale->id, as id gives the owner */
377         RNA_id_pointer_create(ale->data, ptr);
378         *prop = RNA_struct_name_property(ptr->type);
379         
380         return (*prop != NULL);
381 }
382
383 /* Settings ------------------------------------------- */
384
385 #if 0
386 /* channel type has no settings */
387 static bool acf_generic_none_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
388 {
389         return false;
390 }
391 #endif
392
393 /* check if some setting exists for this object-based data-expander (datablock only) */
394 static bool acf_generic_dataexpand_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
395 {
396         switch (setting) {
397                 /* expand is always supported */
398                 case ACHANNEL_SETTING_EXPAND:
399                         return true;
400                         
401                 /* mute is only supported for NLA */
402                 case ACHANNEL_SETTING_MUTE:
403                         return ((ac) && (ac->spacetype == SPACE_NLA));
404                         
405                 /* select is ok for most "ds*" channels (e.g. dsmat) */
406                 case ACHANNEL_SETTING_SELECT:
407                         return true;
408
409                 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
410                         return true;
411
412                 /* other flags are never supported */
413                 default:
414                         return false;
415         }
416 }
417
418 /* *********************************************** */
419 /* Type Specific Functions + Defines */
420
421 /* Animation Summary ----------------------------------- */
422
423 /* get backdrop color for summary widget */
424 static void acf_summary_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
425 {
426         /* reddish color - same as the 'action' line in NLA */
427         UI_GetThemeColor3fv(TH_ANIM_ACTIVE, r_color);
428 }
429
430 /* backdrop for summary widget */
431 static void acf_summary_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
432 {
433         const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
434         View2D *v2d = &ac->ar->v2d;
435         float color[3];
436         
437         /* set backdrop drawing color */
438         acf->get_backdrop_color(ac, ale, color);
439         
440         /* rounded corners on LHS only 
441          *      - top and bottom 
442          *      - special hack: make the top a bit higher, since we are first... 
443          */
444         UI_draw_roundbox_corner_set(UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT);
445         UI_draw_roundbox_gl_mode_3fvAlpha(GL_TRIANGLE_FAN, 0,  yminc - 2, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8, color, 1.0f);
446 }
447
448 /* name for summary entries */
449 static void acf_summary_name(bAnimListElem *UNUSED(ale), char *name)
450 {
451         if (name)
452                 BLI_strncpy(name, IFACE_("Dope Sheet Summary"), ANIM_CHAN_NAME_SIZE);
453 }
454
455 // FIXME: this is really a temp icon I think
456 static int acf_summary_icon(bAnimListElem *UNUSED(ale))
457 {
458         return ICON_BORDERMOVE;
459 }
460
461 /* check if some setting exists for this channel */
462 static bool acf_summary_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
463 {
464         /* only expanded is supported, as it is used for hiding all stuff which the summary covers */
465         return (setting == ACHANNEL_SETTING_EXPAND);
466 }
467
468 /* get the appropriate flag(s) for the setting when it is valid  */
469 static int acf_summary_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
470 {
471         if (setting == ACHANNEL_SETTING_EXPAND) {
472                 /* expanded */
473                 *neg = true;
474                 return ADS_FLAG_SUMMARY_COLLAPSED;
475         }
476         else {
477                 /* unsupported */
478                 *neg = false;
479                 return 0;
480         }
481 }
482
483 /* get pointer to the setting */
484 static void *acf_summary_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
485 {
486         bAnimContext *ac = (bAnimContext *)ale->data;
487         
488         /* if data is valid, return pointer to active dopesheet's relevant flag 
489          *      - this is restricted to DopeSheet/Action Editor only
490          */
491         if ((ac->sl) && (ac->spacetype == SPACE_ACTION) && (setting == ACHANNEL_SETTING_EXPAND)) {
492                 SpaceAction *saction = (SpaceAction *)ac->sl;
493                 bDopeSheet *ads = &saction->ads;
494                 
495                 /* return pointer to DopeSheet's flag */
496                 return GET_ACF_FLAG_PTR(ads->flag, type);
497         }
498         else {
499                 /* can't return anything useful - unsupported */
500                 *type = 0;
501                 return NULL;
502         }
503 }
504
505 /* all animation summary (DopeSheet only) type define */
506 static bAnimChannelType ACF_SUMMARY = 
507 {
508         "Summary",                          /* type name */
509         ACHANNEL_ROLE_EXPANDER,             /* role */
510
511         acf_summary_color,                  /* backdrop color */
512         acf_summary_backdrop,               /* backdrop */
513         acf_generic_indention_0,            /* indent level */
514         NULL,                               /* offset */
515
516         acf_summary_name,                   /* name */
517         NULL,                               /* name prop */
518         acf_summary_icon,                   /* icon */
519
520         acf_summary_setting_valid,          /* has setting */
521         acf_summary_setting_flag,           /* flag for setting */
522         acf_summary_setting_ptr             /* pointer for setting */
523 };
524
525 /* Scene ------------------------------------------- */
526
527 // TODO: just get this from RNA?
528 static int acf_scene_icon(bAnimListElem *UNUSED(ale))
529 {
530         return ICON_SCENE_DATA;
531 }
532
533 /* check if some setting exists for this channel */
534 static bool acf_scene_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
535 {
536         switch (setting) {
537                 /* muted only in NLA */
538                 case ACHANNEL_SETTING_MUTE: 
539                         return ((ac) && (ac->spacetype == SPACE_NLA));
540                         
541                 /* visible only in Graph Editor */
542                 case ACHANNEL_SETTING_VISIBLE: 
543                         return ((ac) && (ac->spacetype == SPACE_IPO));
544                 
545                 /* only select and expand supported otherwise */
546                 case ACHANNEL_SETTING_SELECT:
547                 case ACHANNEL_SETTING_EXPAND:
548                         return true;
549
550                 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
551                         return false;
552
553                 default:
554                         return false;
555         }
556 }
557
558 /* get the appropriate flag(s) for the setting when it is valid  */
559 static int acf_scene_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
560 {
561         /* clear extra return data first */
562         *neg = false;
563         
564         switch (setting) {
565                 case ACHANNEL_SETTING_SELECT: /* selected */
566                         return SCE_DS_SELECTED;
567                         
568                 case ACHANNEL_SETTING_EXPAND: /* expanded */
569                         *neg = true;
570                         return SCE_DS_COLLAPSED;
571                         
572                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
573                         return ADT_NLA_EVAL_OFF;
574                         
575                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
576                         *neg = true;
577                         return ADT_CURVES_NOT_VISIBLE;
578
579                 default: /* unsupported */
580                         return 0;
581         }
582 }
583
584 /* get pointer to the setting */
585 static void *acf_scene_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
586 {
587         Scene *scene = (Scene *)ale->data;
588         
589         /* clear extra return data first */
590         *type = 0;
591         
592         switch (setting) {
593                 case ACHANNEL_SETTING_SELECT: /* selected */
594                         return GET_ACF_FLAG_PTR(scene->flag, type);
595                         
596                 case ACHANNEL_SETTING_EXPAND: /* expanded */
597                         return GET_ACF_FLAG_PTR(scene->flag, 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, type);
603                         return NULL;
604                         
605                 default: /* unsupported */
606                         return NULL;
607         }
608 }
609
610 /* scene type define */
611 static bAnimChannelType ACF_SCENE = 
612 {
613         "Scene",                        /* type name */
614         ACHANNEL_ROLE_EXPANDER,         /* role */
615
616         acf_generic_root_color,         /* backdrop color */
617         acf_generic_root_backdrop,      /* backdrop */
618         acf_generic_indention_0,        /* indent level */
619         NULL,                           /* offset */
620
621         acf_generic_idblock_name,       /* name */
622         acf_generic_idblock_name_prop,   /* name prop */
623         acf_scene_icon,                 /* icon */
624
625         acf_scene_setting_valid,        /* has setting */
626         acf_scene_setting_flag,         /* flag for setting */
627         acf_scene_setting_ptr           /* pointer for setting */
628 };
629
630 /* Object ------------------------------------------- */
631
632 static int acf_object_icon(bAnimListElem *ale)
633 {
634         Base *base = (Base *)ale->data;
635         Object *ob = base->object;
636         
637         /* icon depends on object-type */
638         switch (ob->type) {
639                 case OB_LAMP:
640                         return ICON_OUTLINER_OB_LAMP;
641                 case OB_MESH: 
642                         return ICON_OUTLINER_OB_MESH;
643                 case OB_CAMERA: 
644                         return ICON_OUTLINER_OB_CAMERA;
645                 case OB_CURVE: 
646                         return ICON_OUTLINER_OB_CURVE;
647                 case OB_MBALL: 
648                         return ICON_OUTLINER_OB_META;
649                 case OB_LATTICE: 
650                         return ICON_OUTLINER_OB_LATTICE;
651                 case OB_SPEAKER:
652                         return ICON_OUTLINER_OB_SPEAKER;
653                 case OB_ARMATURE:
654                         return ICON_OUTLINER_OB_ARMATURE;
655                 case OB_FONT: 
656                         return ICON_OUTLINER_OB_FONT;
657                 case OB_SURF: 
658                         return ICON_OUTLINER_OB_SURFACE;
659                 case OB_EMPTY: 
660                         return ICON_OUTLINER_OB_EMPTY;
661                 default:
662                         return ICON_OBJECT_DATA;
663         }
664 }
665
666 /* name for object */
667 static void acf_object_name(bAnimListElem *ale, char *name)
668 {
669         Base *base = (Base *)ale->data;
670         Object *ob = base->object;
671         
672         /* just copy the name... */
673         if (ob && name)
674                 BLI_strncpy(name, ob->id.name + 2, ANIM_CHAN_NAME_SIZE);
675 }
676
677 /* name property for object */
678 static bool acf_object_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
679 {
680         RNA_id_pointer_create(ale->id, ptr);
681         *prop = RNA_struct_name_property(ptr->type);
682         
683         return (*prop != NULL);
684 }
685
686 /* check if some setting exists for this channel */
687 static bool acf_object_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
688 {
689         Base *base = (Base *)ale->data;
690         Object *ob = base->object;
691         
692         switch (setting) {
693                 /* muted only in NLA */
694                 case ACHANNEL_SETTING_MUTE: 
695                         return ((ac) && (ac->spacetype == SPACE_NLA));
696                         
697                 /* visible only in Graph Editor */
698                 case ACHANNEL_SETTING_VISIBLE: 
699                         return ((ac) && (ac->spacetype == SPACE_IPO) && (ob->adt));
700                 
701                 /* only select and expand supported otherwise */
702                 case ACHANNEL_SETTING_SELECT:
703                 case ACHANNEL_SETTING_EXPAND:
704                         return true;
705
706                 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
707                         return ((ac) && (ac->spacetype == SPACE_IPO) && (ob->adt));
708
709                 default:
710                         return false;
711         }
712 }
713
714 /* get the appropriate flag(s) for the setting when it is valid  */
715 static int acf_object_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
716 {
717         /* clear extra return data first */
718         *neg = false;
719         
720         switch (setting) {
721                 case ACHANNEL_SETTING_SELECT: /* selected */
722                         return SELECT;
723                         
724                 case ACHANNEL_SETTING_EXPAND: /* expanded */
725                         *neg = 1;
726                         return OB_ADS_COLLAPSED;
727                         
728                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
729                         return ADT_NLA_EVAL_OFF;
730                         
731                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
732                         *neg = true;
733                         return ADT_CURVES_NOT_VISIBLE;
734
735                 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
736                         return ADT_CURVES_ALWAYS_VISIBLE;
737
738                 default: /* unsupported */
739                         return 0;
740         }
741 }
742
743 /* get pointer to the setting */
744 static void *acf_object_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
745 {
746         Base *base = (Base *)ale->data;
747         Object *ob = base->object;
748         
749         /* clear extra return data first */
750         *type = 0;
751         
752         switch (setting) {
753                 case ACHANNEL_SETTING_SELECT: /* selected */
754                         return GET_ACF_FLAG_PTR(ob->flag, type);
755                         
756                 case ACHANNEL_SETTING_EXPAND: /* expanded */
757                         return GET_ACF_FLAG_PTR(ob->nlaflag, type); // xxx
758                         
759                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
760                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
761                 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
762                         if (ob->adt)
763                                 return GET_ACF_FLAG_PTR(ob->adt->flag, type);
764                         return NULL;
765
766                 default: /* unsupported */
767                         return NULL;
768         }
769 }
770
771 /* object type define */
772 static bAnimChannelType ACF_OBJECT = 
773 {
774         "Object",                       /* type name */
775         ACHANNEL_ROLE_EXPANDER,         /* role */
776         
777         acf_generic_root_color,         /* backdrop color */
778         acf_generic_root_backdrop,      /* backdrop */
779         acf_generic_indention_0,        /* indent level */
780         NULL,                           /* offset */
781
782         acf_object_name,                /* name */
783         acf_object_name_prop,                   /* name prop */
784         acf_object_icon,                /* icon */
785
786         acf_object_setting_valid,       /* has setting */
787         acf_object_setting_flag,        /* flag for setting */
788         acf_object_setting_ptr          /* pointer for setting */
789 };
790
791 /* Group ------------------------------------------- */
792
793 /* get backdrop color for group widget */
794 static void acf_group_color(bAnimContext *ac, bAnimListElem *ale, float r_color[3])
795 {
796         bActionGroup *agrp = (bActionGroup *)ale->data;
797         bool showGroupColors = acf_show_channel_colors(ac);
798         
799         if (showGroupColors && agrp->customCol) {
800                 unsigned char cp[3];
801                 
802                 /* highlight only for active */
803                 if (ale->flag & AGRP_ACTIVE)
804                         copy_v3_v3_char((char *)cp, agrp->cs.select);
805                 else
806                         copy_v3_v3_char((char *)cp, agrp->cs.solid);
807                 
808                 /* copy the colors over, transforming from bytes to floats */
809                 rgb_uchar_to_float(r_color, cp);
810         }
811         else {
812                 /* highlight only for active */
813                 if (ale->flag & AGRP_ACTIVE)
814                         UI_GetThemeColorShade3fv(TH_GROUP_ACTIVE, 10, r_color);
815                 else
816                         UI_GetThemeColorShade3fv(TH_GROUP, 20, r_color);
817         }
818 }
819
820 /* backdrop for group widget */
821 static void acf_group_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
822 {
823         const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
824         View2D *v2d = &ac->ar->v2d;
825         short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
826         short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
827         float color[3];
828         
829         /* set backdrop drawing color */
830         acf->get_backdrop_color(ac, ale, color);
831         
832         /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */
833         UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
834         UI_draw_roundbox_gl_mode_3fvAlpha(GL_TRIANGLE_FAN, offset,  yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 8, color, 1.0f);
835 }
836
837 /* name for group entries */
838 static void acf_group_name(bAnimListElem *ale, char *name)
839 {
840         bActionGroup *agrp = (bActionGroup *)ale->data;
841         
842         /* just copy the name... */
843         if (agrp && name)
844                 BLI_strncpy(name, agrp->name, ANIM_CHAN_NAME_SIZE);
845 }
846
847 /* name property for group entries */
848 static bool acf_group_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
849 {
850         RNA_pointer_create(ale->id, &RNA_ActionGroup, ale->data, ptr);
851         *prop = RNA_struct_name_property(ptr->type);
852         
853         return (*prop != NULL);
854 }
855
856 /* check if some setting exists for this channel */
857 static bool acf_group_setting_valid(bAnimContext *ac, bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
858 {
859         /* for now, all settings are supported, though some are only conditionally */
860         switch (setting) {
861                 /* unsupported */
862                 case ACHANNEL_SETTING_SOLO:    /* Only available in NLA Editor for tracks */
863                         return false;
864                 
865                 /* conditionally supported */
866                 case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
867                         return (ac->spacetype == SPACE_IPO);
868
869                 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
870                         return (ac->spacetype == SPACE_IPO);
871
872                 default: /* always supported */
873                         return true;
874         }
875 }
876
877 /* get the appropriate flag(s) for the setting when it is valid  */
878 static int acf_group_setting_flag(bAnimContext *ac, eAnimChannel_Settings setting, bool *neg)
879 {
880         /* clear extra return data first */
881         *neg = false;
882         
883         switch (setting) {
884                 case ACHANNEL_SETTING_SELECT: /* selected */
885                         return AGRP_SELECTED;
886                         
887                 case ACHANNEL_SETTING_EXPAND: /* expanded */
888                 {
889                         /* NOTE: Graph Editor uses a different flag to everywhere else for this,
890                          * allowing different collapsing of groups there, since sharing the flag
891                          * proved to be a hazard for workflows...
892                          */
893                         return (ac->spacetype == SPACE_IPO) ? 
894                                AGRP_EXPANDED_G :        /* Graph Editor case */
895                                AGRP_EXPANDED;           /* DopeSheet and elsewhere */
896                 }
897                         
898                 case ACHANNEL_SETTING_MUTE: /* muted */
899                         return AGRP_MUTED;
900
901                 case ACHANNEL_SETTING_MOD_OFF: /* muted */
902                         *neg = 1;
903                         return AGRP_MODIFIERS_OFF;
904
905                 case ACHANNEL_SETTING_PROTECT: /* protected */
906                         return AGRP_PROTECTED;
907                         
908                 case ACHANNEL_SETTING_VISIBLE: /* visibility - graph editor */
909                         *neg = 1;
910                         return AGRP_NOTVISIBLE;
911
912                 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
913                         return ADT_CURVES_ALWAYS_VISIBLE;
914
915                 default:
916                         /* this shouldn't happen */
917                         return 0;
918         }
919 }
920
921 /* get pointer to the setting */
922 static void *acf_group_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
923 {
924         bActionGroup *agrp = (bActionGroup *)ale->data;
925         
926         /* all flags are just in agrp->flag for now... */
927         return GET_ACF_FLAG_PTR(agrp->flag, type);
928 }
929
930 /* group type define */
931 static bAnimChannelType ACF_GROUP = 
932 {
933         "Group",                        /* type name */
934         ACHANNEL_ROLE_CHANNEL,          /* role */
935         
936         acf_group_color,                /* backdrop color */
937         acf_group_backdrop,             /* backdrop */
938         acf_generic_indention_0,        /* indent level */
939         acf_generic_group_offset,       /* offset */
940
941         acf_group_name,                 /* name */
942         acf_group_name_prop,            /* name prop */
943         NULL,                           /* icon */
944
945         acf_group_setting_valid,        /* has setting */
946         acf_group_setting_flag,         /* flag for setting */
947         acf_group_setting_ptr           /* pointer for setting */
948 };
949
950 /* F-Curve ------------------------------------------- */
951
952 /* name for fcurve entries */
953 static void acf_fcurve_name(bAnimListElem *ale, char *name)
954 {
955         getname_anim_fcurve(name, ale->id, ale->data);
956 }
957
958 /* "name" property for fcurve entries */
959 static bool acf_fcurve_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
960 {
961         FCurve *fcu = (FCurve *)ale->data;
962         
963         /* Ctrl-Click Usability Convenience Hack: 
964          * For disabled F-Curves, allow access to the RNA Path 
965          * as our "name" so that user can perform quick fixes
966          */
967         if (fcu->flag & FCURVE_DISABLED) {
968                 RNA_pointer_create(ale->id, &RNA_FCurve, ale->data, ptr);
969                 *prop = RNA_struct_find_property(ptr, "data_path");
970         }
971         else {
972                 /* for "normal" F-Curves - no editable name, but *prop may not be set properly yet... */
973                 *prop = NULL;
974         }
975         
976         return (*prop != NULL);
977 }
978
979 /* check if some setting exists for this channel */
980 static bool acf_fcurve_setting_valid(bAnimContext *ac, bAnimListElem *ale, eAnimChannel_Settings setting)
981 {
982         FCurve *fcu = (FCurve *)ale->data;
983         
984         switch (setting) {
985                 /* unsupported */
986                 case ACHANNEL_SETTING_SOLO:   /* Solo Flag is only for NLA */
987                 case ACHANNEL_SETTING_EXPAND: /* F-Curves are not containers */
988                 case ACHANNEL_SETTING_PINNED: /* This is only for NLA Actions */
989                         return false;
990                 
991                 /* conditionally available */
992                 case ACHANNEL_SETTING_PROTECT: /* Protection is only valid when there's keyframes */
993                         if (fcu->bezt)
994                                 return true;
995                         else
996                                 return false;  // NOTE: in this special case, we need to draw ICON_ZOOMOUT
997                                 
998                 case ACHANNEL_SETTING_VISIBLE: /* Only available in Graph Editor */
999                         return (ac->spacetype == SPACE_IPO);
1000
1001                 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
1002                         return false;
1003
1004                 /* always available */
1005                 default:
1006                         return true;
1007         }
1008 }
1009
1010 /* get the appropriate flag(s) for the setting when it is valid  */
1011 static int acf_fcurve_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1012 {
1013         /* clear extra return data first */
1014         *neg = false;
1015         
1016         switch (setting) {
1017                 case ACHANNEL_SETTING_SELECT: /* selected */
1018                         return FCURVE_SELECTED;
1019                         
1020                 case ACHANNEL_SETTING_MUTE: /* muted */
1021                         return FCURVE_MUTED;
1022                         
1023                 case ACHANNEL_SETTING_PROTECT: /* protected */
1024                         return FCURVE_PROTECTED;
1025                         
1026                 case ACHANNEL_SETTING_VISIBLE: /* visibility - graph editor */
1027                         return FCURVE_VISIBLE;
1028                         
1029                 case ACHANNEL_SETTING_MOD_OFF:
1030                         *neg = 1;
1031                         return FCURVE_MOD_OFF;
1032
1033                 default: /* unsupported */
1034                         return 0;
1035         }
1036 }
1037
1038 /* get pointer to the setting */
1039 static void *acf_fcurve_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
1040 {
1041         FCurve *fcu = (FCurve *)ale->data;
1042         
1043         /* all flags are just in agrp->flag for now... */
1044         return GET_ACF_FLAG_PTR(fcu->flag, type);
1045 }
1046
1047 /* fcurve type define */
1048 static bAnimChannelType ACF_FCURVE = 
1049 {
1050         "F-Curve",                      /* type name */
1051         ACHANNEL_ROLE_CHANNEL,          /* role */
1052         
1053         acf_generic_channel_color,      /* backdrop color */
1054         acf_generic_channel_backdrop,   /* backdrop */
1055         acf_generic_indention_flexible, /* indent level */      // xxx rename this to f-curves only?
1056         acf_generic_group_offset,       /* offset */
1057
1058         acf_fcurve_name,                /* name */
1059         acf_fcurve_name_prop,           /* name prop */
1060         NULL,                           /* icon */
1061
1062         acf_fcurve_setting_valid,       /* has setting */
1063         acf_fcurve_setting_flag,        /* flag for setting */
1064         acf_fcurve_setting_ptr          /* pointer for setting */
1065 };
1066
1067 /* NLA Control FCurves Expander ----------------------- */
1068
1069 /* get backdrop color for nla controls widget */
1070 static void acf_nla_controls_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
1071 {
1072         // TODO: give this its own theme setting?
1073         UI_GetThemeColorShade3fv(TH_GROUP, 55, r_color);
1074 }
1075
1076 /* backdrop for nla controls expander widget */
1077 static void acf_nla_controls_backdrop(bAnimContext *ac, bAnimListElem *ale, float yminc, float ymaxc)
1078 {
1079         const bAnimChannelType *acf = ANIM_channel_get_typeinfo(ale);
1080         View2D *v2d = &ac->ar->v2d;
1081         short expanded = ANIM_channel_setting_get(ac, ale, ACHANNEL_SETTING_EXPAND) != 0;
1082         short offset = (acf->get_offset) ? acf->get_offset(ac, ale) : 0;
1083         float color[3];
1084         
1085         /* set backdrop drawing color */
1086         acf->get_backdrop_color(ac, ale, color);
1087         
1088         /* rounded corners on LHS only - top only when expanded, but bottom too when collapsed */       
1089         UI_draw_roundbox_corner_set(expanded ? UI_CNR_TOP_LEFT : (UI_CNR_TOP_LEFT | UI_CNR_BOTTOM_LEFT));
1090         UI_draw_roundbox_gl_mode_3fvAlpha(GL_TRIANGLE_FAN, offset,  yminc, v2d->cur.xmax + EXTRA_SCROLL_PAD, ymaxc, 5, color, 1.0f);
1091 }
1092
1093 /* name for nla controls expander entries */
1094 static void acf_nla_controls_name(bAnimListElem *UNUSED(ale), char *name)
1095 {
1096         BLI_strncpy(name, IFACE_("NLA Strip Controls"), ANIM_CHAN_NAME_SIZE);
1097 }
1098
1099 /* check if some setting exists for this channel */
1100 static bool acf_nla_controls_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
1101 {
1102         /* for now, all settings are supported, though some are only conditionally */
1103         switch (setting) {
1104                 /* supported */
1105                 case ACHANNEL_SETTING_EXPAND:
1106                         return true;
1107                 
1108                 // TOOD: selected?
1109                 
1110                 default: /* unsupported */
1111                         return false;
1112         }
1113 }
1114
1115 /* get the appropriate flag(s) for the setting when it is valid  */
1116 static int acf_nla_controls_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1117 {
1118         /* clear extra return data first */
1119         *neg = false;
1120         
1121         switch (setting) {
1122                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1123                         *neg = true;
1124                         return ADT_NLA_SKEYS_COLLAPSED;
1125                 
1126                 default:
1127                         /* this shouldn't happen */
1128                         return 0;
1129         }
1130 }
1131
1132 /* get pointer to the setting */
1133 static void *acf_nla_controls_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
1134 {
1135         AnimData *adt = (AnimData *)ale->data;
1136         
1137         /* all flags are just in adt->flag for now... */
1138         return GET_ACF_FLAG_PTR(adt->flag, type);
1139 }
1140
1141 static int acf_nla_controls_icon(bAnimListElem *UNUSED(ale))
1142 {
1143         return ICON_NLA;
1144 }
1145
1146 /* NLA Control FCurves Expander type define */
1147 static bAnimChannelType ACF_NLACONTROLS = 
1148 {
1149         "NLA Controls Expander",        /* type name */
1150         ACHANNEL_ROLE_EXPANDER,         /* role */
1151         
1152         acf_nla_controls_color,         /* backdrop color */
1153         acf_nla_controls_backdrop,      /* backdrop */
1154         acf_generic_indention_0,        /* indent level */
1155         acf_generic_group_offset,       /* offset */
1156
1157         acf_nla_controls_name,          /* name */
1158         NULL,                           /* name prop */
1159         acf_nla_controls_icon,          /* icon */
1160
1161         acf_nla_controls_setting_valid, /* has setting */
1162         acf_nla_controls_setting_flag,  /* flag for setting */
1163         acf_nla_controls_setting_ptr    /* pointer for setting */
1164 };
1165
1166
1167 /* NLA Control F-Curve -------------------------------- */
1168
1169 /* name for nla control fcurve entries */
1170 static void acf_nla_curve_name(bAnimListElem *ale, char *name)
1171 {
1172         NlaStrip *strip = ale->owner;
1173         FCurve *fcu = ale->data;
1174         PropertyRNA *prop;
1175         
1176         /* try to get RNA property that this shortened path (relative to the strip) refers to */
1177         prop = RNA_struct_type_find_property(&RNA_NlaStrip, fcu->rna_path);
1178         if (prop) {
1179                 /* "name" of this strip displays the UI identifier + the name of the NlaStrip */
1180                 BLI_snprintf(name, 256, "%s (%s)", RNA_property_ui_name(prop), strip->name);
1181         }
1182         else {
1183                 /* unknown property... */
1184                 BLI_snprintf(name, 256, "%s[%d]", fcu->rna_path, fcu->array_index);
1185         }
1186 }
1187
1188
1189 /* NLA Control F-Curve type define */
1190 static bAnimChannelType ACF_NLACURVE = 
1191 {
1192         "NLA Control F-Curve",          /* type name */
1193         ACHANNEL_ROLE_CHANNEL,          /* role */
1194         
1195         acf_generic_channel_color,      /* backdrop color */
1196         acf_generic_channel_backdrop,   /* backdrop */
1197         acf_generic_indention_1,        /* indent level */
1198         acf_generic_group_offset,       /* offset */
1199
1200         acf_nla_curve_name,             /* name */
1201         acf_fcurve_name_prop,           /* name prop */
1202         NULL,                           /* icon */
1203
1204         acf_fcurve_setting_valid,       /* has setting */
1205         acf_fcurve_setting_flag,        /* flag for setting */
1206         acf_fcurve_setting_ptr          /* pointer for setting */
1207 };
1208
1209 /* Object Action Expander  ------------------------------------------- */
1210
1211 // TODO: just get this from RNA?
1212 static int acf_fillactd_icon(bAnimListElem *UNUSED(ale))
1213 {
1214         return ICON_ACTION;
1215 }
1216
1217 /* check if some setting exists for this channel */
1218 static bool acf_fillactd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
1219 {
1220         switch (setting) {
1221                 /* only select and expand supported */
1222                 case ACHANNEL_SETTING_SELECT:
1223                 case ACHANNEL_SETTING_EXPAND:
1224                         return true;
1225                         
1226                 default:
1227                         return false;
1228         }
1229 }
1230
1231 /* get the appropriate flag(s) for the setting when it is valid  */
1232 static int acf_fillactd_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1233 {
1234         /* clear extra return data first */
1235         *neg = false;
1236         
1237         switch (setting) {
1238                 case ACHANNEL_SETTING_SELECT: /* selected */
1239                         return ADT_UI_SELECTED;
1240                         
1241                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1242                         *neg = true;
1243                         return ACT_COLLAPSED;
1244                 
1245                 default: /* unsupported */
1246                         return 0;
1247         }
1248 }
1249
1250 /* get pointer to the setting */
1251 static void *acf_fillactd_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1252 {
1253         bAction *act = (bAction *)ale->data;
1254         AnimData *adt = ale->adt;
1255         
1256         /* clear extra return data first */
1257         *type = 0;
1258         
1259         switch (setting) {
1260                 case ACHANNEL_SETTING_SELECT: /* selected */
1261                         if (adt) {
1262                                 return GET_ACF_FLAG_PTR(adt->flag, type);
1263                         }
1264                         return NULL;
1265
1266                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1267                         return GET_ACF_FLAG_PTR(act->flag, type);
1268                 
1269                 default: /* unsupported */
1270                         return NULL;
1271         }
1272 }
1273
1274 /* object action expander type define */
1275 static bAnimChannelType ACF_FILLACTD = 
1276 {
1277         "Ob-Action Filler",             /* type name */
1278         ACHANNEL_ROLE_EXPANDER,         /* role */
1279         
1280         acf_generic_dataexpand_color,   /* backdrop color */
1281         acf_generic_dataexpand_backdrop, /* backdrop */
1282         acf_generic_indention_1,        /* indent level */
1283         acf_generic_basic_offset,       /* offset */
1284
1285         acf_generic_idblock_name,       /* name */
1286         acf_generic_idfill_name_prop,    /* name prop */
1287         acf_fillactd_icon,              /* icon */
1288
1289         acf_fillactd_setting_valid,     /* has setting */
1290         acf_fillactd_setting_flag,      /* flag for setting */
1291         acf_fillactd_setting_ptr        /* pointer for setting */
1292 };
1293
1294 /* Drivers Expander  ------------------------------------------- */
1295
1296 // TODO: just get this from RNA?
1297 static int acf_filldrivers_icon(bAnimListElem *UNUSED(ale))
1298 {
1299         return ICON_DRIVER;
1300 }
1301
1302 static void acf_filldrivers_name(bAnimListElem *UNUSED(ale), char *name)
1303 {
1304         BLI_strncpy(name, IFACE_("Drivers"), ANIM_CHAN_NAME_SIZE);
1305 }
1306
1307 /* check if some setting exists for this channel */
1308 // TODO: this could be made more generic
1309 static bool acf_filldrivers_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
1310 {
1311         switch (setting) {
1312                 /* only expand supported */
1313                 case ACHANNEL_SETTING_EXPAND:
1314                         return true;
1315                         
1316                 default:
1317                         return false;
1318         }
1319 }
1320
1321 /* get the appropriate flag(s) for the setting when it is valid  */
1322 static int acf_filldrivers_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1323 {
1324         /* clear extra return data first */
1325         *neg = false;
1326         
1327         switch (setting) {
1328                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1329                         *neg = true;
1330                         return ADT_DRIVERS_COLLAPSED;
1331                 
1332                 default: /* unsupported */
1333                         return 0;
1334         }
1335 }
1336
1337 /* get pointer to the setting */
1338 static void *acf_filldrivers_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1339 {
1340         AnimData *adt = (AnimData *)ale->data;
1341         
1342         /* clear extra return data first */
1343         *type = 0;
1344         
1345         switch (setting) {
1346                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1347                         return GET_ACF_FLAG_PTR(adt->flag, type);
1348                 
1349                 default: /* unsupported */
1350                         return NULL;
1351         }
1352 }
1353
1354 /* drivers expander type define */
1355 static bAnimChannelType ACF_FILLDRIVERS = 
1356 {
1357         "Drivers Filler",               /* type name */
1358         ACHANNEL_ROLE_EXPANDER,         /* role */
1359         
1360         acf_generic_dataexpand_color,   /* backdrop color */
1361         acf_generic_dataexpand_backdrop, /* backdrop */
1362         acf_generic_indention_1,        /* indent level */
1363         acf_generic_basic_offset,       /* offset */
1364
1365         acf_filldrivers_name,           /* name */
1366         NULL,                           /* name prop */
1367         acf_filldrivers_icon,           /* icon */
1368
1369         acf_filldrivers_setting_valid,  /* has setting */
1370         acf_filldrivers_setting_flag,   /* flag for setting */
1371         acf_filldrivers_setting_ptr     /* pointer for setting */
1372 };
1373
1374
1375 /* Material Expander  ------------------------------------------- */
1376
1377 // TODO: just get this from RNA?
1378 static int acf_dsmat_icon(bAnimListElem *UNUSED(ale))
1379 {
1380         return ICON_MATERIAL_DATA;
1381 }
1382
1383 /* get the appropriate flag(s) for the setting when it is valid  */
1384 static int acf_dsmat_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1385 {
1386         /* clear extra return data first */
1387         *neg = false;
1388         
1389         switch (setting) {
1390                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1391                         return MA_DS_EXPAND;
1392                         
1393                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1394                         return ADT_NLA_EVAL_OFF;
1395                         
1396                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1397                         *neg = true;
1398                         return ADT_CURVES_NOT_VISIBLE;
1399                         
1400                 case ACHANNEL_SETTING_SELECT: /* selected */
1401                         return ADT_UI_SELECTED;
1402                 
1403                 default: /* unsupported */
1404                         return 0;
1405         }
1406 }
1407
1408 /* get pointer to the setting */
1409 static void *acf_dsmat_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1410 {
1411         Material *ma = (Material *)ale->data;
1412         
1413         /* clear extra return data first */
1414         *type = 0;
1415         
1416         switch (setting) {
1417                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1418                         return GET_ACF_FLAG_PTR(ma->flag, type);
1419                         
1420                 case ACHANNEL_SETTING_SELECT: /* selected */
1421                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1422                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1423                         if (ma->adt)
1424                                 return GET_ACF_FLAG_PTR(ma->adt->flag, type);
1425                         return NULL;
1426
1427                 default: /* unsupported */
1428                         return NULL;
1429         }
1430 }
1431
1432 /* material expander type define */
1433 static bAnimChannelType ACF_DSMAT =
1434 {
1435         "Material Data Expander",       /* type name */
1436         ACHANNEL_ROLE_EXPANDER,         /* role */
1437         
1438         acf_generic_dataexpand_color,   /* backdrop color */
1439         acf_generic_dataexpand_backdrop, /* backdrop */
1440         acf_generic_indention_1,        /* indent level */
1441         acf_generic_basic_offset,       /* offset */
1442
1443         acf_generic_idblock_name,       /* name */
1444         acf_generic_idblock_name_prop,   /* name prop */
1445         acf_dsmat_icon,                 /* icon */
1446
1447         acf_generic_dataexpand_setting_valid,   /* has setting */
1448         acf_dsmat_setting_flag,                 /* flag for setting */
1449         acf_dsmat_setting_ptr                   /* pointer for setting */
1450 };
1451
1452 /* Lamp Expander  ------------------------------------------- */
1453
1454 // TODO: just get this from RNA?
1455 static int acf_dslam_icon(bAnimListElem *UNUSED(ale))
1456 {
1457         return ICON_LAMP_DATA;
1458 }
1459
1460 /* get the appropriate flag(s) for the setting when it is valid  */
1461 static int acf_dslam_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1462 {
1463         /* clear extra return data first */
1464         *neg = false;
1465         
1466         switch (setting) {
1467                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1468                         return LA_DS_EXPAND;
1469                         
1470                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1471                         return ADT_NLA_EVAL_OFF;
1472                         
1473                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1474                         *neg = true;
1475                         return ADT_CURVES_NOT_VISIBLE;
1476                         
1477                 case ACHANNEL_SETTING_SELECT: /* selected */
1478                         return ADT_UI_SELECTED;
1479                 
1480                 default: /* unsupported */
1481                         return 0;
1482         }
1483 }
1484
1485 /* get pointer to the setting */
1486 static void *acf_dslam_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1487 {
1488         Lamp *la = (Lamp *)ale->data;
1489         
1490         /* clear extra return data first */
1491         *type = 0;
1492         
1493         switch (setting) {
1494                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1495                         return GET_ACF_FLAG_PTR(la->flag, type);
1496                         
1497                 case ACHANNEL_SETTING_SELECT: /* selected */
1498                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1499                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1500                         if (la->adt)
1501                                 return GET_ACF_FLAG_PTR(la->adt->flag, type);
1502                         return NULL;
1503                 
1504                 default: /* unsupported */
1505                         return NULL;
1506         }
1507 }
1508
1509 /* lamp expander type define */
1510 static bAnimChannelType ACF_DSLAM =
1511 {
1512         "Lamp Expander",                /* type name */
1513         ACHANNEL_ROLE_EXPANDER,         /* role */
1514         
1515         acf_generic_dataexpand_color,   /* backdrop color */
1516         acf_generic_dataexpand_backdrop, /* backdrop */
1517         acf_generic_indention_1,        /* indent level */
1518         acf_generic_basic_offset,       /* offset */
1519
1520         acf_generic_idblock_name,       /* name */
1521         acf_generic_idblock_name_prop,   /* name prop */
1522         acf_dslam_icon,                 /* icon */
1523
1524         acf_generic_dataexpand_setting_valid,   /* has setting */
1525         acf_dslam_setting_flag,                 /* flag for setting */
1526         acf_dslam_setting_ptr                   /* pointer for setting */
1527 };
1528
1529 /* Texture Expander  ------------------------------------------- */
1530
1531 // TODO: just get this from RNA?
1532 static int acf_dstex_icon(bAnimListElem *UNUSED(ale))
1533 {
1534         return ICON_TEXTURE_DATA;
1535 }
1536
1537 /* offset for texture expanders */
1538 // FIXME: soon to be obsolete?
1539 static short acf_dstex_offset(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale))
1540 {
1541         return 14; // XXX: simply include this in indention instead?
1542 }
1543
1544 /* get the appropriate flag(s) for the setting when it is valid  */
1545 static int acf_dstex_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1546 {
1547         /* clear extra return data first */
1548         *neg = false;
1549         
1550         switch (setting) {
1551                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1552                         return TEX_DS_EXPAND;
1553                         
1554                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1555                         return ADT_NLA_EVAL_OFF;
1556                         
1557                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1558                         *neg = true;
1559                         return ADT_CURVES_NOT_VISIBLE;
1560                         
1561                 case ACHANNEL_SETTING_SELECT: /* selected */
1562                         return ADT_UI_SELECTED;
1563                 
1564                 default: /* unsupported */
1565                         return 0;
1566         }
1567 }
1568
1569 /* get pointer to the setting */
1570 static void *acf_dstex_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1571 {
1572         Tex *tex = (Tex *)ale->data;
1573         
1574         /* clear extra return data first */
1575         *type = 0;
1576         
1577         switch (setting) {
1578                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1579                         return GET_ACF_FLAG_PTR(tex->flag, type);
1580                         
1581                 case ACHANNEL_SETTING_SELECT: /* selected */
1582                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1583                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1584                         if (tex->adt)
1585                                 return GET_ACF_FLAG_PTR(tex->adt->flag, type);
1586                         return NULL;
1587                 
1588                 default: /* unsupported */
1589                         return NULL;
1590         }
1591 }
1592
1593 /* texture expander type define */
1594 static bAnimChannelType ACF_DSTEX =
1595 {
1596         "Texture Data Expander",        /* type name */
1597         ACHANNEL_ROLE_EXPANDER,         /* role */
1598         
1599         acf_generic_dataexpand_color,   /* backdrop color */
1600         acf_generic_dataexpand_backdrop, /* backdrop */
1601         acf_generic_indention_1,        /* indent level */
1602         acf_dstex_offset,               /* offset */
1603
1604         acf_generic_idblock_name,       /* name */
1605         acf_generic_idfill_name_prop,    /* name prop */
1606         acf_dstex_icon,                 /* icon */
1607
1608         acf_generic_dataexpand_setting_valid,   /* has setting */
1609         acf_dstex_setting_flag,                 /* flag for setting */
1610         acf_dstex_setting_ptr                   /* pointer for setting */
1611 };
1612
1613 /* Camera Expander  ------------------------------------------- */
1614
1615 // TODO: just get this from RNA?
1616 static int acf_dscachefile_icon(bAnimListElem *ale)
1617 {
1618         UNUSED_VARS(ale);
1619         return ICON_FILE;
1620 }
1621
1622 /* get the appropriate flag(s) for the setting when it is valid  */
1623 static int acf_dscachefile_setting_flag(bAnimContext *ac, eAnimChannel_Settings setting, bool *neg)
1624 {
1625         /* clear extra return data first */
1626         *neg = false;
1627
1628         switch (setting) {
1629                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1630                         return CACHEFILE_DS_EXPAND;
1631
1632                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1633                         return ADT_NLA_EVAL_OFF;
1634
1635                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1636                         *neg = true;
1637                         return ADT_CURVES_NOT_VISIBLE;
1638
1639                 case ACHANNEL_SETTING_SELECT: /* selected */
1640                         return ADT_UI_SELECTED;
1641
1642                 default: /* unsupported */
1643                         return 0;
1644         }
1645
1646         UNUSED_VARS(ac);
1647 }
1648
1649 /* get pointer to the setting */
1650 static void *acf_dscachefile_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1651 {
1652         CacheFile *cache_file = (CacheFile *)ale->data;
1653
1654         /* clear extra return data first */
1655         *type = 0;
1656
1657         switch (setting) {
1658                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1659                         return GET_ACF_FLAG_PTR(cache_file->flag, type);
1660
1661                 case ACHANNEL_SETTING_SELECT: /* selected */
1662                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1663                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1664                         if (cache_file->adt) {
1665                                 return GET_ACF_FLAG_PTR(cache_file->adt->flag, type);
1666                         }
1667
1668                         return NULL;
1669
1670                 default: /* unsupported */
1671                         return NULL;
1672         }
1673 }
1674
1675 /* CacheFile expander type define. */
1676 static bAnimChannelType ACF_DSCACHEFILE =
1677 {
1678         "Cache File Expander",          /* type name */
1679         ACHANNEL_ROLE_EXPANDER,         /* role */
1680
1681         acf_generic_dataexpand_color,   /* backdrop color */
1682         acf_generic_dataexpand_backdrop, /* backdrop */
1683         acf_generic_indention_1,        /* indent level */
1684         acf_generic_basic_offset,       /* offset */
1685
1686         acf_generic_idblock_name,       /* name */
1687         acf_generic_idfill_name_prop,   /* name prop */
1688         acf_dscachefile_icon,           /* icon */
1689
1690         acf_generic_dataexpand_setting_valid,   /* has setting */
1691         acf_dscachefile_setting_flag,           /* flag for setting */
1692         acf_dscachefile_setting_ptr             /* pointer for setting */
1693 };
1694
1695 /* Camera Expander  ------------------------------------------- */
1696
1697 // TODO: just get this from RNA?
1698 static int acf_dscam_icon(bAnimListElem *UNUSED(ale))
1699 {
1700         return ICON_CAMERA_DATA;
1701 }
1702
1703 /* get the appropriate flag(s) for the setting when it is valid  */
1704 static int acf_dscam_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1705 {
1706         /* clear extra return data first */
1707         *neg = false;
1708         
1709         switch (setting) {
1710                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1711                         return CAM_DS_EXPAND;
1712                         
1713                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1714                         return ADT_NLA_EVAL_OFF;
1715                         
1716                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1717                         *neg = true;
1718                         return ADT_CURVES_NOT_VISIBLE;
1719                         
1720                 case ACHANNEL_SETTING_SELECT: /* selected */
1721                         return ADT_UI_SELECTED;
1722
1723                 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
1724                         return ADT_CURVES_ALWAYS_VISIBLE;
1725
1726                 default: /* unsupported */
1727                         return 0;
1728         }
1729 }
1730
1731 /* get pointer to the setting */
1732 static void *acf_dscam_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1733 {
1734         Camera *ca = (Camera *)ale->data;
1735         
1736         /* clear extra return data first */
1737         *type = 0;
1738         
1739         switch (setting) {
1740                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1741                         return GET_ACF_FLAG_PTR(ca->flag, type);
1742                         
1743                 case ACHANNEL_SETTING_SELECT: /* selected */
1744                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1745                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1746                 case ACHANNEL_SETTING_ALWAYS_VISIBLE:
1747                         if (ca->adt)
1748                                 return GET_ACF_FLAG_PTR(ca->adt->flag, type);
1749                         return NULL;
1750                 
1751                 default: /* unsupported */
1752                         return NULL;
1753         }
1754 }
1755
1756 /* camera expander type define */
1757 static bAnimChannelType ACF_DSCAM =
1758 {
1759         "Camera Expander",              /* type name */
1760         ACHANNEL_ROLE_EXPANDER,         /* role */
1761         
1762         acf_generic_dataexpand_color,   /* backdrop color */
1763         acf_generic_dataexpand_backdrop, /* backdrop */
1764         acf_generic_indention_1,        /* indent level */
1765         acf_generic_basic_offset,       /* offset */
1766
1767         acf_generic_idblock_name,       /* name */
1768         acf_generic_idfill_name_prop,    /* name prop */
1769         acf_dscam_icon,                 /* icon */
1770
1771         acf_generic_dataexpand_setting_valid,   /* has setting */
1772         acf_dscam_setting_flag,                 /* flag for setting */
1773         acf_dscam_setting_ptr                   /* pointer for setting */
1774 };
1775
1776 /* Curve Expander  ------------------------------------------- */
1777
1778 // TODO: just get this from RNA?
1779 static int acf_dscur_icon(bAnimListElem *ale)
1780 {
1781         Curve *cu = (Curve *)ale->data;
1782         short obtype = BKE_curve_type_get(cu);
1783         
1784         switch (obtype) {
1785                 case OB_FONT:
1786                         return ICON_FONT_DATA;
1787                 case OB_SURF:
1788                         return ICON_SURFACE_DATA;
1789                 default:
1790                         return ICON_CURVE_DATA;
1791         }
1792 }
1793
1794 /* get the appropriate flag(s) for the setting when it is valid  */
1795 static int acf_dscur_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1796 {
1797         /* clear extra return data first */
1798         *neg = false;
1799         
1800         switch (setting) {
1801                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1802                         return CU_DS_EXPAND;
1803                         
1804                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1805                         return ADT_NLA_EVAL_OFF;
1806                         
1807                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1808                         *neg = true;
1809                         return ADT_CURVES_NOT_VISIBLE;
1810                         
1811                 case ACHANNEL_SETTING_SELECT: /* selected */
1812                         return ADT_UI_SELECTED;
1813                 
1814                 default: /* unsupported */
1815                         return 0;
1816         }
1817 }
1818
1819 /* get pointer to the setting */
1820 static void *acf_dscur_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1821 {
1822         Curve *cu = (Curve *)ale->data;
1823         
1824         /* clear extra return data first */
1825         *type = 0;
1826         
1827         switch (setting) {
1828                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1829                         return GET_ACF_FLAG_PTR(cu->flag, type);
1830                         
1831                 case ACHANNEL_SETTING_SELECT: /* selected */
1832                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1833                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1834                         if (cu->adt)
1835                                 return GET_ACF_FLAG_PTR(cu->adt->flag, type);
1836                         return NULL;
1837                 
1838                 default: /* unsupported */
1839                         return NULL;
1840         }
1841 }
1842
1843 /* curve expander type define */
1844 static bAnimChannelType ACF_DSCUR =
1845 {
1846         "Curve Expander",               /* type name */
1847         ACHANNEL_ROLE_EXPANDER,         /* role */
1848         
1849         acf_generic_dataexpand_color,   /* backdrop color */
1850         acf_generic_dataexpand_backdrop, /* backdrop */
1851         acf_generic_indention_1,        /* indent level */
1852         acf_generic_basic_offset,       /* offset */
1853
1854         acf_generic_idblock_name,       /* name */
1855         acf_generic_idblock_name_prop,   /* name prop */
1856         acf_dscur_icon,                 /* icon */
1857
1858         acf_generic_dataexpand_setting_valid,   /* has setting */
1859         acf_dscur_setting_flag,                 /* flag for setting */
1860         acf_dscur_setting_ptr                   /* pointer for setting */
1861 };
1862
1863 /* Shape Key Expander  ------------------------------------------- */
1864
1865 // TODO: just get this from RNA?
1866 static int acf_dsskey_icon(bAnimListElem *UNUSED(ale))
1867 {
1868         return ICON_SHAPEKEY_DATA;
1869 }
1870
1871 /* get the appropriate flag(s) for the setting when it is valid  */
1872 static int acf_dsskey_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1873 {
1874         /* clear extra return data first */
1875         *neg = false;
1876         
1877         switch (setting) {
1878                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1879                         return KEY_DS_EXPAND;
1880                         
1881                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1882                         return ADT_NLA_EVAL_OFF;
1883                         
1884                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1885                         *neg = true;
1886                         return ADT_CURVES_NOT_VISIBLE;
1887                         
1888                 case ACHANNEL_SETTING_SELECT: /* selected */
1889                         return ADT_UI_SELECTED;
1890                 
1891                 default: /* unsupported */
1892                         return 0;
1893         }
1894 }
1895
1896 /* get pointer to the setting */
1897 static void *acf_dsskey_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1898 {
1899         Key *key = (Key *)ale->data;
1900         
1901         /* clear extra return data first */
1902         *type = 0;
1903         
1904         switch (setting) {
1905                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1906                         return GET_ACF_FLAG_PTR(key->flag, type);
1907                         
1908                 case ACHANNEL_SETTING_SELECT: /* selected */
1909                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1910                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1911                         if (key->adt)
1912                                 return GET_ACF_FLAG_PTR(key->adt->flag, type);
1913                         return NULL;
1914                 
1915                 default: /* unsupported */
1916                         return NULL;
1917         }
1918 }
1919
1920 /* shapekey expander type define */
1921 static bAnimChannelType ACF_DSSKEY =
1922 {
1923         "Shape Key Expander",           /* type name */
1924         ACHANNEL_ROLE_EXPANDER,         /* role */
1925         
1926         acf_generic_dataexpand_color,   /* backdrop color */
1927         acf_generic_dataexpand_backdrop, /* backdrop */
1928         acf_generic_indention_1,        /* indent level */
1929         acf_generic_basic_offset,       /* offset */
1930
1931         acf_generic_idblock_name,       /* name */
1932         acf_generic_idblock_name_prop,   /* name prop */
1933         acf_dsskey_icon,                /* icon */
1934
1935         acf_generic_dataexpand_setting_valid,   /* has setting */
1936         acf_dsskey_setting_flag,                /* flag for setting */
1937         acf_dsskey_setting_ptr                  /* pointer for setting */
1938 };
1939
1940 /* World Expander  ------------------------------------------- */
1941
1942 // TODO: just get this from RNA?
1943 static int acf_dswor_icon(bAnimListElem *UNUSED(ale))
1944 {
1945         return ICON_WORLD_DATA;
1946 }
1947
1948 /* get the appropriate flag(s) for the setting when it is valid  */
1949 static int acf_dswor_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
1950 {
1951         /* clear extra return data first */
1952         *neg = false;
1953         
1954         switch (setting) {
1955                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1956                         return WO_DS_EXPAND;
1957                         
1958                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
1959                         return ADT_NLA_EVAL_OFF;
1960                         
1961                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
1962                         *neg = true;
1963                         return ADT_CURVES_NOT_VISIBLE;
1964                         
1965                 case ACHANNEL_SETTING_SELECT: /* selected */
1966                         return ADT_UI_SELECTED;
1967                 
1968                 default: /* unsupported */
1969                         return 0;
1970         }
1971 }
1972
1973 /* get pointer to the setting */
1974 static void *acf_dswor_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
1975 {
1976         World *wo = (World *)ale->data;
1977         
1978         /* clear extra return data first */
1979         *type = 0;
1980         
1981         switch (setting) {
1982                 case ACHANNEL_SETTING_EXPAND: /* expanded */
1983                         return GET_ACF_FLAG_PTR(wo->flag, type);
1984                         
1985                 case ACHANNEL_SETTING_SELECT: /* selected */
1986                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
1987                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
1988                         if (wo->adt)
1989                                 return GET_ACF_FLAG_PTR(wo->adt->flag, type);
1990                         return NULL;
1991                 
1992                 default: /* unsupported */
1993                         return NULL;
1994         }
1995 }
1996
1997 /* world expander type define */
1998 static bAnimChannelType ACF_DSWOR =
1999 {
2000         "World Expander",               /* type name */
2001         ACHANNEL_ROLE_EXPANDER,         /* role */
2002         
2003         acf_generic_dataexpand_color,   /* backdrop color */
2004         acf_generic_dataexpand_backdrop, /* backdrop */
2005         acf_generic_indention_1,        /* indent level */
2006         acf_generic_basic_offset,       /* offset */
2007
2008         acf_generic_idblock_name,       /* name */
2009         acf_generic_idfill_name_prop,    /* name prop */
2010         acf_dswor_icon,                 /* icon */
2011
2012         acf_generic_dataexpand_setting_valid,   /* has setting */
2013         acf_dswor_setting_flag,                 /* flag for setting */
2014         acf_dswor_setting_ptr                   /* pointer for setting */
2015 };
2016
2017 /* Particle Expander  ------------------------------------------- */
2018
2019 // TODO: just get this from RNA?
2020 static int acf_dspart_icon(bAnimListElem *UNUSED(ale))
2021 {
2022         return ICON_PARTICLE_DATA;
2023 }
2024
2025 /* get the appropriate flag(s) for the setting when it is valid  */
2026 static int acf_dspart_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2027 {
2028         /* clear extra return data first */
2029         *neg = false;
2030         
2031         switch (setting) {
2032                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2033                         return 0;
2034                         
2035                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2036                         return ADT_NLA_EVAL_OFF;
2037                         
2038                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2039                         *neg = true;
2040                         return ADT_CURVES_NOT_VISIBLE;
2041                         
2042                 case ACHANNEL_SETTING_SELECT: /* selected */
2043                         return ADT_UI_SELECTED;
2044                 
2045                 default: /* unsupported */
2046                         return 0;
2047         }
2048 }
2049
2050 /* get pointer to the setting */
2051 static void *acf_dspart_setting_ptr(bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting, short *type)
2052 {
2053         /* clear extra return data first */
2054         *type = 0;
2055         
2056         switch (setting) {
2057                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2058                         return NULL;
2059                         
2060                 case ACHANNEL_SETTING_SELECT: /* selected */
2061                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2062                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2063                         return NULL;
2064                 
2065                 default: /* unsupported */
2066                         return NULL;
2067         }
2068 }
2069
2070 /* particle expander type define */
2071 static bAnimChannelType ACF_DSPART =
2072 {
2073         "Particle Data Expander",       /* type name */
2074         ACHANNEL_ROLE_EXPANDER,         /* role */
2075         
2076         acf_generic_dataexpand_color,   /* backdrop color */
2077         acf_generic_dataexpand_backdrop, /* backdrop */
2078         acf_generic_indention_1,        /* indent level */
2079         acf_generic_basic_offset,       /* offset */
2080
2081         acf_generic_idblock_name,       /* name */
2082         acf_generic_idblock_name_prop,   /* name prop */
2083         acf_dspart_icon,                /* icon */
2084
2085         acf_generic_dataexpand_setting_valid,   /* has setting */
2086         acf_dspart_setting_flag,                /* flag for setting */
2087         acf_dspart_setting_ptr                  /* pointer for setting */
2088 };
2089
2090 /* MetaBall Expander  ------------------------------------------- */
2091
2092 // TODO: just get this from RNA?
2093 static int acf_dsmball_icon(bAnimListElem *UNUSED(ale))
2094 {
2095         return ICON_META_DATA;
2096 }
2097
2098 /* get the appropriate flag(s) for the setting when it is valid  */
2099 static int acf_dsmball_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2100 {
2101         /* clear extra return data first */
2102         *neg = false;
2103         
2104         switch (setting) {
2105                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2106                         return MB_DS_EXPAND;
2107                         
2108                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2109                         return ADT_NLA_EVAL_OFF;
2110                         
2111                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2112                         *neg = true;
2113                         return ADT_CURVES_NOT_VISIBLE;
2114                 
2115                 case ACHANNEL_SETTING_SELECT: /* selected */
2116                         return ADT_UI_SELECTED;
2117                 
2118                 default: /* unsupported */
2119                         return 0;
2120         }
2121 }
2122
2123 /* get pointer to the setting */
2124 static void *acf_dsmball_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2125 {
2126         MetaBall *mb = (MetaBall *)ale->data;
2127         
2128         /* clear extra return data first */
2129         *type = 0;
2130         
2131         switch (setting) {
2132                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2133                         return GET_ACF_FLAG_PTR(mb->flag2, type);
2134                         
2135                 case ACHANNEL_SETTING_SELECT: /* selected */
2136                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2137                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2138                         if (mb->adt)
2139                                 return GET_ACF_FLAG_PTR(mb->adt->flag, type);
2140                         return NULL;
2141                 
2142                 default: /* unsupported */
2143                         return NULL;
2144         }
2145 }
2146
2147 /* metaball expander type define */
2148 static bAnimChannelType ACF_DSMBALL =
2149 {
2150         "Metaball Expander",            /* type name */
2151         ACHANNEL_ROLE_EXPANDER,         /* role */
2152         
2153         acf_generic_dataexpand_color,   /* backdrop color */
2154         acf_generic_dataexpand_backdrop, /* backdrop */
2155         acf_generic_indention_1,        /* indent level */
2156         acf_generic_basic_offset,       /* offset */
2157
2158         acf_generic_idblock_name,       /* name */
2159         acf_generic_idblock_name_prop,   /* name prop */
2160         acf_dsmball_icon,               /* icon */
2161
2162         acf_generic_dataexpand_setting_valid,   /* has setting */
2163         acf_dsmball_setting_flag,               /* flag for setting */
2164         acf_dsmball_setting_ptr                 /* pointer for setting */
2165 };
2166
2167 /* Armature Expander  ------------------------------------------- */
2168
2169 // TODO: just get this from RNA?
2170 static int acf_dsarm_icon(bAnimListElem *UNUSED(ale))
2171 {
2172         return ICON_ARMATURE_DATA;
2173 }
2174
2175 /* get the appropriate flag(s) for the setting when it is valid  */
2176 static int acf_dsarm_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2177 {
2178         /* clear extra return data first */
2179         *neg = false;
2180         
2181         switch (setting) {
2182                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2183                         return ARM_DS_EXPAND;
2184                         
2185                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2186                         return ADT_NLA_EVAL_OFF;
2187                         
2188                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2189                         *neg = true;
2190                         return ADT_CURVES_NOT_VISIBLE;
2191                         
2192                 case ACHANNEL_SETTING_SELECT: /* selected */
2193                         return ADT_UI_SELECTED;
2194                 
2195                 default: /* unsupported */
2196                         return 0;
2197         }
2198 }
2199
2200 /* get pointer to the setting */
2201 static void *acf_dsarm_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2202 {
2203         bArmature *arm = (bArmature *)ale->data;
2204         
2205         /* clear extra return data first */
2206         *type = 0;
2207         
2208         switch (setting) {
2209                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2210                         return GET_ACF_FLAG_PTR(arm->flag, type);
2211                         
2212                 case ACHANNEL_SETTING_SELECT: /* selected */
2213                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2214                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2215                         if (arm->adt)
2216                                 return GET_ACF_FLAG_PTR(arm->adt->flag, type);
2217                         return NULL;
2218                 
2219                 default: /* unsupported */
2220                         return NULL;
2221         }
2222 }
2223
2224 /* metaball expander type define */
2225 static bAnimChannelType ACF_DSARM =
2226 {
2227         "Armature Expander",            /* type name */
2228         ACHANNEL_ROLE_EXPANDER,         /* role */
2229         
2230         acf_generic_dataexpand_color,   /* backdrop color */
2231         acf_generic_dataexpand_backdrop, /* backdrop */
2232         acf_generic_indention_1,        /* indent level */
2233         acf_generic_basic_offset,       /* offset */
2234
2235         acf_generic_idblock_name,       /* name */
2236         acf_generic_idblock_name_prop,   /* name prop */
2237         acf_dsarm_icon,             /* icon */
2238
2239         acf_generic_dataexpand_setting_valid,   /* has setting */
2240         acf_dsarm_setting_flag,                 /* flag for setting */
2241         acf_dsarm_setting_ptr                   /* pointer for setting */
2242 };
2243
2244 /* NodeTree Expander  ------------------------------------------- */
2245
2246 // TODO: just get this from RNA?
2247 static int acf_dsntree_icon(bAnimListElem *UNUSED(ale))
2248 {
2249         return ICON_NODETREE;
2250 }
2251
2252 /* offset for nodetree expanders */
2253 static short acf_dsntree_offset(bAnimContext *ac, bAnimListElem *ale)
2254 {
2255         bNodeTree *ntree = (bNodeTree *)ale->data;
2256         short offset = acf_generic_basic_offset(ac, ale);
2257         
2258         offset += acf_nodetree_rootType_offset(ntree); 
2259         
2260         return offset;
2261 }
2262
2263 /* get the appropriate flag(s) for the setting when it is valid  */
2264 static int acf_dsntree_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2265 {
2266         /* clear extra return data first */
2267         *neg = false;
2268         
2269         switch (setting) {
2270                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2271                         return NTREE_DS_EXPAND;
2272                         
2273                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2274                         return ADT_NLA_EVAL_OFF;
2275                         
2276                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2277                         *neg = true;
2278                         return ADT_CURVES_NOT_VISIBLE;
2279                         
2280                 case ACHANNEL_SETTING_SELECT: /* selected */
2281                         return ADT_UI_SELECTED;
2282                         
2283                 default: /* unsupported */
2284                         return 0;
2285         }
2286 }
2287
2288 /* get pointer to the setting */
2289 static void *acf_dsntree_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2290 {
2291         bNodeTree *ntree = (bNodeTree *)ale->data;
2292         
2293         /* clear extra return data first */
2294         *type = 0;
2295         
2296         switch (setting) {
2297                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2298                         return GET_ACF_FLAG_PTR(ntree->flag, type);
2299                         
2300                 case ACHANNEL_SETTING_SELECT: /* selected */
2301                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2302                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2303                         if (ntree->adt)
2304                                 return GET_ACF_FLAG_PTR(ntree->adt->flag, type);
2305                         return NULL;
2306                         
2307                 default: /* unsupported */
2308                         return NULL;
2309         }
2310 }
2311
2312 /* node tree expander type define */
2313 static bAnimChannelType ACF_DSNTREE =
2314 {
2315         "Node Tree Expander",           /* type name */
2316         ACHANNEL_ROLE_EXPANDER,         /* role */
2317         
2318         acf_generic_dataexpand_color,   /* backdrop color */
2319         acf_generic_dataexpand_backdrop, /* backdrop */
2320         acf_generic_indention_1,        /* indent level */
2321         acf_dsntree_offset,             /* offset */
2322
2323         acf_generic_idblock_name,       /* name */
2324         acf_generic_idblock_name_prop,   /* name prop */
2325         acf_dsntree_icon,               /* icon */
2326
2327         acf_generic_dataexpand_setting_valid,   /* has setting */
2328         acf_dsntree_setting_flag,               /* flag for setting */
2329         acf_dsntree_setting_ptr                 /* pointer for setting */
2330 };
2331
2332 /* LineStyle Expander  ------------------------------------------- */
2333
2334 /* TODO: just get this from RNA? */
2335 static int acf_dslinestyle_icon(bAnimListElem *UNUSED(ale))
2336 {
2337         return ICON_LINE_DATA;
2338 }
2339
2340 /* get the appropriate flag(s) for the setting when it is valid  */
2341 static int acf_dslinestyle_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2342 {
2343         /* clear extra return data first */
2344         *neg = false;
2345         
2346         switch (setting) {
2347                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2348                         return LS_DS_EXPAND;
2349                         
2350                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2351                         return ADT_NLA_EVAL_OFF;
2352                         
2353                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2354                         *neg = true;
2355                         return ADT_CURVES_NOT_VISIBLE;
2356                         
2357                 case ACHANNEL_SETTING_SELECT: /* selected */
2358                         return ADT_UI_SELECTED;
2359                         
2360                 default: /* unsupported */
2361                         return 0;
2362         }
2363 }
2364
2365 /* get pointer to the setting */
2366 static void *acf_dslinestyle_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2367 {
2368         FreestyleLineStyle *linestyle = (FreestyleLineStyle *)ale->data;
2369         
2370         /* clear extra return data first */
2371         *type = 0;
2372         
2373         switch (setting) {
2374                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2375                         return GET_ACF_FLAG_PTR(linestyle->flag, type);
2376                         
2377                 case ACHANNEL_SETTING_SELECT: /* selected */
2378                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2379                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2380                         if (linestyle->adt)
2381                                 return GET_ACF_FLAG_PTR(linestyle->adt->flag, type);
2382                         return NULL;
2383                         
2384                 default: /* unsupported */
2385                         return NULL;
2386         }
2387 }
2388
2389 /* node tree expander type define */
2390 static bAnimChannelType ACF_DSLINESTYLE =
2391 {
2392         "Line Style Expander",                  /* type name */
2393         ACHANNEL_ROLE_EXPANDER,         /* role */
2394         
2395         acf_generic_dataexpand_color,   /* backdrop color */
2396         acf_generic_dataexpand_backdrop,/* backdrop */
2397         acf_generic_indention_1,                /* indent level */
2398         acf_generic_basic_offset,               /* offset */
2399         
2400         acf_generic_idblock_name,               /* name */
2401         acf_generic_idblock_name_prop,  /* name prop */
2402         acf_dslinestyle_icon,                   /* icon */
2403         
2404         acf_generic_dataexpand_setting_valid,   /* has setting */
2405         acf_dslinestyle_setting_flag,                   /* flag for setting */
2406         acf_dslinestyle_setting_ptr                             /* pointer for setting */
2407 };
2408
2409 /* Mesh Expander  ------------------------------------------- */
2410
2411 // TODO: just get this from RNA?
2412 static int acf_dsmesh_icon(bAnimListElem *UNUSED(ale))
2413 {
2414         return ICON_MESH_DATA;
2415 }
2416
2417 /* get the appropriate flag(s) for the setting when it is valid  */
2418 static int acf_dsmesh_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2419 {
2420         /* clear extra return data first */
2421         *neg = false;
2422         
2423         switch (setting) {
2424                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2425                         return ME_DS_EXPAND;
2426                         
2427                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2428                         return ADT_NLA_EVAL_OFF;
2429                         
2430                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2431                         *neg = true;
2432                         return ADT_CURVES_NOT_VISIBLE;
2433                         
2434                 case ACHANNEL_SETTING_SELECT: /* selected */
2435                         return ADT_UI_SELECTED;
2436                         
2437                 default: /* unsupported */
2438                         return 0;
2439         }
2440 }
2441
2442 /* get pointer to the setting */
2443 static void *acf_dsmesh_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2444 {
2445         Mesh *me = (Mesh *)ale->data;
2446         
2447         /* clear extra return data first */
2448         *type = 0;
2449         
2450         switch (setting) {
2451                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2452                         return GET_ACF_FLAG_PTR(me->flag, type);
2453                         
2454                 case ACHANNEL_SETTING_SELECT: /* selected */
2455                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2456                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2457                         if (me->adt)
2458                                 return GET_ACF_FLAG_PTR(me->adt->flag, type);
2459                         return NULL;
2460                         
2461                 default: /* unsupported */
2462                         return NULL;
2463         }
2464 }
2465
2466 /* node tree expander type define */
2467 static bAnimChannelType ACF_DSMESH =
2468 {
2469         "Mesh Expander",                /* type name */
2470         ACHANNEL_ROLE_EXPANDER,         /* role */
2471         
2472         acf_generic_dataexpand_color,   /* backdrop color */
2473         acf_generic_dataexpand_backdrop, /* backdrop */
2474         acf_generic_indention_1,        /* indent level */      // XXX this only works for compositing
2475         acf_generic_basic_offset,       /* offset */
2476
2477         acf_generic_idblock_name,       /* name */
2478         acf_generic_idblock_name_prop,   /* name prop */
2479         acf_dsmesh_icon,                /* icon */
2480
2481         acf_generic_dataexpand_setting_valid,   /* has setting */
2482         acf_dsmesh_setting_flag,                /* flag for setting */
2483         acf_dsmesh_setting_ptr                  /* pointer for setting */
2484 };
2485
2486 /* Lattice Expander  ------------------------------------------- */
2487
2488 // TODO: just get this from RNA?
2489 static int acf_dslat_icon(bAnimListElem *UNUSED(ale))
2490 {
2491         return ICON_LATTICE_DATA;
2492 }
2493
2494 /* get the appropriate flag(s) for the setting when it is valid  */
2495 static int acf_dslat_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2496 {
2497         /* clear extra return data first */
2498         *neg = false;
2499         
2500         switch (setting) {
2501                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2502                         return LT_DS_EXPAND;
2503                         
2504                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2505                         return ADT_NLA_EVAL_OFF;
2506                         
2507                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2508                         *neg = true;
2509                         return ADT_CURVES_NOT_VISIBLE;
2510                         
2511                 case ACHANNEL_SETTING_SELECT: /* selected */
2512                         return ADT_UI_SELECTED;
2513                         
2514                 default: /* unsupported */
2515                         return 0;
2516         }
2517 }
2518
2519 /* get pointer to the setting */
2520 static void *acf_dslat_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2521 {
2522         Lattice *lt = (Lattice *)ale->data;
2523         
2524         /* clear extra return data first */
2525         *type = 0;
2526         
2527         switch (setting) {
2528                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2529                         return GET_ACF_FLAG_PTR(lt->flag, type);
2530                         
2531                 case ACHANNEL_SETTING_SELECT: /* selected */
2532                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2533                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2534                         if (lt->adt)
2535                                 return GET_ACF_FLAG_PTR(lt->adt->flag, type);
2536                         return NULL;
2537                         
2538                 default: /* unsupported */
2539                         return NULL;
2540         }
2541 }
2542
2543 /* node tree expander type define */
2544 static bAnimChannelType ACF_DSLAT =
2545 {
2546         "Lattice Expander",             /* type name */
2547         ACHANNEL_ROLE_EXPANDER,         /* role */
2548         
2549         acf_generic_dataexpand_color,   /* backdrop color */
2550         acf_generic_dataexpand_backdrop, /* backdrop */
2551         acf_generic_indention_1,        /* indent level */      // XXX this only works for compositing
2552         acf_generic_basic_offset,       /* offset */
2553
2554         acf_generic_idblock_name,       /* name */
2555         acf_generic_idblock_name_prop,   /* name prop */
2556         acf_dslat_icon,                 /* icon */
2557
2558         acf_generic_dataexpand_setting_valid,   /* has setting */
2559         acf_dslat_setting_flag,                 /* flag for setting */
2560         acf_dslat_setting_ptr                   /* pointer for setting */
2561 };
2562
2563 /* Speaker Expander  ------------------------------------------- */
2564
2565 // TODO: just get this from RNA?
2566 static int acf_dsspk_icon(bAnimListElem *UNUSED(ale))
2567 {
2568         return ICON_SPEAKER;
2569 }
2570
2571 /* get the appropriate flag(s) for the setting when it is valid  */
2572 static int acf_dsspk_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2573 {
2574         /* clear extra return data first */
2575         *neg = false;
2576         
2577         switch (setting) {
2578                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2579                         return SPK_DS_EXPAND;
2580                 
2581                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2582                         return ADT_NLA_EVAL_OFF;
2583                 
2584                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2585                         *neg = true;
2586                         return ADT_CURVES_NOT_VISIBLE;
2587                 
2588                 case ACHANNEL_SETTING_SELECT: /* selected */
2589                         return ADT_UI_SELECTED;
2590                 
2591                 default: /* unsupported */
2592                         return 0;
2593         }
2594 }
2595
2596 /* get pointer to the setting */
2597 static void *acf_dsspk_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2598 {
2599         Speaker *spk = (Speaker *)ale->data;
2600         
2601         /* clear extra return data first */
2602         *type = 0;
2603         
2604         switch (setting) {
2605                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2606                         return GET_ACF_FLAG_PTR(spk->flag, type);
2607                 
2608                 case ACHANNEL_SETTING_SELECT: /* selected */
2609                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2610                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2611                         if (spk->adt)
2612                                 return GET_ACF_FLAG_PTR(spk->adt->flag, type);
2613                         return NULL;
2614                 
2615                 default: /* unsupported */
2616                         return NULL;
2617         }
2618 }
2619
2620 /* speaker expander type define */
2621 static bAnimChannelType ACF_DSSPK =
2622 {
2623         "Speaker Expander",             /* type name */
2624         ACHANNEL_ROLE_EXPANDER,         /* role */
2625         
2626         acf_generic_dataexpand_color,   /* backdrop color */
2627         acf_generic_dataexpand_backdrop, /* backdrop */
2628         acf_generic_indention_1,        /* indent level */
2629         acf_generic_basic_offset,       /* offset */
2630
2631         acf_generic_idblock_name,       /* name */
2632         acf_generic_idblock_name_prop,   /* name prop */
2633         acf_dsspk_icon,                 /* icon */
2634
2635         acf_generic_dataexpand_setting_valid,   /* has setting */
2636         acf_dsspk_setting_flag,                 /* flag for setting */
2637         acf_dsspk_setting_ptr                   /* pointer for setting */
2638 };
2639
2640 /* GPencil Expander  ------------------------------------------- */
2641
2642 // TODO: just get this from RNA?
2643 static int acf_dsgpencil_icon(bAnimListElem *UNUSED(ale))
2644 {
2645         return ICON_GREASEPENCIL;
2646 }
2647
2648 /* get the appropriate flag(s) for the setting when it is valid  */
2649 static int acf_dsgpencil_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2650 {
2651         /* clear extra return data first */
2652         *neg = false;
2653         
2654         switch (setting) {
2655                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2656                         return GP_DATA_EXPAND;
2657                 
2658                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2659                         return ADT_NLA_EVAL_OFF;
2660                 
2661                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2662                         *neg = true;
2663                         return ADT_CURVES_NOT_VISIBLE;
2664                 
2665                 case ACHANNEL_SETTING_SELECT: /* selected */
2666                         return ADT_UI_SELECTED;
2667                 
2668                 default: /* unsupported */
2669                         return 0;
2670         }
2671 }
2672
2673 /* get pointer to the setting */
2674 static void *acf_dsgpencil_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2675 {
2676         bGPdata *gpd = (bGPdata *)ale->data;
2677         
2678         /* clear extra return data first */
2679         *type = 0;
2680         
2681         switch (setting) {
2682                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2683                         return GET_ACF_FLAG_PTR(gpd->flag, type);
2684                 
2685                 case ACHANNEL_SETTING_SELECT: /* selected */
2686                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2687                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2688                         if (gpd->adt)
2689                                 return GET_ACF_FLAG_PTR(gpd->adt->flag, type);
2690                         return NULL;
2691                 
2692                 default: /* unsupported */
2693                         return NULL;
2694         }
2695 }
2696
2697 /* grease pencil expander type define */
2698 static bAnimChannelType ACF_DSGPENCIL =
2699 {
2700         "GPencil DS Expander",          /* type name */
2701         ACHANNEL_ROLE_EXPANDER,         /* role */
2702         
2703         acf_generic_dataexpand_color,   /* backdrop color */
2704         acf_generic_dataexpand_backdrop, /* backdrop */
2705         acf_generic_indention_1,        /* indent level */
2706         acf_generic_basic_offset,       /* offset */
2707
2708         acf_generic_idblock_name,       /* name */
2709         acf_generic_idblock_name_prop,  /* name prop */
2710         acf_dsgpencil_icon,             /* icon */
2711
2712         acf_generic_dataexpand_setting_valid,   /* has setting */
2713         acf_dsgpencil_setting_flag,             /* flag for setting */
2714         acf_dsgpencil_setting_ptr               /* pointer for setting */
2715 };
2716
2717 /* World Expander  ------------------------------------------- */
2718
2719 // TODO: just get this from RNA?
2720 static int acf_dsmclip_icon(bAnimListElem *UNUSED(ale))
2721 {
2722         return ICON_SEQUENCE;
2723 }
2724
2725 /* get the appropriate flag(s) for the setting when it is valid  */
2726 static int acf_dsmclip_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2727 {
2728         /* clear extra return data first */
2729         *neg = false;
2730
2731         switch (setting) {
2732                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2733                         return MCLIP_DATA_EXPAND;
2734
2735                 case ACHANNEL_SETTING_MUTE: /* mute (only in NLA) */
2736                         return ADT_NLA_EVAL_OFF;
2737
2738                 case ACHANNEL_SETTING_VISIBLE: /* visible (only in Graph Editor) */
2739                         *neg = true;
2740                         return ADT_CURVES_NOT_VISIBLE;
2741
2742                 case ACHANNEL_SETTING_SELECT: /* selected */
2743                         return ADT_UI_SELECTED;
2744
2745                 default: /* unsupported */
2746                         return 0;
2747         }
2748 }
2749
2750 /* get pointer to the setting */
2751 static void *acf_dsmclip_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2752 {
2753         MovieClip *clip = (MovieClip *)ale->data;
2754
2755         /* clear extra return data first */
2756         *type = 0;
2757
2758         switch (setting) {
2759                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2760                         return GET_ACF_FLAG_PTR(clip->flag, type);
2761
2762                 case ACHANNEL_SETTING_SELECT: /* selected */
2763                 case ACHANNEL_SETTING_MUTE: /* muted (for NLA only) */
2764                 case ACHANNEL_SETTING_VISIBLE: /* visible (for Graph Editor only) */
2765                         if (clip->adt != NULL) {
2766                                 return GET_ACF_FLAG_PTR(clip->adt->flag, type);
2767                         }
2768                         return NULL;
2769
2770                 default: /* unsupported */
2771                         return NULL;
2772         }
2773 }
2774
2775 /* world expander type define */
2776 static bAnimChannelType ACF_DSMCLIP =
2777 {
2778         "Movieclip Expander",           /* type name */
2779         ACHANNEL_ROLE_EXPANDER,         /* role */
2780
2781         acf_generic_dataexpand_color,    /* backdrop color */
2782         acf_generic_dataexpand_backdrop, /* backdrop */
2783         acf_generic_indention_1,         /* indent level */
2784         acf_generic_basic_offset,        /* offset */
2785
2786         acf_generic_idblock_name ,       /* name */
2787         acf_generic_idfill_name_prop,    /* name prop */
2788         acf_dsmclip_icon,                /* icon */
2789
2790         acf_generic_dataexpand_setting_valid,   /* has setting */
2791         acf_dsmclip_setting_flag,               /* flag for setting */
2792         acf_dsmclip_setting_ptr                 /* pointer for setting */
2793 };
2794
2795 /* ShapeKey Entry  ------------------------------------------- */
2796
2797 /* name for ShapeKey */
2798 static void acf_shapekey_name(bAnimListElem *ale, char *name)
2799 {
2800         KeyBlock *kb = (KeyBlock *)ale->data;
2801         
2802         /* just copy the name... */
2803         if (kb && name) {
2804                 /* if the KeyBlock had a name, use it, otherwise use the index */
2805                 if (kb->name[0])
2806                         BLI_strncpy(name, kb->name, ANIM_CHAN_NAME_SIZE);
2807                 else
2808                         BLI_snprintf(name, ANIM_CHAN_NAME_SIZE, IFACE_("Key %d"), ale->index);
2809         }
2810 }
2811
2812 /* name property for ShapeKey entries */
2813 static bool acf_shapekey_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
2814 {
2815         KeyBlock *kb = (KeyBlock *)ale->data;
2816         
2817         /* if the KeyBlock had a name, use it, otherwise use the index */
2818         if (kb && kb->name[0]) {
2819                 RNA_pointer_create(ale->id, &RNA_ShapeKey, kb, ptr);
2820                 *prop = RNA_struct_name_property(ptr->type);
2821                 
2822                 return (*prop != NULL);
2823         }
2824         
2825         return false;
2826 }
2827
2828 /* check if some setting exists for this channel */
2829 static bool acf_shapekey_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
2830 {
2831         switch (setting) {
2832                 case ACHANNEL_SETTING_SELECT: /* selected */
2833                 case ACHANNEL_SETTING_MUTE: /* muted */
2834                 case ACHANNEL_SETTING_PROTECT: /* protected */
2835                         return true;
2836                         
2837                 /* nothing else is supported */
2838                 default:
2839                         return false;
2840         }
2841 }
2842
2843 /* get the appropriate flag(s) for the setting when it is valid  */
2844 static int acf_shapekey_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2845 {
2846         /* clear extra return data first */
2847         *neg = false;
2848         
2849         switch (setting) {
2850                 case ACHANNEL_SETTING_MUTE: /* mute */
2851                         return KEYBLOCK_MUTE;
2852                 
2853                 case ACHANNEL_SETTING_SELECT: /* selected */
2854                         return KEYBLOCK_SEL;
2855                 
2856                 case ACHANNEL_SETTING_PROTECT: /* locked */
2857                         return KEYBLOCK_LOCKED;
2858                 
2859                 default: /* unsupported */
2860                         return 0;
2861         }
2862 }
2863
2864 /* get pointer to the setting */
2865 static void *acf_shapekey_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings setting, short *type)
2866 {
2867         KeyBlock *kb = (KeyBlock *)ale->data;
2868         
2869         /* clear extra return data first */
2870         *type = 0;
2871         
2872         switch (setting) {
2873                 case ACHANNEL_SETTING_SELECT: /* selected */
2874                 case ACHANNEL_SETTING_MUTE: /* muted */
2875                 case ACHANNEL_SETTING_PROTECT: /* protected */
2876                         return GET_ACF_FLAG_PTR(kb->flag, type);
2877                 
2878                 default: /* unsupported */
2879                         return NULL;
2880         }
2881 }
2882
2883 /* shapekey expander type define */
2884 static bAnimChannelType ACF_SHAPEKEY =
2885 {
2886         "Shape Key",                    /* type name */
2887         ACHANNEL_ROLE_CHANNEL,          /* role */
2888         
2889         acf_generic_channel_color,      /* backdrop color */
2890         acf_generic_channel_backdrop,   /* backdrop */
2891         acf_generic_indention_0,        /* indent level */
2892         acf_generic_basic_offset,       /* offset */
2893
2894         acf_shapekey_name,              /* name */
2895         acf_shapekey_name_prop,          /* name prop */
2896         NULL,                           /* icon */
2897
2898         acf_shapekey_setting_valid,     /* has setting */
2899         acf_shapekey_setting_flag,      /* flag for setting */
2900         acf_shapekey_setting_ptr        /* pointer for setting */
2901 };
2902
2903 /* GPencil Datablock ------------------------------------------- */
2904
2905 /* get backdrop color for gpencil datablock widget */
2906 static void acf_gpd_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
2907 {
2908         /* these are ID-blocks, but not exactly standalone... */
2909         UI_GetThemeColorShade3fv(TH_DOPESHEET_CHANNELSUBOB, 20, r_color);
2910 }
2911
2912 // TODO: just get this from RNA?
2913 static int acf_gpd_icon(bAnimListElem *UNUSED(ale))
2914 {
2915         return ICON_GREASEPENCIL;
2916 }
2917
2918 /* check if some setting exists for this channel */
2919 static bool acf_gpd_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
2920 {
2921         switch (setting) {
2922                 /* only select and expand supported */
2923                 case ACHANNEL_SETTING_SELECT:
2924                 case ACHANNEL_SETTING_EXPAND:
2925                         return true;
2926                         
2927                 default:
2928                         return false;
2929         }
2930 }
2931
2932 /* get the appropriate flag(s) for the setting when it is valid  */
2933 static int acf_gpd_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
2934 {
2935         /* clear extra return data first */
2936         *neg = false;
2937         
2938         switch (setting) {
2939                 case ACHANNEL_SETTING_SELECT: /* selected */
2940                         return AGRP_SELECTED;
2941                         
2942                 case ACHANNEL_SETTING_EXPAND: /* expanded */
2943                         return GP_DATA_EXPAND;
2944                 
2945                 default:
2946                         /* these shouldn't happen */
2947                         return 0;
2948         }
2949 }
2950
2951 /* get pointer to the setting */
2952 static void *acf_gpd_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
2953 {
2954         bGPdata *gpd = (bGPdata *)ale->data;
2955         
2956         /* all flags are just in gpd->flag for now... */
2957         return GET_ACF_FLAG_PTR(gpd->flag, type);
2958 }
2959
2960 /* gpencil datablock type define */
2961 static bAnimChannelType ACF_GPD = 
2962 {
2963         "GPencil Datablock",            /* type name */
2964         ACHANNEL_ROLE_EXPANDER,         /* role */
2965         
2966         acf_gpd_color,                  /* backdrop color */
2967         acf_group_backdrop,             /* backdrop */
2968         acf_generic_indention_0,        /* indent level */
2969         acf_generic_group_offset,       /* offset */
2970
2971         acf_generic_idblock_name,       /* name */
2972         acf_generic_idfill_name_prop,    /* name prop */
2973         acf_gpd_icon,                   /* icon */
2974
2975         acf_gpd_setting_valid,          /* has setting */
2976         acf_gpd_setting_flag,           /* flag for setting */
2977         acf_gpd_setting_ptr             /* pointer for setting */
2978 };
2979
2980 /* GPencil Layer ------------------------------------------- */
2981
2982 /* name for grease pencil layer entries */
2983 static void acf_gpl_name(bAnimListElem *ale, char *name)
2984 {
2985         bGPDlayer *gpl = (bGPDlayer *)ale->data;
2986         
2987         if (gpl && name)
2988                 BLI_strncpy(name, gpl->info, ANIM_CHAN_NAME_SIZE);
2989 }
2990
2991 /* name property for grease pencil layer entries */
2992 static bool acf_gpl_name_prop(bAnimListElem *ale, PointerRNA *ptr, PropertyRNA **prop)
2993 {
2994         if (ale->data) {
2995                 RNA_pointer_create(ale->id, &RNA_GPencilLayer, ale->data, ptr);
2996                 *prop = RNA_struct_name_property(ptr->type);
2997                 
2998                 return (*prop != NULL);
2999         }
3000         
3001         return false;
3002 }
3003
3004 /* check if some setting exists for this channel */
3005 static bool acf_gpl_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
3006 {
3007         switch (setting) {
3008                 /* unsupported */
3009                 case ACHANNEL_SETTING_EXPAND: /* gpencil layers are more like F-Curves than groups */
3010                 case ACHANNEL_SETTING_SOLO: /* nla editor only */
3011                         return false;
3012                 
3013                 /* always available */
3014                 default:
3015                         return true;
3016         }
3017 }
3018
3019 /* get the appropriate flag(s) for the setting when it is valid  */
3020 static int acf_gpl_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
3021 {
3022         /* clear extra return data first */
3023         *neg = false;
3024         
3025         switch (setting) {
3026                 case ACHANNEL_SETTING_SELECT: /* selected */
3027                         return GP_LAYER_SELECT;
3028                         
3029                 case ACHANNEL_SETTING_MUTE: /* animation muting - similar to frame lock... */
3030                         return GP_LAYER_FRAMELOCK;
3031                         
3032                 case ACHANNEL_SETTING_VISIBLE: /* visiblity of the layers (NOT muting) */
3033                         *neg = true;
3034                         return GP_LAYER_HIDE;
3035                         
3036                 case ACHANNEL_SETTING_PROTECT: /* protected */
3037                         return GP_LAYER_LOCKED;
3038                         
3039                 default: /* unsupported */
3040                         return 0;
3041         }
3042 }
3043
3044 /* get pointer to the setting */
3045 static void *acf_gpl_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
3046 {
3047         bGPDlayer *gpl = (bGPDlayer *)ale->data;
3048         
3049         /* all flags are just in gpl->flag for now... */
3050         return GET_ACF_FLAG_PTR(gpl->flag, type);
3051 }
3052
3053 /* grease pencil layer type define */
3054 static bAnimChannelType ACF_GPL = 
3055 {
3056         "GPencil Layer",                /* type name */
3057         ACHANNEL_ROLE_CHANNEL,          /* role */
3058         
3059         acf_generic_channel_color,      /* backdrop color */
3060         acf_generic_channel_backdrop,   /* backdrop */
3061         acf_generic_indention_flexible, /* indent level */
3062         acf_generic_group_offset,       /* offset */
3063         
3064         acf_gpl_name,                   /* name */
3065         acf_gpl_name_prop,              /* name prop */
3066         NULL,                           /* icon */
3067         
3068         acf_gpl_setting_valid,          /* has setting */
3069         acf_gpl_setting_flag,           /* flag for setting */
3070         acf_gpl_setting_ptr             /* pointer for setting */
3071 };
3072
3073
3074 /* Mask Datablock ------------------------------------------- */
3075
3076 /* get backdrop color for mask datablock widget */
3077 static void acf_mask_color(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), float r_color[3])
3078 {
3079         /* these are ID-blocks, but not exactly standalone... */
3080         UI_GetThemeColorShade3fv(TH_DOPESHEET_CHANNELSUBOB, 20, r_color);
3081 }
3082
3083 // TODO: just get this from RNA?
3084 static int acf_mask_icon(bAnimListElem *UNUSED(ale))
3085 {
3086         return ICON_MOD_MASK;
3087 }
3088
3089 /* check if some setting exists for this channel */
3090 static bool acf_mask_setting_valid(bAnimContext *UNUSED(ac), bAnimListElem *UNUSED(ale), eAnimChannel_Settings setting)
3091 {
3092         switch (setting) {
3093                 /* only select and expand supported */
3094                 case ACHANNEL_SETTING_SELECT:
3095                 case ACHANNEL_SETTING_EXPAND:
3096                         return true;
3097                 
3098                 default:
3099                         return false;
3100         }
3101 }
3102
3103 /* get the appropriate flag(s) for the setting when it is valid  */
3104 static int acf_mask_setting_flag(bAnimContext *UNUSED(ac), eAnimChannel_Settings setting, bool *neg)
3105 {
3106         /* clear extra return data first */
3107         *neg = false;
3108         
3109         switch (setting) {
3110                 case ACHANNEL_SETTING_SELECT: /* selected */
3111                         return AGRP_SELECTED;
3112                 
3113                 case ACHANNEL_SETTING_EXPAND: /* expanded */
3114                         return MASK_ANIMF_EXPAND;
3115                         
3116                 default:        
3117                         /* this shouldn't happen */
3118                         return 0;
3119         }
3120 }
3121
3122 /* get pointer to the setting */
3123 static void *acf_mask_setting_ptr(bAnimListElem *ale, eAnimChannel_Settings UNUSED(setting), short *type)
3124 {
3125         Mask *mask = (Mask *)ale->data;
3126         
3127         /* all flags are just in mask->flag for now... */
3128         return GET_ACF_FLAG_PTR(mask->flag, type);
3129 }
3130
3131 /* mask datablock type define */
3132 static bAnimChannelType ACF_MASKDATA =
3133 {
3134         "Mask Datablock",                /* type name */
3135         ACHANNEL_ROLE_EXPANDER,          /* role */
3136         
3137         acf_mask_color,                  /* backdrop color */
3138         acf_group_backdrop,              /* backdrop */
3139         acf_generic_indention_0,         /* indent level */
3140         acf_generic_group_offset,        /* offset */
3141         
3142         acf_generic_idblock_name,        /* name */
3143         acf_generic_idfill_name_prop,     /* name prop */
3144         acf_mask_icon,                   /* icon */
3145         
3146         acf_mask_setting_valid,          /* has setting */
3147         acf_mask_setting_flag,           /* flag for setting */
3148         acf_mask_setting_ptr             /* pointer for setting */