Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/animation/keyframes_draw.c')
-rw-r--r--source/blender/editors/animation/keyframes_draw.c298
1 files changed, 150 insertions, 148 deletions
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c
index cc5cb42a783..cb7dc7ac206 100644
--- a/source/blender/editors/animation/keyframes_draw.c
+++ b/source/blender/editors/animation/keyframes_draw.c
@@ -63,7 +63,7 @@
#include "BKE_key.h"
#include "BKE_material.h"
-#include "BKE_global.h" // XXX remove me!
+#include "BKE_global.h" // XXX remove me!
#include "BIF_gl.h"
@@ -82,8 +82,8 @@
/* NOTE: this is exported to other modules that use the ActKeyColumns for finding keyframes */
short compare_ak_cfraPtr(void *node, void *data)
{
- ActKeyColumn *ak= (ActKeyColumn *)node;
- float *cframe= data;
+ ActKeyColumn *ak = (ActKeyColumn *)node;
+ float *cframe = data;
if (*cframe < ak->cfra)
return -1;
@@ -96,10 +96,10 @@ short compare_ak_cfraPtr(void *node, void *data)
/* --------------- */
/* Comparator callback used for ActKeyColumns and BezTriple */
-static short compare_ak_bezt (void *node, void *data)
+static short compare_ak_bezt(void *node, void *data)
{
- ActKeyColumn *ak= (ActKeyColumn *)node;
- BezTriple *bezt= (BezTriple *)data;
+ ActKeyColumn *ak = (ActKeyColumn *)node;
+ BezTriple *bezt = (BezTriple *)data;
if (bezt->vec[1][0] < ak->cfra)
return -1;
@@ -110,15 +110,15 @@ static short compare_ak_bezt (void *node, void *data)
}
/* New node callback used for building ActKeyColumns from BezTriples */
-static DLRBT_Node *nalloc_ak_bezt (void *data)
+static DLRBT_Node *nalloc_ak_bezt(void *data)
{
- ActKeyColumn *ak= MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumn");
- BezTriple *bezt= (BezTriple *)data;
+ ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumn");
+ BezTriple *bezt = (BezTriple *)data;
/* store settings based on state of BezTriple */
- ak->cfra= bezt->vec[1][0];
- ak->sel= BEZSELECTED(bezt) ? SELECT : 0;
- ak->key_type= BEZKEYTYPE(bezt);
+ ak->cfra = bezt->vec[1][0];
+ ak->sel = BEZSELECTED(bezt) ? SELECT : 0;
+ ak->key_type = BEZKEYTYPE(bezt);
/* set 'modified', since this is used to identify long keyframes */
ak->modified = 1;
@@ -127,10 +127,10 @@ static DLRBT_Node *nalloc_ak_bezt (void *data)
}
/* Node updater callback used for building ActKeyColumns from BezTriples */
-static void nupdate_ak_bezt (void *node, void *data)
+static void nupdate_ak_bezt(void *node, void *data)
{
- ActKeyColumn *ak= (ActKeyColumn *)node;
- BezTriple *bezt= (BezTriple *)data;
+ ActKeyColumn *ak = (ActKeyColumn *)node;
+ BezTriple *bezt = (BezTriple *)data;
/* set selection status and 'touched' status */
if (BEZSELECTED(bezt)) ak->sel = SELECT;
@@ -138,16 +138,16 @@ static void nupdate_ak_bezt (void *node, void *data)
/* for keyframe type, 'proper' keyframes have priority over breakdowns (and other types for now) */
if (BEZKEYTYPE(bezt) == BEZT_KEYTYPE_KEYFRAME)
- ak->key_type= BEZT_KEYTYPE_KEYFRAME;
+ ak->key_type = BEZT_KEYTYPE_KEYFRAME;
}
/* ......... */
/* Comparator callback used for ActKeyColumns and GPencil frame */
-static short compare_ak_gpframe (void *node, void *data)
+static short compare_ak_gpframe(void *node, void *data)
{
- ActKeyColumn *ak= (ActKeyColumn *)node;
- bGPDframe *gpf= (bGPDframe *)data;
+ ActKeyColumn *ak = (ActKeyColumn *)node;
+ bGPDframe *gpf = (bGPDframe *)data;
if (gpf->framenum < ak->cfra)
return -1;
@@ -158,14 +158,14 @@ static short compare_ak_gpframe (void *node, void *data)
}
/* New node callback used for building ActKeyColumns from GPencil frames */
-static DLRBT_Node *nalloc_ak_gpframe (void *data)
+static DLRBT_Node *nalloc_ak_gpframe(void *data)
{
- ActKeyColumn *ak= MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF");
- bGPDframe *gpf= (bGPDframe *)data;
+ ActKeyColumn *ak = MEM_callocN(sizeof(ActKeyColumn), "ActKeyColumnGPF");
+ bGPDframe *gpf = (bGPDframe *)data;
/* store settings based on state of BezTriple */
- ak->cfra= gpf->framenum;
- ak->sel= (gpf->flag & GP_FRAME_SELECT) ? SELECT : 0;
+ ak->cfra = gpf->framenum;
+ ak->sel = (gpf->flag & GP_FRAME_SELECT) ? SELECT : 0;
/* set 'modified', since this is used to identify long keyframes */
ak->modified = 1;
@@ -174,10 +174,10 @@ static DLRBT_Node *nalloc_ak_gpframe (void *data)
}
/* Node updater callback used for building ActKeyColumns from GPencil frames */
-static void nupdate_ak_gpframe (void *node, void *data)
+static void nupdate_ak_gpframe(void *node, void *data)
{
- ActKeyColumn *ak= (ActKeyColumn *)node;
- bGPDframe *gpf= (bGPDframe *)data;
+ ActKeyColumn *ak = (ActKeyColumn *)node;
+ bGPDframe *gpf = (bGPDframe *)data;
/* set selection status and 'touched' status */
if (gpf->flag & GP_FRAME_SELECT) ak->sel = SELECT;
@@ -207,36 +207,36 @@ static void add_gpframe_to_keycolumns_list(DLRBT_Tree *keys, bGPDframe *gpf)
/* ActBeztColumns (Helpers for Long Keyframes) ------------------------------ */
/* maximum size of default buffer for BezTriple columns */
-#define MAX_ABK_BUFSIZE 4
+#define MAX_ABK_BUFSIZE 4
/* BezTriple Container Node */
// NOTE: only used internally while building Long Keyframes for now, but may be useful externally?
typedef struct ActBeztColumn {
/* Tree Node interface ---------------- */
- /* ListBase linkage */
+ /* ListBase linkage */
struct ActBeztColumn *next, *prev;
- /* sorting-tree linkage */
- struct ActBeztColumn *left, *right; /* 'children' of this node, less than and greater than it (respectively) */
- struct ActBeztColumn *parent; /* parent of this node in the tree */
- char tree_col; /* DLRB_BLACK or DLRB_RED */
+ /* sorting-tree linkage */
+ struct ActBeztColumn *left, *right; /* 'children' of this node, less than and greater than it (respectively) */
+ struct ActBeztColumn *parent; /* parent of this node in the tree */
+ char tree_col; /* DLRB_BLACK or DLRB_RED */
char pad;
/* BezTriple Store -------------------- */
- short numBezts; /* number of BezTriples on this frame */
- float cfra; /* frame that the BezTriples occur on */
+ short numBezts; /* number of BezTriples on this frame */
+ float cfra; /* frame that the BezTriples occur on */
- BezTriple *bezts[MAX_ABK_BUFSIZE]; /* buffer of pointers to BezTriples on the same frame */
+ BezTriple *bezts[MAX_ABK_BUFSIZE]; /* buffer of pointers to BezTriples on the same frame */
//BezTriple **bezts_extra; /* secondary buffer of pointers if need be */
} ActBeztColumn;
/* --------------- */
/* Comparator callback used for ActBeztColumns and BezTriple */
-static short compare_abk_bezt (void *node, void *data)
+static short compare_abk_bezt(void *node, void *data)
{
- ActBeztColumn *abk= (ActBeztColumn *)node;
- BezTriple *bezt= (BezTriple *)data;
+ ActBeztColumn *abk = (ActBeztColumn *)node;
+ BezTriple *bezt = (BezTriple *)data;
if (bezt->vec[1][0] < abk->cfra)
return -1;
@@ -247,23 +247,23 @@ static short compare_abk_bezt (void *node, void *data)
}
/* New node callback used for building ActBeztColumns from BezTriples */
-static DLRBT_Node *nalloc_abk_bezt (void *data)
+static DLRBT_Node *nalloc_abk_bezt(void *data)
{
- ActBeztColumn *abk= MEM_callocN(sizeof(ActBeztColumn), "ActKeyColumn");
- BezTriple *bezt= (BezTriple *)data;
+ ActBeztColumn *abk = MEM_callocN(sizeof(ActBeztColumn), "ActKeyColumn");
+ BezTriple *bezt = (BezTriple *)data;
/* store the BeztTriple in the buffer, and keep track of its frame number */
- abk->cfra= bezt->vec[1][0];
- abk->bezts[abk->numBezts++]= bezt;
+ abk->cfra = bezt->vec[1][0];
+ abk->bezts[abk->numBezts++] = bezt;
return (DLRBT_Node *)abk;
}
/* Node updater callback used for building ActBeztColumns from BezTriples */
-static void nupdate_abk_bezt (void *node, void *data)
+static void nupdate_abk_bezt(void *node, void *data)
{
- ActBeztColumn *abk= (ActBeztColumn *)node;
- BezTriple *bezt= (BezTriple *)data;
+ ActBeztColumn *abk = (ActBeztColumn *)node;
+ BezTriple *bezt = (BezTriple *)data;
/* just add the BezTriple to the buffer if there's space, or allocate a new one */
if (abk->numBezts >= MAX_ABK_BUFSIZE) {
@@ -274,14 +274,14 @@ static void nupdate_abk_bezt (void *node, void *data)
}
else {
/* just store an extra one */
- abk->bezts[abk->numBezts++]= bezt;
+ abk->bezts[abk->numBezts++] = bezt;
}
}
/* --------------- */
/* Return the BezTriple in the given ActBeztColumn that matches the requested value */
-static BezTriple *abk_get_bezt_with_value (ActBeztColumn *abk, float value)
+static BezTriple *abk_get_bezt_with_value(ActBeztColumn *abk, float value)
{
BezTriple *bezt;
int i;
@@ -293,12 +293,12 @@ static BezTriple *abk_get_bezt_with_value (ActBeztColumn *abk, float value)
/* look over each BezTriple in this container */
for (i = 0; i < abk->numBezts; i++) {
/* only do exact match for now... */
- if (/*i >= MAX_ABK_BUFSIZE*/0) {
+ if (/*i >= MAX_ABK_BUFSIZE*/ 0) {
// TODO: this case needs special handling
}
else {
/* just use the default buffer */
- bezt= abk->bezts[i];
+ bezt = abk->bezts[i];
if (bezt->vec[1][1] == value)
return bezt;
@@ -314,8 +314,8 @@ static BezTriple *abk_get_bezt_with_value (ActBeztColumn *abk, float value)
/* NOTE: this is exported to other modules that use the ActKeyBlocks for finding long-keyframes */
short compare_ab_cfraPtr(void *node, void *data)
{
- ActKeyBlock *ab= (ActKeyBlock *)node;
- float *cframe= data;
+ ActKeyBlock *ab = (ActKeyBlock *)node;
+ float *cframe = data;
if (*cframe < ab->start)
return -1;
@@ -330,13 +330,13 @@ short compare_ab_cfraPtr(void *node, void *data)
/* Create a ActKeyColumn for a pair of BezTriples */
static ActKeyBlock *bezts_to_new_actkeyblock(BezTriple *prev, BezTriple *beztn)
{
- ActKeyBlock *ab= MEM_callocN(sizeof(ActKeyBlock), "ActKeyBlock");
+ ActKeyBlock *ab = MEM_callocN(sizeof(ActKeyBlock), "ActKeyBlock");
- ab->start= prev->vec[1][0];
- ab->end= beztn->vec[1][0];
- ab->val= beztn->vec[1][1];
+ ab->start = prev->vec[1][0];
+ ab->end = beztn->vec[1][0];
+ ab->val = beztn->vec[1][1];
- ab->sel= (BEZSELECTED(prev) || BEZSELECTED(beztn)) ? SELECT : 0;
+ ab->sel = (BEZSELECTED(prev) || BEZSELECTED(beztn)) ? SELECT : 0;
ab->modified = 1;
return ab;
@@ -344,44 +344,44 @@ static ActKeyBlock *bezts_to_new_actkeyblock(BezTriple *prev, BezTriple *beztn)
static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree, BezTriple *beztn)
{
- ActKeyBlock *new_ab= NULL;
+ ActKeyBlock *new_ab = NULL;
ActBeztColumn *abk;
BezTriple *prev;
/* get the BezTriple immediately before the given one which has the same value */
- /* the keyframes immediately before the ones containing the specified keyframe */
- abk= (ActBeztColumn *)BLI_dlrbTree_search_prev(beztTree, compare_abk_bezt, beztn);
- /* if applicable, the BezTriple with the same value */
- prev= (abk) ? abk_get_bezt_with_value(abk, beztn->vec[1][1]) : NULL;
+ /* the keyframes immediately before the ones containing the specified keyframe */
+ abk = (ActBeztColumn *)BLI_dlrbTree_search_prev(beztTree, compare_abk_bezt, beztn);
+ /* if applicable, the BezTriple with the same value */
+ prev = (abk) ? abk_get_bezt_with_value(abk, beztn->vec[1][1]) : NULL;
/* check if block needed - same value(s)?
* -> firstly, handles must have same central value as each other
* -> secondly, handles which control that section of the curve must be constant
*/
if ((!prev) || (!beztn)) return;
- if (IS_EQF(beztn->vec[1][1], prev->vec[1][1])==0) return;
- if (IS_EQF(beztn->vec[1][1], beztn->vec[0][1])==0) return;
- if (IS_EQF(prev->vec[1][1], prev->vec[2][1])==0) return;
+ if (IS_EQF(beztn->vec[1][1], prev->vec[1][1]) == 0) return;
+ if (IS_EQF(beztn->vec[1][1], beztn->vec[0][1]) == 0) return;
+ if (IS_EQF(prev->vec[1][1], prev->vec[2][1]) == 0) return;
/* if there are no blocks already, just add as root */
if (blocks->root == NULL) {
/* just add this as the root, then call the tree-balancing functions to validate */
- new_ab= bezts_to_new_actkeyblock(prev, beztn);
- blocks->root= (DLRBT_Node *)new_ab;
+ new_ab = bezts_to_new_actkeyblock(prev, beztn);
+ blocks->root = (DLRBT_Node *)new_ab;
}
else {
- ActKeyBlock *ab, *abn=NULL;
+ ActKeyBlock *ab, *abn = NULL;
/* try to find a keyblock that starts on the previous beztriple, and add a new one if none start there
* Note: we can't search from end to try to optimize this as it causes errors there's
- * an A ___ B |---| B situation
+ * an A ___ B |---| B situation
*/
// FIXME: here there is a bug where we are trying to get the summary for the following channels
// A|--------------|A ______________ B|--------------|B
// A|------------------------------------------------|A
// A|----|A|---|A|-----------------------------------|A
- for (ab= blocks->root; ab; ab= abn) {
+ for (ab = blocks->root; ab; ab = abn) {
/* check if this is a match, or whether we go left or right */
if (ab->start == prev->vec[1][0]) {
/* set selection status and 'touched' status */
@@ -392,24 +392,24 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree,
return;
}
else {
- ActKeyBlock **abnp= NULL;
+ ActKeyBlock **abnp = NULL;
/* check if go left or right, but if not available, add new node */
if (ab->start < prev->vec[1][0])
- abnp= &ab->right;
+ abnp = &ab->right;
else
- abnp= &ab->left;
+ abnp = &ab->left;
/* if this does not exist, add a new node, otherwise continue... */
if (*abnp == NULL) {
/* add a new node representing this, and attach it to the relevant place */
- new_ab= bezts_to_new_actkeyblock(prev, beztn);
- new_ab->parent= ab;
- *abnp= new_ab;
+ new_ab = bezts_to_new_actkeyblock(prev, beztn);
+ new_ab->parent = ab;
+ *abnp = new_ab;
break;
}
else
- abn= *abnp;
+ abn = *abnp;
}
}
}
@@ -421,7 +421,7 @@ static void add_bezt_to_keyblocks_list(DLRBT_Tree *blocks, DLRBT_Tree *beztTree,
/* --------- */
/* Handle the 'touched' status of ActKeyColumn tree nodes */
-static void set_touched_actkeycolumn (ActKeyColumn *ak)
+static void set_touched_actkeycolumn(ActKeyColumn *ak)
{
/* sanity check */
if (ak == NULL)
@@ -429,7 +429,7 @@ static void set_touched_actkeycolumn (ActKeyColumn *ak)
/* deal with self first */
if (ak->modified) {
- ak->modified= 0;
+ ak->modified = 0;
ak->totcurve++;
}
@@ -439,7 +439,7 @@ static void set_touched_actkeycolumn (ActKeyColumn *ak)
}
/* Handle the 'touched' status of ActKeyBlock tree nodes */
-static void set_touched_actkeyblock (ActKeyBlock *ab)
+static void set_touched_actkeyblock(ActKeyBlock *ab)
{
/* sanity check */
if (ab == NULL)
@@ -447,7 +447,7 @@ static void set_touched_actkeyblock (ActKeyBlock *ab)
/* deal with self first */
if (ab->modified) {
- ab->modified= 0;
+ ab->modified = 0;
ab->totcurve++;
}
@@ -469,17 +469,17 @@ short actkeyblock_is_valid(ActKeyBlock *ab, DLRBT_Tree *keys)
return 0;
/* find out how many curves occur at each keyframe */
- ak= (ActKeyColumn *)BLI_dlrbTree_search_exact(keys, compare_ak_cfraPtr, &ab->start);
- startCurves = (ak)? ak->totcurve: 0;
+ ak = (ActKeyColumn *)BLI_dlrbTree_search_exact(keys, compare_ak_cfraPtr, &ab->start);
+ startCurves = (ak) ? ak->totcurve : 0;
- ak= (ActKeyColumn *)BLI_dlrbTree_search_exact(keys, compare_ak_cfraPtr, &ab->end);
- endCurves = (ak)? ak->totcurve: 0;
+ ak = (ActKeyColumn *)BLI_dlrbTree_search_exact(keys, compare_ak_cfraPtr, &ab->end);
+ endCurves = (ak) ? ak->totcurve : 0;
/* only draw keyblock if it appears in at all of the keyframes at lowest end */
if (!startCurves && !endCurves)
return 0;
- totCurves = (startCurves>endCurves)? endCurves: startCurves;
+ totCurves = (startCurves > endCurves) ? endCurves : startCurves;
return (ab->totcurve >= totCurves);
}
@@ -487,52 +487,54 @@ short actkeyblock_is_valid(ActKeyBlock *ab, DLRBT_Tree *keys)
/* coordinates for diamond shape */
static const float _unit_diamond_shape[4][2] = {
- {0.0f, 1.0f}, /* top vert */
- {1.0f, 0.0f}, /* mid-right */
- {0.0f, -1.0f}, /* bottom vert */
- {-1.0f, 0.0f} /* mid-left */
+ {0.0f, 1.0f}, /* top vert */
+ {1.0f, 0.0f}, /* mid-right */
+ {0.0f, -1.0f}, /* bottom vert */
+ {-1.0f, 0.0f} /* mid-left */
};
/* draw a simple diamond shape with OpenGL */
void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel, short key_type, short mode, float alpha)
{
- static GLuint displist1=0;
- static GLuint displist2=0;
+ static GLuint displist1 = 0;
+ static GLuint displist2 = 0;
/* initialize 2 display lists for diamond shape - one empty, one filled */
if (displist1 == 0) {
- displist1= glGenLists(1);
- glNewList(displist1, GL_COMPILE);
+ displist1 = glGenLists(1);
+ glNewList(displist1, GL_COMPILE);
- glBegin(GL_LINE_LOOP);
- glVertex2fv(_unit_diamond_shape[0]);
- glVertex2fv(_unit_diamond_shape[1]);
- glVertex2fv(_unit_diamond_shape[2]);
- glVertex2fv(_unit_diamond_shape[3]);
- glEnd();
+ glBegin(GL_LINE_LOOP);
+ glVertex2fv(_unit_diamond_shape[0]);
+ glVertex2fv(_unit_diamond_shape[1]);
+ glVertex2fv(_unit_diamond_shape[2]);
+ glVertex2fv(_unit_diamond_shape[3]);
+ glEnd();
+
glEndList();
}
if (displist2 == 0) {
- displist2= glGenLists(1);
- glNewList(displist2, GL_COMPILE);
+ displist2 = glGenLists(1);
+ glNewList(displist2, GL_COMPILE);
- glBegin(GL_QUADS);
- glVertex2fv(_unit_diamond_shape[0]);
- glVertex2fv(_unit_diamond_shape[1]);
- glVertex2fv(_unit_diamond_shape[2]);
- glVertex2fv(_unit_diamond_shape[3]);
- glEnd();
+ glBegin(GL_QUADS);
+ glVertex2fv(_unit_diamond_shape[0]);
+ glVertex2fv(_unit_diamond_shape[1]);
+ glVertex2fv(_unit_diamond_shape[2]);
+ glVertex2fv(_unit_diamond_shape[3]);
+ glEnd();
+
glEndList();
}
/* tweak size of keyframe shape according to type of keyframe
- * - 'proper' keyframes have key_type=0, so get drawn at full size
+ * - 'proper' keyframes have key_type=0, so get drawn at full size
*/
- hsize -= 0.5f*key_type;
+ hsize -= 0.5f * key_type;
/* adjust view transform before starting */
glTranslatef(x, y, 0.0f);
- glScalef(1.0f/xscale*hsize, hsize, 1.0f);
+ glScalef(1.0f / xscale * hsize, hsize, 1.0f);
/* anti-aliased lines for more consistent appearance */
glEnable(GL_LINE_SMOOTH);
@@ -546,29 +548,29 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
if (sel) glColor4f(0.33f, 0.75f, 0.93f, alpha);
else glColor4f(0.70f, 0.86f, 0.91f, alpha);
}
- break;
+ break;
case BEZT_KEYTYPE_EXTREME: /* redish frames for now */
{
if (sel) glColor4f(0.95f, 0.5f, 0.5f, alpha);
else glColor4f(0.91f, 0.70f, 0.80f, alpha);
}
- break;
+ break;
case BEZT_KEYTYPE_JITTER: /* greenish frames for now? */
{
if (sel) glColor4f(0.38f, 0.75f, 0.26f, alpha);
else glColor4f(0.58f, 0.90f, 0.46f, alpha);
}
- break;
+ break;
case BEZT_KEYTYPE_KEYFRAME: /* traditional yellowish frames for now */
default:
{
- if (sel) UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255*(1.0f-alpha));
+ if (sel) UI_ThemeColorShadeAlpha(TH_STRIP_SELECT, 50, -255 * (1.0f - alpha));
else glColor4f(0.91f, 0.91f, 0.91f, alpha);
}
- break;
+ break;
}
glCallList(displist2);
@@ -584,7 +586,7 @@ void draw_keyframe_shape(float x, float y, float xscale, float hsize, short sel,
glDisable(GL_LINE_SMOOTH);
/* restore view transform */
- glScalef(xscale/hsize, 1.0f/hsize, 1.0);
+ glScalef(xscale / hsize, 1.0f / hsize, 1.0f);
glTranslatef(-x, -y, 0.0f);
}
@@ -601,7 +603,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
/* draw keyblocks */
if (blocks) {
- for (ab= blocks->first; ab; ab= ab->next) {
+ for (ab = blocks->first; ab; ab = ab->next) {
if (actkeyblock_is_valid(ab, keys)) {
/* draw block */
if (ab->sel)
@@ -609,7 +611,7 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
else
UI_ThemeColor4(TH_STRIP);
- glRectf(ab->start, ypos-5, ab->end, ypos+5);
+ glRectf(ab->start, ypos - 5, ab->end, ypos + 5);
}
}
}
@@ -618,9 +620,9 @@ static void draw_keylist(View2D *v2d, DLRBT_Tree *keys, DLRBT_Tree *blocks, floa
if (keys) {
/* locked channels are less strongly shown, as feedback for locked channels in DopeSheet */
// TODO: allow this opacity factor to be themed?
- float kalpha = (channelLocked)? 0.35f : 1.0f;
+ float kalpha = (channelLocked) ? 0.35f : 1.0f;
- for (ak= keys->first; ak; ak= ak->next) {
+ for (ak = keys->first; ak; ak = ak->next) {
/* optimization: if keyframe doesn't appear within 5 units (screenspace) in visible area, don't draw
* - this might give some improvements, since we current have to flip between view/region matrices
*/
@@ -646,12 +648,12 @@ void draw_summary_channel(View2D *v2d, bAnimContext *ac, float ypos)
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
- summary_to_keylist(ac, &keys, &blocks);
+ summary_to_keylist(ac, &keys, &blocks);
BLI_dlrbTree_linkedlist_sync(&keys);
BLI_dlrbTree_linkedlist_sync(&blocks);
- draw_keylist(v2d, &keys, &blocks, ypos, 0);
+ draw_keylist(v2d, &keys, &blocks, ypos, 0);
BLI_dlrbTree_free(&keys);
BLI_dlrbTree_free(&blocks);
@@ -664,12 +666,12 @@ void draw_scene_channel(View2D *v2d, bDopeSheet *ads, Scene *sce, float ypos)
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
- scene_to_keylist(ads, sce, &keys, &blocks);
+ scene_to_keylist(ads, sce, &keys, &blocks);
BLI_dlrbTree_linkedlist_sync(&keys);
BLI_dlrbTree_linkedlist_sync(&blocks);
- draw_keylist(v2d, &keys, &blocks, ypos, 0);
+ draw_keylist(v2d, &keys, &blocks, ypos, 0);
BLI_dlrbTree_free(&keys);
BLI_dlrbTree_free(&blocks);
@@ -682,12 +684,12 @@ void draw_object_channel(View2D *v2d, bDopeSheet *ads, Object *ob, float ypos)
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
- ob_to_keylist(ads, ob, &keys, &blocks);
+ ob_to_keylist(ads, ob, &keys, &blocks);
BLI_dlrbTree_linkedlist_sync(&keys);
BLI_dlrbTree_linkedlist_sync(&blocks);
- draw_keylist(v2d, &keys, &blocks, ypos, 0);
+ draw_keylist(v2d, &keys, &blocks, ypos, 0);
BLI_dlrbTree_free(&keys);
BLI_dlrbTree_free(&blocks);
@@ -700,12 +702,12 @@ void draw_fcurve_channel(View2D *v2d, AnimData *adt, FCurve *fcu, float ypos)
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
- fcurve_to_keylist(adt, fcu, &keys, &blocks);
+ fcurve_to_keylist(adt, fcu, &keys, &blocks);
BLI_dlrbTree_linkedlist_sync(&keys);
BLI_dlrbTree_linkedlist_sync(&blocks);
- draw_keylist(v2d, &keys, &blocks, ypos, (fcu->flag & FCURVE_PROTECTED));
+ draw_keylist(v2d, &keys, &blocks, ypos, (fcu->flag & FCURVE_PROTECTED));
BLI_dlrbTree_free(&keys);
BLI_dlrbTree_free(&blocks);
@@ -718,12 +720,12 @@ void draw_agroup_channel(View2D *v2d, AnimData *adt, bActionGroup *agrp, float y
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
- agroup_to_keylist(adt, agrp, &keys, &blocks);
+ agroup_to_keylist(adt, agrp, &keys, &blocks);
BLI_dlrbTree_linkedlist_sync(&keys);
BLI_dlrbTree_linkedlist_sync(&blocks);
- draw_keylist(v2d, &keys, &blocks, ypos, (agrp->flag & AGRP_PROTECTED));
+ draw_keylist(v2d, &keys, &blocks, ypos, (agrp->flag & AGRP_PROTECTED));
BLI_dlrbTree_free(&keys);
BLI_dlrbTree_free(&blocks);
@@ -736,12 +738,12 @@ void draw_action_channel(View2D *v2d, AnimData *adt, bAction *act, float ypos)
BLI_dlrbTree_init(&keys);
BLI_dlrbTree_init(&blocks);
- action_to_keylist(adt, act, &keys, &blocks);
+ action_to_keylist(adt, act, &keys, &blocks);
BLI_dlrbTree_linkedlist_sync(&keys);
BLI_dlrbTree_linkedlist_sync(&blocks);
- draw_keylist(v2d, &keys, &blocks, ypos, 0);
+ draw_keylist(v2d, &keys, &blocks, ypos, 0);
BLI_dlrbTree_free(&keys);
BLI_dlrbTree_free(&blocks);
@@ -753,11 +755,11 @@ void draw_gpl_channel(View2D *v2d, bDopeSheet *ads, bGPDlayer *gpl, float ypos)
BLI_dlrbTree_init(&keys);
- gpl_to_keylist(ads, gpl, &keys);
+ gpl_to_keylist(ads, gpl, &keys);
BLI_dlrbTree_linkedlist_sync(&keys);
- draw_keylist(v2d, &keys, NULL, ypos, (gpl->flag & GP_LAYER_LOCKED));
+ draw_keylist(v2d, &keys, NULL, ypos, (gpl->flag & GP_LAYER_LOCKED));
BLI_dlrbTree_free(&keys);
}
@@ -772,11 +774,11 @@ void summary_to_keylist(bAnimContext *ac, DLRBT_Tree *keys, DLRBT_Tree *blocks)
int filter;
/* get F-Curves to take keyframes from */
- filter= ANIMFILTER_DATA_VISIBLE; // curves only
+ filter = ANIMFILTER_DATA_VISIBLE; // curves only
ANIM_animdata_filter(ac, &anim_data, filter, ac->data, ac->datatype);
/* loop through each F-Curve, grabbing the keyframes */
- for (ale= anim_data.first; ale; ale= ale->next)
+ for (ale = anim_data.first; ale; ale = ale->next)
fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
BLI_freelistN(&anim_data);
@@ -806,11 +808,11 @@ void scene_to_keylist(bDopeSheet *ads, Scene *sce, DLRBT_Tree *keys, DLRBT_Tree
ac.datatype = ANIMCONT_CHANNEL;
/* get F-Curves to take keyframes from */
- filter= ANIMFILTER_DATA_VISIBLE; // curves only
+ filter = ANIMFILTER_DATA_VISIBLE; // curves only
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* loop through each F-Curve, grabbing the keyframes */
- for (ale= anim_data.first; ale; ale= ale->next)
+ for (ale = anim_data.first; ale; ale = ale->next)
fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
BLI_freelistN(&anim_data);
@@ -842,11 +844,11 @@ void ob_to_keylist(bDopeSheet *ads, Object *ob, DLRBT_Tree *keys, DLRBT_Tree *bl
ac.datatype = ANIMCONT_CHANNEL;
/* get F-Curves to take keyframes from */
- filter= ANIMFILTER_DATA_VISIBLE; // curves only
+ filter = ANIMFILTER_DATA_VISIBLE; // curves only
ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype);
/* loop through each F-Curve, grabbing the keyframes */
- for (ale= anim_data.first; ale; ale= ale->next)
+ for (ale = anim_data.first; ale; ale = ale->next)
fcurve_to_keylist(ale->adt, ale->data, keys, blocks);
BLI_freelistN(&anim_data);
@@ -868,10 +870,10 @@ void fcurve_to_keylist(AnimData *adt, FCurve *fcu, DLRBT_Tree *keys, DLRBT_Tree
*/
if (blocks) {
/* init new tree */
- beztTree= BLI_dlrbTree_new();
+ beztTree = BLI_dlrbTree_new();
/* populate tree with the BezTriples */
- for (v=0, bezt=fcu->bezt; v < fcu->totvert; v++, bezt++)
+ for (v = 0, bezt = fcu->bezt; v < fcu->totvert; v++, bezt++)
BLI_dlrbTree_add(beztTree, compare_abk_bezt, nalloc_abk_bezt, nupdate_abk_bezt, bezt);
/* make sure that it is suitable for linked-list searching too */
@@ -879,7 +881,7 @@ void fcurve_to_keylist(AnimData *adt, FCurve *fcu, DLRBT_Tree *keys, DLRBT_Tree
}
/* loop through beztriples, making ActKeysColumns and ActKeyBlocks */
- for (v=0, bezt=fcu->bezt; v < fcu->totvert; v++, bezt++) {
+ for (v = 0, bezt = fcu->bezt; v < fcu->totvert; v++, bezt++) {
add_bezt_to_keycolumns_list(keys, bezt);
if (blocks) add_bezt_to_keyblocks_list(blocks, beztTree, bezt);
}
@@ -908,7 +910,7 @@ void agroup_to_keylist(AnimData *adt, bActionGroup *agrp, DLRBT_Tree *keys, DLRB
if (agrp) {
/* loop through F-Curves */
- for (fcu= agrp->channels.first; fcu && fcu->grp==agrp; fcu= fcu->next) {
+ for (fcu = agrp->channels.first; fcu && fcu->grp == agrp; fcu = fcu->next) {
fcurve_to_keylist(adt, fcu, keys, blocks);
}
}
@@ -920,7 +922,7 @@ void action_to_keylist(AnimData *adt, bAction *act, DLRBT_Tree *keys, DLRBT_Tree
if (act) {
/* loop through F-Curves */
- for (fcu= act->curves.first; fcu; fcu= fcu->next) {
+ for (fcu = act->curves.first; fcu; fcu = fcu->next) {
fcurve_to_keylist(adt, fcu, keys, blocks);
}
}
@@ -933,7 +935,7 @@ void gpl_to_keylist(bDopeSheet *UNUSED(ads), bGPDlayer *gpl, DLRBT_Tree *keys)
if (gpl && keys) {
/* although the frames should already be in an ordered list, they are not suitable for displaying yet */
- for (gpf= gpl->frames.first; gpf; gpf= gpf->next)
+ for (gpf = gpl->frames.first; gpf; gpf = gpf->next)
add_gpframe_to_keycolumns_list(keys, gpf);
}
}