112
113
/* New node callback used for building ActKeyColumns from BezTriples */
113
static DLRBT_Node *nalloc_ak_bezt (void *data)
114
static DLRBT_Node *nalloc_ak_bezt(void *data)
115
ActKeyColumn *ak= MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumn");
116
BezTriple *bezt= (BezTriple *)data;
116
ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumn");
117
BezTriple *bezt = (BezTriple *)data;
118
119
/* store settings based on state of BezTriple */
119
ak->cfra= bezt->vec[1][0];
120
ak->sel= BEZSELECTED(bezt) ? SELECT : 0;
121
ak->key_type= BEZKEYTYPE(bezt);
120
ak->cfra = bezt->vec[1][0];
121
ak->sel = BEZSELECTED(bezt) ? SELECT : 0;
122
ak->key_type = BEZKEYTYPE(bezt);
123
124
/* set 'modified', since this is used to identify long keyframes */
124
125
ak->modified = 1;
139
140
/* for keyframe type, 'proper' keyframes have priority over breakdowns (and other types for now) */
140
141
if (BEZKEYTYPE(bezt) == BEZT_KEYTYPE_KEYFRAME)
141
ak->key_type= BEZT_KEYTYPE_KEYFRAME;
142
ak->key_type = BEZT_KEYTYPE_KEYFRAME;
146
147
/* Comparator callback used for ActKeyColumns and GPencil frame */
147
static short compare_ak_gpframe (void *node, void *data)
148
static short compare_ak_gpframe(void *node, void *data)
149
ActKeyColumn *ak= (ActKeyColumn *)node;
150
bGPDframe *gpf= (bGPDframe *)data;
150
ActKeyColumn *ak = (ActKeyColumn *)node;
151
bGPDframe *gpf = (bGPDframe *)data;
152
153
if (gpf->framenum < ak->cfra)
160
161
/* New node callback used for building ActKeyColumns from GPencil frames */
161
static DLRBT_Node *nalloc_ak_gpframe (void *data)
162
static DLRBT_Node *nalloc_ak_gpframe(void *data)
163
ActKeyColumn *ak= MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF");
164
bGPDframe *gpf= (bGPDframe *)data;
164
ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF");
165
bGPDframe *gpf = (bGPDframe *)data;
166
167
/* store settings based on state of BezTriple */
167
ak->cfra= gpf->framenum;
168
ak->sel= (gpf->flag & GP_FRAME_SELECT) ? SELECT : 0;
168
ak->cfra = gpf->framenum;
169
ak->sel = (gpf->flag & GP_FRAME_SELECT) ? SELECT : 0;
170
171
/* set 'modified', since this is used to identify long keyframes */
171
172
ak->modified = 1;
176
177
/* Node updater callback used for building ActKeyColumns from GPencil frames */
177
static void nupdate_ak_gpframe (void *node, void *data)
178
static void nupdate_ak_gpframe(void *node, void *data)
179
ActKeyColumn *ak= (ActKeyColumn *)node;
180
bGPDframe *gpf= (bGPDframe *)data;
180
ActKeyColumn *ak = (ActKeyColumn *)node;
181
bGPDframe *gpf = (bGPDframe *)data;
182
183
/* set selection status and 'touched' status */
183
184
if (gpf->flag & GP_FRAME_SELECT) ak->sel = SELECT;
184
185
ak->modified += 1;
190
/* Comparator callback used for ActKeyColumns and GPencil frame */
191
static short compare_ak_masklayshape(void *node, void *data)
193
ActKeyColumn *ak = (ActKeyColumn *)node;
194
MaskLayerShape *masklay_shape = (MaskLayerShape *)data;
196
if (masklay_shape->frame < ak->cfra)
198
else if (masklay_shape->frame > ak->cfra)
204
/* New node callback used for building ActKeyColumns from GPencil frames */
205
static DLRBT_Node *nalloc_ak_masklayshape(void *data)
207
ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF");
208
MaskLayerShape *masklay_shape = (MaskLayerShape *)data;
210
/* store settings based on state of BezTriple */
211
ak->cfra = masklay_shape->frame;
212
ak->sel = (masklay_shape->flag & MASK_SHAPE_SELECT) ? SELECT : 0;
214
/* set 'modified', since this is used to identify long keyframes */
217
return (DLRBT_Node *)ak;
220
/* Node updater callback used for building ActKeyColumns from GPencil frames */
221
static void nupdate_ak_masklayshape(void *node, void *data)
223
ActKeyColumn *ak = (ActKeyColumn *)node;
224
MaskLayerShape *masklay_shape = (MaskLayerShape *)data;
226
/* set selection status and 'touched' status */
227
if (masklay_shape->flag & MASK_SHAPE_SELECT) ak->sel = SELECT;
187
232
/* --------------- */
189
234
/* Add the given BezTriple to the given 'list' of Keyframes */
204
249
BLI_dlrbTree_add(keys, compare_ak_gpframe, nalloc_ak_gpframe, nupdate_ak_gpframe, gpf);
252
/* Add the given MaskLayerShape Frame to the given 'list' of Keyframes */
253
static void add_masklay_to_keycolumns_list(DLRBT_Tree *keys, MaskLayerShape *masklay_shape)
255
if (ELEM(NULL, keys, masklay_shape))
258
BLI_dlrbTree_add(keys, compare_ak_masklayshape, nalloc_ak_masklayshape, nupdate_ak_masklayshape, masklay_shape);
207
261
/* ActBeztColumns (Helpers for Long Keyframes) ------------------------------ */
209
263
/* maximum size of default buffer for BezTriple columns */
210
#define MAX_ABK_BUFSIZE 4
264
#define MAX_ABK_BUFSIZE 4
212
266
/* BezTriple Container Node */
213
267
// NOTE: only used internally while building Long Keyframes for now, but may be useful externally?
214
268
typedef struct ActBeztColumn {
215
269
/* Tree Node interface ---------------- */
216
/* ListBase linkage */
270
/* ListBase linkage */
217
271
struct ActBeztColumn *next, *prev;
219
/* sorting-tree linkage */
220
struct ActBeztColumn *left, *right; /* 'children' of this node, less than and greater than it (respectively) */
221
struct ActBeztColumn *parent; /* parent of this node in the tree */
222
char tree_col; /* DLRB_BLACK or DLRB_RED */
273
/* sorting-tree linkage */
274
struct ActBeztColumn *left, *right; /* 'children' of this node, less than and greater than it (respectively) */
275
struct ActBeztColumn *parent; /* parent of this node in the tree */
276
char tree_col; /* DLRB_BLACK or DLRB_RED */
225
279
/* BezTriple Store -------------------- */
226
short numBezts; /* number of BezTriples on this frame */
227
float cfra; /* frame that the BezTriples occur on */
280
short numBezts; /* number of BezTriples on this frame */
281
float cfra; /* frame that the BezTriples occur on */
229
BezTriple *bezts[MAX_ABK_BUFSIZE]; /* buffer of pointers to BezTriples on the same frame */
283
BezTriple *bezts[MAX_ABK_BUFSIZE]; /* buffer of pointers to BezTriples on the same frame */
230
284
//BezTriple **bezts_extra; /* secondary buffer of pointers if need be */
233
287
/* --------------- */
235
289
/* Comparator callback used for ActBeztColumns and BezTriple */
236
static short compare_abk_bezt (void *node, void *data)
290
static short compare_abk_bezt(void *node, void *data)
238
ActBeztColumn *abk= (ActBeztColumn *)node;
239
BezTriple *bezt= (BezTriple *)data;
292
ActBeztColumn *abk = (ActBeztColumn *)node;
293
BezTriple *bezt = (BezTriple *)data;
241
295
if (bezt->vec[1][0] < abk->cfra)
249
303
/* New node callback used for building ActBeztColumns from BezTriples */
250
static DLRBT_Node *nalloc_abk_bezt (void *data)
304
static DLRBT_Node *nalloc_abk_bezt(void *data)
252
ActBeztColumn *abk= MEM_callocN(sizeof(ActBeztColumn), "ActKeyColumn");
253
BezTriple *bezt= (BezTriple *)data;
306
ActBeztColumn *abk = MEM_callocN(sizeof(ActBeztColumn), "ActKeyColumn");
307
BezTriple *bezt = (BezTriple *)data;
255
309
/* store the BeztTriple in the buffer, and keep track of its frame number */
256
abk->cfra= bezt->vec[1][0];
257
abk->bezts[abk->numBezts++]= bezt;
310
abk->cfra = bezt->vec[1][0];
311
abk->bezts[abk->numBezts++] = bezt;
259
313
return (DLRBT_Node *)abk;
262
316
/* Node updater callback used for building ActBeztColumns from BezTriples */
263
static void nupdate_abk_bezt (void *node, void *data)
317
static void nupdate_abk_bezt(void *node, void *data)
265
ActBeztColumn *abk= (ActBeztColumn *)node;
266
BezTriple *bezt= (BezTriple *)data;
319
ActBeztColumn *abk = (ActBeztColumn *)node;
320
BezTriple *bezt = (BezTriple *)data;
268
322
/* just add the BezTriple to the buffer if there's space, or allocate a new one */
269
323
if (abk->numBezts >= MAX_ABK_BUFSIZE) {
270
324
// TODO: need to allocate new array to cater...
271
//bezts_extra= MEM_callocN(...);
325
//bezts_extra = MEM_callocN(...);
272
326
if (G.debug & G_DEBUG)
273
327
printf("FIXME: nupdate_abk_bezt() missing case for too many overlapping BezTriples\n");
276
330
/* just store an extra one */
277
abk->bezts[abk->numBezts++]= bezt;
331
abk->bezts[abk->numBezts++] = bezt;
281
335
/* --------------- */
283
337
/* Return the BezTriple in the given ActBeztColumn that matches the requested value */
284
static BezTriple *abk_get_bezt_with_value (ActBeztColumn *abk, float value)
338
static BezTriple *abk_get_bezt_with_value(ActBeztColumn *abk, float value)
330
384
/* Create a ActKeyColumn for a pair of BezTriples */
331
385
static ActKeyBlock *bezts_to_new_actkeyblock(BezTriple *prev, BezTriple *beztn)
333
ActKeyBlock *ab= MEM_callocN(sizeof(ActKeyBlock), "ActKeyBlock");
335
ab->start= prev->vec[1][0];
336
ab->end= beztn->vec[1][0];
337
ab->val= beztn->vec[1][1];
339
ab->sel= (BEZSELECTED(prev) || BEZSELECTED(beztn)) ? SELECT : 0;
387
ActKeyBlock *ab = MEM_callocN(sizeof(ActKeyBlock), "ActKeyBlock");
389
ab->start = prev->vec[1][0];
390
ab->end = beztn->vec[1][0];
391
ab->val = beztn->vec[1][1];
393
ab->sel = (BEZSELECTED(prev) || BEZSELECTED(beztn)) ? SELECT : 0;
340
394
ab->modified = 1;
345
399
static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree, BezTriple *beztn)
347
ActKeyBlock *new_ab= NULL;
401
ActKeyBlock *new_ab = NULL;
348
402
ActBeztColumn *abk;
351
405
/* get the BezTriple immediately before the given one which has the same value */
352
/* the keyframes immediately before the ones containing the specified keyframe */
353
abk= (ActBeztColumn *)BLI_dlrbTree_search_prev(beztTree, compare_abk_bezt, beztn);
354
/* if applicable, the BezTriple with the same value */
355
prev= (abk) ? abk_get_bezt_with_value(abk, beztn->vec[1][1]) : NULL;
406
/* the keyframes immediately before the ones containing the specified keyframe */
407
abk = (ActBeztColumn *)BLI_dlrbTree_search_prev(beztTree, compare_abk_bezt, beztn);
408
/* if applicable, the BezTriple with the same value */
409
prev = (abk) ? abk_get_bezt_with_value(abk, beztn->vec[1][1]) : NULL;
357
411
/* check if block needed - same value(s)?
358
412
* -> firstly, handles must have same central value as each other
359
413
* -> secondly, handles which control that section of the curve must be constant
361
if ((!prev) || (!beztn)) return;
362
if (IS_EQF(beztn->vec[1][1], prev->vec[1][1])==0) return;
363
if (IS_EQF(beztn->vec[1][1], beztn->vec[0][1])==0) return;
364
if (IS_EQF(prev->vec[1][1], prev->vec[2][1])==0) return;
415
if (prev == NULL) return;
416
if (IS_EQF(beztn->vec[1][1], prev->vec[1][1]) == 0) return;
417
if (IS_EQF(beztn->vec[1][1], beztn->vec[0][1]) == 0) return;
418
if (IS_EQF(prev->vec[1][1], prev->vec[2][1]) == 0) return;
367
421
/* if there are no blocks already, just add as root */
368
422
if (blocks->root == NULL) {
369
423
/* just add this as the root, then call the tree-balancing functions to validate */
370
new_ab= bezts_to_new_actkeyblock(prev, beztn);
371
blocks->root= (DLRBT_Node *)new_ab;
424
new_ab = bezts_to_new_actkeyblock(prev, beztn);
425
blocks->root = (DLRBT_Node *)new_ab;
374
ActKeyBlock *ab, *abn=NULL;
428
ActKeyBlock *ab, *abn = NULL;
376
430
/* try to find a keyblock that starts on the previous beztriple, and add a new one if none start there
377
431
* Note: we can't search from end to try to optimize this as it causes errors there's
378
* an A ___ B |---| B situation
432
* an A ___ B |---| B situation
380
434
// FIXME: here there is a bug where we are trying to get the summary for the following channels
381
435
// A|--------------|A ______________ B|--------------|B
382
436
// A|------------------------------------------------|A
383
437
// A|----|A|---|A|-----------------------------------|A
384
for (ab= blocks->root; ab; ab= abn) {
438
for (ab = blocks->root; ab; ab = abn) {
385
439
/* check if this is a match, or whether we go left or right */
386
440
if (ab->start == prev->vec[1][0]) {
387
441
/* set selection status and 'touched' status */
395
ActKeyBlock **abnp= NULL;
449
ActKeyBlock **abnp = NULL;
397
451
/* check if go left or right, but if not available, add new node */
398
452
if (ab->start < prev->vec[1][0])
403
457
/* if this does not exist, add a new node, otherwise continue... */
404
458
if (*abnp == NULL) {
405
459
/* add a new node representing this, and attach it to the relevant place */
406
new_ab= bezts_to_new_actkeyblock(prev, beztn);
460
new_ab = bezts_to_new_actkeyblock(prev, beztn);
471
525
/* find out how many curves occur at each keyframe */
472
ak= (ActKeyColumn *)BLI_dlrbTree_search_exact(keys, compare_ak_cfraPtr, &ab->start);
473
startCurves = (ak)? ak->totcurve: 0;
526
ak = (ActKeyColumn *)BLI_dlrbTree_search_exact(keys, compare_ak_cfraPtr, &ab->start);
527
startCurves = (ak) ? ak->totcurve : 0;
475
ak= (ActKeyColumn *)BLI_dlrbTree_search_exact(keys, compare_ak_cfraPtr, &ab->end);
476
endCurves = (ak)? ak->totcurve: 0;
529
ak = (ActKeyColumn *)BLI_dlrbTree_search_exact(keys, compare_ak_cfraPtr, &ab->end);
530
endCurves = (ak) ? ak->totcurve : 0;
478
532
/* only draw keyblock if it appears in at all of the keyframes at lowest end */
479
533
if (!startCurves && !endCurves)
482
totCurves = (startCurves>endCurves)? endCurves: startCurves;
536
totCurves = (startCurves > endCurves) ? endCurves : startCurves;
483
537
return (ab->totcurve >= totCurves);
488
542
/* coordinates for diamond shape */
489
543
static const float _unit_diamond_shape[4][2] = {
490
{0.0f, 1.0f}, /* top vert */
491
{1.0f, 0.0f}, /* mid-right */
492
{0.0f, -1.0f}, /* bottom vert */
493
{-1.0f, 0.0f} /* mid-left */
544
{0.0f, 1.0f}, /* top vert */
545
{1.0f, 0.0f}, /* mid-right */
546
{0.0f, -1.0f}, /* bottom vert */
547
{-1.0f, 0.0f} /* mid-left */
496
550
/* draw a simple diamond shape with OpenGL */
497
void draw_keyframe_shape (float x, float y, float xscale, float hsize, short sel, short key_type, short mode, float alpha)
551
void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel, short key_type, short mode, float alpha)
499
static GLuint displist1=0;
500
static GLuint displist2=0;
553
static GLuint displist1 = 0;
554
static GLuint displist2 = 0;
502
556
/* initialize 2 display lists for diamond shape - one empty, one filled */
503
557
if (displist1 == 0) {
504
displist1= glGenLists(1);
505
glNewList(displist1, GL_COMPILE);
558
displist1 = glGenLists(1);
559
glNewList(displist1, GL_COMPILE);
507
glBegin(GL_LINE_LOOP);
508
glVertex2fv(_unit_diamond_shape[0]);
509
glVertex2fv(_unit_diamond_shape[1]);
510
glVertex2fv(_unit_diamond_shape[2]);
511
glVertex2fv(_unit_diamond_shape[3]);
561
glBegin(GL_LINE_LOOP);
562
glVertex2fv(_unit_diamond_shape[0]);
563
glVertex2fv(_unit_diamond_shape[1]);
564
glVertex2fv(_unit_diamond_shape[2]);
565
glVertex2fv(_unit_diamond_shape[3]);
515
570
if (displist2 == 0) {
516
displist2= glGenLists(1);
517
glNewList(displist2, GL_COMPILE);
571
displist2 = glGenLists(1);
572
glNewList(displist2, GL_COMPILE);
520
glVertex2fv(_unit_diamond_shape[0]);
521
glVertex2fv(_unit_diamond_shape[1]);
522
glVertex2fv(_unit_diamond_shape[2]);
523
glVertex2fv(_unit_diamond_shape[3]);
575
glVertex2fv(_unit_diamond_shape[0]);
576
glVertex2fv(_unit_diamond_shape[1]);
577
glVertex2fv(_unit_diamond_shape[2]);
578
glVertex2fv(_unit_diamond_shape[3]);
528
584
/* tweak size of keyframe shape according to type of keyframe
529
* - 'proper' keyframes have key_type=0, so get drawn at full size
585
* - 'proper' keyframes have key_type = 0, so get drawn at full size
531
hsize -= 0.5f*key_type;
587
hsize -= 0.5f * key_type;
533
589
/* adjust view transform before starting */
534
590
glTranslatef(x, y, 0.0f);
535
glScalef(1.0f/xscale*hsize, hsize, 1.0f);
591
glScalef(1.0f / xscale * hsize, hsize, 1.0f);
537
593
/* anti-aliased lines for more consistent appearance */
538
594
glEnable(GL_LINE_SMOOTH);
546
602
if (sel) glColor4f(0.33f, 0.75f, 0.93f, alpha);
547
603
else glColor4f(0.70f, 0.86f, 0.91f, alpha);
551
607
case BEZT_KEYTYPE_EXTREME: /* redish frames for now */
553
609
if (sel) glColor4f(0.95f, 0.5f, 0.5f, alpha);
554
610
else glColor4f(0.91f, 0.70f, 0.80f, alpha);
558
614
case BEZT_KEYTYPE_JITTER: /* greenish frames for now? */
560
616
if (sel) glColor4f(0.38f, 0.75f, 0.26f, alpha);
561
617
else glColor4f(0.58f, 0.90f, 0.46f, alpha);
565
621
case BEZT_KEYTYPE_KEYFRAME: /* traditional yellowish frames for now */
568
if (sel) UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255*(1.0f-alpha));
624
if (sel) UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255 * (1.0f - alpha));
569
625
else glColor4f(0.91f, 0.91f, 0.91f, alpha);
574
630
glCallList(displist2);
619
675
/* locked channels are less strongly shown, as feedback for locked channels in DopeSheet */
620
// TODO: allow this opacity factor to be themed?
621
float kalpha = (channelLocked)? 0.35f : 1.0f;
676
/* TODO: allow this opacity factor to be themed? */
677
float kalpha = (channelLocked) ? 0.25f : 1.0f;
623
for (ak= keys->first; ak; ak= ak->next) {
624
/* optimization: if keyframe doesn't appear within 5 units (screenspace) in visible area, don't draw
679
for (ak = keys->first; ak; ak = ak->next) {
680
/* optimization: if keyframe doesn't appear within 5 units (screenspace) in visible area, don't draw
625
681
* - this might give some improvements, since we current have to flip between view/region matrices
627
683
if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax) == 0)
630
686
/* draw using OpenGL - uglier but faster */
631
// NOTE1: a previous version of this didn't work nice for some intel cards
632
// NOTE2: if we wanted to go back to icons, these are icon = (ak->sel & SELECT) ? ICON_SPACE2 : ICON_SPACE3;
633
draw_keyframe_shape(ak->cfra, ypos, xscale, 5.0f, (ak->sel & SELECT), ak->key_type, KEYFRAME_SHAPE_BOTH, kalpha);
687
/* NOTE1: a previous version of this didn't work nice for some intel cards
688
* NOTE2: if we wanted to go back to icons, these are icon = (ak->sel & SELECT) ? ICON_SPACE2 : ICON_SPACE3; */
689
draw_keyframe_shape(ak->cfra, ypos, xscale, iconsize, (ak->sel & SELECT), ak->key_type, KEYFRAME_SHAPE_BOTH, kalpha);
637
693
glDisable(GL_BLEND);
646
702
BLI_dlrbTree_init(&keys);
647
703
BLI_dlrbTree_init(&blocks);
649
summary_to_keylist(ac, &keys, &blocks);
705
summary_to_keylist(ac, &keys, &blocks);
651
707
BLI_dlrbTree_linkedlist_sync(&keys);
652
708
BLI_dlrbTree_linkedlist_sync(&blocks);
654
draw_keylist(v2d, &keys, &blocks, ypos, 0);
710
draw_keylist(v2d, &keys, &blocks, ypos, 0);
656
712
BLI_dlrbTree_free(&keys);
657
713
BLI_dlrbTree_free(&blocks);
664
720
BLI_dlrbTree_init(&keys);
665
721
BLI_dlrbTree_init(&blocks);
667
scene_to_keylist(ads, sce, &keys, &blocks);
723
scene_to_keylist(ads, sce, &keys, &blocks);
669
725
BLI_dlrbTree_linkedlist_sync(&keys);
670
726
BLI_dlrbTree_linkedlist_sync(&blocks);
672
draw_keylist(v2d, &keys, &blocks, ypos, 0);
728
draw_keylist(v2d, &keys, &blocks, ypos, 0);
674
730
BLI_dlrbTree_free(&keys);
675
731
BLI_dlrbTree_free(&blocks);
682
738
BLI_dlrbTree_init(&keys);
683
739
BLI_dlrbTree_init(&blocks);
685
ob_to_keylist(ads, ob, &keys, &blocks);
741
ob_to_keylist(ads, ob, &keys, &blocks);
687
743
BLI_dlrbTree_linkedlist_sync(&keys);
688
744
BLI_dlrbTree_linkedlist_sync(&blocks);
690
draw_keylist(v2d, &keys, &blocks, ypos, 0);
746
draw_keylist(v2d, &keys, &blocks, ypos, 0);
692
748
BLI_dlrbTree_free(&keys);
693
749
BLI_dlrbTree_free(&blocks);
698
754
DLRBT_Tree keys, blocks;
756
short locked = (fcu->flag & FCURVE_PROTECTED) ||
757
((fcu->grp) && (fcu->grp->flag & AGRP_PROTECTED)) ||
758
((adt && adt->action) && (adt->action->id.lib));
700
760
BLI_dlrbTree_init(&keys);
701
761
BLI_dlrbTree_init(&blocks);
703
fcurve_to_keylist(adt, fcu, &keys, &blocks);
763
fcurve_to_keylist(adt, fcu, &keys, &blocks);
705
765
BLI_dlrbTree_linkedlist_sync(&keys);
706
766
BLI_dlrbTree_linkedlist_sync(&blocks);
708
draw_keylist(v2d, &keys, &blocks, ypos, (fcu->flag & FCURVE_PROTECTED));
768
draw_keylist(v2d, &keys, &blocks, ypos, locked);
710
770
BLI_dlrbTree_free(&keys);
711
771
BLI_dlrbTree_free(&blocks);
716
776
DLRBT_Tree keys, blocks;
778
short locked = (agrp->flag & AGRP_PROTECTED) ||
779
((adt && adt->action) && (adt->action->id.lib));
718
781
BLI_dlrbTree_init(&keys);
719
782
BLI_dlrbTree_init(&blocks);
721
agroup_to_keylist(adt, agrp, &keys, &blocks);
784
agroup_to_keylist(adt, agrp, &keys, &blocks);
723
786
BLI_dlrbTree_linkedlist_sync(&keys);
724
787
BLI_dlrbTree_linkedlist_sync(&blocks);
726
draw_keylist(v2d, &keys, &blocks, ypos, (agrp->flag & AGRP_PROTECTED));
789
draw_keylist(v2d, &keys, &blocks, ypos, locked);
728
791
BLI_dlrbTree_free(&keys);
729
792
BLI_dlrbTree_free(&blocks);
734
797
DLRBT_Tree keys, blocks;
799
short locked = (act && act->id.lib != 0);
736
801
BLI_dlrbTree_init(&keys);
737
802
BLI_dlrbTree_init(&blocks);
739
action_to_keylist(adt, act, &keys, &blocks);
804
action_to_keylist(adt, act, &keys, &blocks);
741
806
BLI_dlrbTree_linkedlist_sync(&keys);
742
807
BLI_dlrbTree_linkedlist_sync(&blocks);
744
draw_keylist(v2d, &keys, &blocks, ypos, 0);
809
draw_keylist(v2d, &keys, &blocks, ypos, locked);
746
811
BLI_dlrbTree_free(&keys);
747
812
BLI_dlrbTree_free(&blocks);
754
819
BLI_dlrbTree_init(&keys);
756
gpl_to_keylist(ads, gpl, &keys);
758
BLI_dlrbTree_linkedlist_sync(&keys);
760
draw_keylist(v2d, &keys, NULL, ypos, (gpl->flag & GP_LAYER_LOCKED));
821
gpl_to_keylist(ads, gpl, &keys);
823
BLI_dlrbTree_linkedlist_sync(&keys);
825
draw_keylist(v2d, &keys, NULL, ypos, (gpl->flag & GP_LAYER_LOCKED));
827
BLI_dlrbTree_free(&keys);
830
void draw_masklay_channel(View2D *v2d, bDopeSheet *ads, MaskLayer *masklay, float ypos)
834
BLI_dlrbTree_init(&keys);
836
mask_to_keylist(ads, masklay, &keys);
838
BLI_dlrbTree_linkedlist_sync(&keys);
840
draw_keylist(v2d, &keys, NULL, ypos, (masklay->flag & MASK_LAYERFLAG_LOCKED));
762
842
BLI_dlrbTree_free(&keys);
774
854
/* get F-Curves to take keyframes from */
775
filter= ANIMFILTER_DATA_VISIBLE; // curves only
855
filter = ANIMFILTER_DATA_VISIBLE;
776
856
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
778
858
/* loop through each F-Curve, grabbing the keyframes */
779
for (ale= anim_data.first; ale; ale= ale->next)
780
fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
859
for (ale = anim_data.first; ale; ale = ale->next) {
861
/* Why not use all #eAnim_KeyType here?
862
* All of the other key types are actually "summaries" themselves, and will just end up duplicating stuff
863
* that comes up through standard filtering of just F-Curves.
864
* Given the way that these work, there isn't really any benefit at all from including them. - Aligorith */
866
switch (ale->datatype) {
868
fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
871
mask_to_keylist(ac->ads, ale->data, keys);
874
gpl_to_keylist(ac->ads, ale->data, keys);
877
// printf("%s: datatype %d unhandled\n", __func__, ale->datatype);
782
882
BLI_freelistN(&anim_data);
806
906
ac.datatype = ANIMCONT_CHANNEL;
808
908
/* get F-Curves to take keyframes from */
809
filter= ANIMFILTER_DATA_VISIBLE; // curves only
909
filter = ANIMFILTER_DATA_VISIBLE; // curves only
810
910
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
812
912
/* loop through each F-Curve, grabbing the keyframes */
813
for (ale= anim_data.first; ale; ale= ale->next)
913
for (ale = anim_data.first; ale; ale = ale->next)
814
914
fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
816
916
BLI_freelistN(&anim_data);
842
942
ac.datatype = ANIMCONT_CHANNEL;
844
944
/* get F-Curves to take keyframes from */
845
filter= ANIMFILTER_DATA_VISIBLE; // curves only
945
filter = ANIMFILTER_DATA_VISIBLE; // curves only
846
946
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
848
948
/* loop through each F-Curve, grabbing the keyframes */
849
for (ale= anim_data.first; ale; ale= ale->next)
949
for (ale = anim_data.first; ale; ale = ale->next)
850
950
fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
852
952
BLI_freelistN(&anim_data);
870
970
/* init new tree */
871
beztTree= BLI_dlrbTree_new();
971
beztTree = BLI_dlrbTree_new();
873
973
/* populate tree with the BezTriples */
874
for (v=0, bezt=fcu->bezt; v < fcu->totvert; v++, bezt++)
974
for (v = 0, bezt = fcu->bezt; v < fcu->totvert; v++, bezt++)
875
975
BLI_dlrbTree_add(beztTree, compare_abk_bezt, nalloc_abk_bezt, nupdate_abk_bezt, bezt);
877
977
/* make sure that it is suitable for linked-list searching too */
934
1034
if (gpl && keys) {
935
1035
/* although the frames should already be in an ordered list, they are not suitable for displaying yet */
936
for (gpf= gpl->frames.first; gpf; gpf= gpf->next)
1036
for (gpf = gpl->frames.first; gpf; gpf = gpf->next)
937
1037
add_gpframe_to_keycolumns_list(keys, gpf);
1041
void mask_to_keylist(bDopeSheet *UNUSED(ads), MaskLayer *masklay, DLRBT_Tree *keys)
1043
MaskLayerShape *masklay_shape;
1045
if (masklay && keys) {
1046
for (masklay_shape = masklay->splines_shapes.first;
1048
masklay_shape = masklay_shape->next)
1050
add_masklay_to_keycolumns_list(keys, masklay_shape);