diff options
author | Julian Eisel <julian@blender.org> | 2022-06-30 19:36:42 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-06-30 19:38:44 +0300 |
commit | 65166e145b4d6292abc289b71894c53b25c186ba (patch) | |
tree | 707513038d00a964d7a400ac8e7e22251fffb02d /source/blender/editors/space_graph | |
parent | 66de653784ab06ccea46413de6b2f086b5a69d30 (diff) |
Cleanup: Remove scene frame macros (`CFRA` et al.)
Removes the following macros for scene/render frame values:
- `CFRA`
- `SUBFRA`
- `SFRA`
- `EFRA`
These macros don't add much, other than saving a few characters when typing.
It's not immediately clear what they refer to, they just hide what they
actually access. Just be explicit and clear about that.
Plus these macros gave read and write access to the variables, so eyesores like
this would be done (eyesore because it looks like assigning to a constant):
```
CFRA = some_frame_nbr;
```
Reviewed By: sergey
Differential Revision: https://developer.blender.org/D15311
Diffstat (limited to 'source/blender/editors/space_graph')
-rw-r--r-- | source/blender/editors/space_graph/graph_edit.c | 18 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_ops.c | 8 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_select.c | 8 |
3 files changed, 17 insertions, 17 deletions
diff --git a/source/blender/editors/space_graph/graph_edit.c b/source/blender/editors/space_graph/graph_edit.c index 324da039daa..7e8bca88744 100644 --- a/source/blender/editors/space_graph/graph_edit.c +++ b/source/blender/editors/space_graph/graph_edit.c @@ -156,10 +156,10 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode) x = sipo->cursorTime; } else if (adt) { - x = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP); + x = BKE_nla_tweakedit_remap(adt, (float)scene->r.cfra, NLATIME_CONVERT_UNMAP); } else { - x = (float)CFRA; + x = (float)scene->r.cfra; } /* Normalize units of cursor's value. */ @@ -178,7 +178,7 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode) } else { const AnimationEvalContext anim_eval_context = BKE_animsys_eval_context_construct( - ac->depsgraph, (float)CFRA); + ac->depsgraph, (float)scene->r.cfra); for (ale = anim_data.first; ale; ale = ale->next) { FCurve *fcu = (FCurve *)ale->key_data; @@ -211,12 +211,12 @@ static void insert_graph_keys(bAnimContext *ac, eGraphKeys_InsertKey_Types mode) AnimData *adt = ANIM_nla_mapping_get(ac, ale); /* Adjust current frame for NLA-mapping. */ - float cfra = (float)CFRA; + float cfra = (float)scene->r.cfra; if ((sipo) && (sipo->mode == SIPO_MODE_DRIVERS)) { cfra = sipo->cursorTime; } else if (adt) { - cfra = BKE_nla_tweakedit_remap(adt, (float)CFRA, NLATIME_CONVERT_UNMAP); + cfra = BKE_nla_tweakedit_remap(adt, (float)scene->r.cfra, NLATIME_CONVERT_UNMAP); } const float curval = evaluate_fcurve_only_curve(fcu, cfra); @@ -1106,8 +1106,8 @@ static int graphkeys_sound_bake_exec(bContext *C, wmOperator *op) } /* Determine extents of the baking. */ - sbi.cfra = start = CFRA; - end = CFRA + sbi.length - 1; + sbi.cfra = start = scene->r.cfra; + end = scene->r.cfra + sbi.length - 1; /* Filter anim channels. */ filter = (ANIMFILTER_DATA_VISIBLE | ANIMFILTER_CURVE_VISIBLE | ANIMFILTER_FCURVESONLY | @@ -2130,8 +2130,8 @@ static int graphkeys_framejump_exec(bContext *C, wmOperator *UNUSED(op)) } else { /* Animation Mode - Affects current frame (int) */ - CFRA = round_fl_to_int(sum_time / num_keyframes); - SUBFRA = 0.0f; + scene->r.cfra = round_fl_to_int(sum_time / num_keyframes); + scene->r.subframe = 0.0f; } sipo->cursorVal = sum_value / (float)num_keyframes; diff --git a/source/blender/editors/space_graph/graph_ops.c b/source/blender/editors/space_graph/graph_ops.c index 158f2eae88f..8deea21318c 100644 --- a/source/blender/editors/space_graph/graph_ops.c +++ b/source/blender/editors/space_graph/graph_ops.c @@ -72,21 +72,21 @@ static void graphview_cursor_apply(bContext *C, wmOperator *op) * NOTE: sync this part of the code with ANIM_OT_change_frame */ /* 1) frame is rounded to the nearest int, since frames are ints */ - CFRA = round_fl_to_int(frame); + scene->r.cfra = round_fl_to_int(frame); if (scene->r.flag & SCER_LOCK_FRAME_SELECTION) { /* Clip to preview range * NOTE: Preview range won't go into negative values, * so only clamping once should be fine. */ - CLAMP(CFRA, PSFRA, PEFRA); + CLAMP(scene->r.cfra, PSFRA, PEFRA); } else { /* Prevent negative frames */ - FRAMENUMBER_MIN_CLAMP(CFRA); + FRAMENUMBER_MIN_CLAMP(scene->r.cfra); } - SUBFRA = 0.0f; + scene->r.subframe = 0.0f; DEG_id_tag_update(&scene->id, ID_RECALC_FRAME_CHANGE); } diff --git a/source/blender/editors/space_graph/graph_select.c b/source/blender/editors/space_graph/graph_select.c index 70f9e4a60d9..a36bd5c1461 100644 --- a/source/blender/editors/space_graph/graph_select.c +++ b/source/blender/editors/space_graph/graph_select.c @@ -1209,7 +1209,7 @@ static void columnselect_graph_keys(bAnimContext *ac, short mode) ce = MEM_callocN(sizeof(CfraElem), "cfraElem"); BLI_addtail(&ked.list, ce); - ce->cfra = (float)CFRA; + ce->cfra = (float)scene->r.cfra; break; case GRAPHKEYS_COLUMNSEL_MARKERS_COLUMN: /* list of selected markers */ @@ -1521,10 +1521,10 @@ static void graphkeys_select_leftright(bAnimContext *ac, short leftright, short if (leftright == GRAPHKEYS_LRSEL_LEFT) { ked.f1 = MINAFRAMEF; - ked.f2 = (float)(CFRA + 0.1f); + ked.f2 = (float)(scene->r.cfra + 0.1f); } else { - ked.f1 = (float)(CFRA - 0.1f); + ked.f1 = (float)(scene->r.cfra - 0.1f); ked.f2 = MAXFRAMEF; } @@ -1605,7 +1605,7 @@ static int graphkeys_select_leftright_invoke(bContext *C, wmOperator *op, const /* determine which side of the current frame mouse is on */ x = UI_view2d_region_to_view_x(v2d, event->mval[0]); - if (x < CFRA) { + if (x < scene->r.cfra) { RNA_enum_set(op->ptr, "mode", GRAPHKEYS_LRSEL_LEFT); } else { |