diff options
author | Dalai Felinto <dalai@blender.org> | 2020-04-03 20:15:01 +0300 |
---|---|---|
committer | Dalai Felinto <dalai@blender.org> | 2020-04-03 20:27:46 +0300 |
commit | d138cbfb47e379edc1ee915a8c6ff65b01f000d6 (patch) | |
tree | f4773ecce897c32eaf75295dd5f6a8e730d471ed /source/blender/editors/animation/keyframes_draw.c | |
parent | b0c1184875d39abac4a65a5d20e263ea6d841009 (diff) |
Code Quality: Replace for loops with LISTBASE_FOREACH
Note this only changes cases where the variable was declared inside
the for loop. To handle it outside as well is a different challenge.
Differential Revision: https://developer.blender.org/D7320
Diffstat (limited to 'source/blender/editors/animation/keyframes_draw.c')
-rw-r--r-- | source/blender/editors/animation/keyframes_draw.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/source/blender/editors/animation/keyframes_draw.c b/source/blender/editors/animation/keyframes_draw.c index eae86d4990c..b921ba039be 100644 --- a/source/blender/editors/animation/keyframes_draw.c +++ b/source/blender/editors/animation/keyframes_draw.c @@ -506,14 +506,14 @@ static void update_keyblocks(DLRBT_Tree *keys, BezTriple *bezt, int bezt_len) /* Find the curve count */ int max_curve = 0; - for (ActKeyColumn *col = keys->first; col; col = col->next) { + LISTBASE_FOREACH (ActKeyColumn *, col, keys) { max_curve = MAX2(max_curve, col->totcurve); } /* Propagate blocks to inserted keys */ ActKeyColumn *prev_ready = NULL; - for (ActKeyColumn *col = keys->first; col; col = col->next) { + LISTBASE_FOREACH (ActKeyColumn *, col, keys) { /* Pre-existing column. */ if (col->totcurve > 0) { prev_ready = col; @@ -731,7 +731,7 @@ static void draw_keylist(View2D *v2d, ipo_color_mix[3] *= 0.5f; uint block_len = 0; - for (ActKeyColumn *ab = keys->first; ab; ab = ab->next) { + LISTBASE_FOREACH (ActKeyColumn *, ab, keys) { if (actkeyblock_get_valid_hold(ab)) { block_len++; } @@ -747,7 +747,7 @@ static void draw_keylist(View2D *v2d, immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); immBegin(GPU_PRIM_TRIS, 6 * block_len); - for (ActKeyColumn *ab = keys->first; ab; ab = ab->next) { + LISTBASE_FOREACH (ActKeyColumn *, ab, keys) { int valid_hold = actkeyblock_get_valid_hold(ab); if (valid_hold != 0) { if ((valid_hold & ACTKEYBLOCK_FLAG_STATIC_HOLD) == 0) { @@ -792,7 +792,7 @@ static void draw_keylist(View2D *v2d, if (keys) { /* count keys */ uint key_len = 0; - for (ActKeyColumn *ak = keys->first; ak; ak = ak->next) { + LISTBASE_FOREACH (ActKeyColumn *, ak, keys) { /* Optimization: if keyframe doesn't appear within 5 units (screenspace) * in visible area, don't draw. * This might give some improvements, @@ -823,7 +823,7 @@ static void draw_keylist(View2D *v2d, short handle_type = KEYFRAME_HANDLE_NONE, extreme_type = KEYFRAME_EXTREME_NONE; - for (ActKeyColumn *ak = keys->first; ak; ak = ak->next) { + LISTBASE_FOREACH (ActKeyColumn *, ak, keys) { if (IN_RANGE_INCL(ak->cfra, v2d->cur.xmin, v2d->cur.xmax)) { if (show_ipo) { handle_type = ak->handle_type; @@ -1154,7 +1154,7 @@ void cachefile_to_keylist(bDopeSheet *ads, ANIM_animdata_filter(&ac, &anim_data, filter, ac.data, ac.datatype); /* loop through each F-Curve, grabbing the keyframes */ - for (bAnimListElem *ale = anim_data.first; ale; ale = ale->next) { + LISTBASE_FOREACH (bAnimListElem *, ale, &anim_data) { fcurve_to_keylist(ale->adt, ale->data, keys, saction_flag); } |