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:
authorJulian Eisel <julian@blender.org>2022-06-30 19:36:42 +0300
committerJulian Eisel <julian@blender.org>2022-06-30 19:38:44 +0300
commit65166e145b4d6292abc289b71894c53b25c186ba (patch)
tree707513038d00a964d7a400ac8e7e22251fffb02d /source/blender/blenkernel
parent66de653784ab06ccea46413de6b2f086b5a69d30 (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/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/gpencil_curve.c2
-rw-r--r--source/blender/blenkernel/intern/gpencil_geom.cc4
-rw-r--r--source/blender/blenkernel/intern/image.cc2
-rw-r--r--source/blender/blenkernel/intern/pointcache.c24
-rw-r--r--source/blender/blenkernel/intern/sound.c18
5 files changed, 25 insertions, 25 deletions
diff --git a/source/blender/blenkernel/intern/gpencil_curve.c b/source/blender/blenkernel/intern/gpencil_curve.c
index 20b8342f090..d68b322e4c5 100644
--- a/source/blender/blenkernel/intern/gpencil_curve.c
+++ b/source/blender/blenkernel/intern/gpencil_curve.c
@@ -501,7 +501,7 @@ void BKE_gpencil_convert_curve(Main *bmain,
}
/* Check if there is an active frame and add if needed. */
- bGPDframe *gpf = BKE_gpencil_layer_frame_get(gpl, CFRA, GP_GETFRAME_ADD_COPY);
+ bGPDframe *gpf = BKE_gpencil_layer_frame_get(gpl, scene->r.cfra, GP_GETFRAME_ADD_COPY);
/* Read all splines of the curve and create a stroke for each. */
LISTBASE_FOREACH (Nurb *, nu, &cu->nurb) {
diff --git a/source/blender/blenkernel/intern/gpencil_geom.cc b/source/blender/blenkernel/intern/gpencil_geom.cc
index 0445a1540c7..d0075a7d161 100644
--- a/source/blender/blenkernel/intern/gpencil_geom.cc
+++ b/source/blender/blenkernel/intern/gpencil_geom.cc
@@ -2706,7 +2706,7 @@ bool BKE_gpencil_convert_mesh(Main *bmain,
gpl_fill = BKE_gpencil_layer_addnew(gpd, element_name, true, false);
}
bGPDframe *gpf_fill = BKE_gpencil_layer_frame_get(
- gpl_fill, CFRA + frame_offset, GP_GETFRAME_ADD_NEW);
+ gpl_fill, scene->r.cfra + frame_offset, GP_GETFRAME_ADD_NEW);
int i;
for (i = 0; i < mpoly_len; i++) {
const MPoly *mp = &mpoly[i];
@@ -2781,7 +2781,7 @@ bool BKE_gpencil_convert_mesh(Main *bmain,
gpl_stroke = BKE_gpencil_layer_addnew(gpd, element_name, true, false);
}
bGPDframe *gpf_stroke = BKE_gpencil_layer_frame_get(
- gpl_stroke, CFRA + frame_offset, GP_GETFRAME_ADD_NEW);
+ gpl_stroke, scene->r.cfra + frame_offset, GP_GETFRAME_ADD_NEW);
gpencil_generate_edgeloops(ob_eval,
gpd,
diff --git a/source/blender/blenkernel/intern/image.cc b/source/blender/blenkernel/intern/image.cc
index afde8893b93..0c4dc3c87f3 100644
--- a/source/blender/blenkernel/intern/image.cc
+++ b/source/blender/blenkernel/intern/image.cc
@@ -1582,7 +1582,7 @@ static void stampdata(
}
if (use_dynamic && scene->r.stamp & R_STAMP_MARKER) {
- const char *name = BKE_scene_find_last_marker_name(scene, CFRA);
+ const char *name = BKE_scene_find_last_marker_name(scene, scene->r.cfra);
if (name) {
STRNCPY(text, name);
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 21217a7f9bf..5d8025dce8a 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -2920,7 +2920,7 @@ int BKE_ptcache_id_reset(Scene *scene, PTCacheID *pid, int mode)
BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_ALL, 0);
}
else if (after) {
- BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, CFRA);
+ BKE_ptcache_id_clear(pid, PTCACHE_CLEAR_AFTER, scene->r.cfra);
}
return (reset || clear || after);
@@ -3162,8 +3162,8 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
PTCacheID *pid = &baker->pid;
PointCache *cache = NULL;
float frameleno = scene->r.framelen;
- int cfrao = CFRA;
- int startframe = MAXFRAME, endframe = baker->anim_init ? scene->r.sfra : CFRA;
+ int cfrao = scene->r.cfra;
+ int startframe = MAXFRAME, endframe = baker->anim_init ? scene->r.sfra : scene->r.cfra;
int bake = baker->bake;
int render = baker->render;
@@ -3270,7 +3270,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
}
}
- CFRA = startframe;
+ scene->r.cfra = startframe;
scene->r.framelen = 1.0;
/* bake */
@@ -3282,21 +3282,21 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
stime = ptime = PIL_check_seconds_timer();
- for (int fr = CFRA; fr <= endframe; fr += baker->quick_step, CFRA = fr) {
+ for (int fr = scene->r.cfra; fr <= endframe; fr += baker->quick_step, scene->r.cfra = fr) {
BKE_scene_graph_update_for_newframe(depsgraph);
if (baker->update_progress) {
- float progress = ((float)(CFRA - startframe) / (float)(endframe - startframe));
+ float progress = ((float)(scene->r.cfra - startframe) / (float)(endframe - startframe));
baker->update_progress(baker->bake_job, progress, &cancel);
}
if (G.background) {
- printf("bake: frame %d :: %d\n", CFRA, endframe);
+ printf("bake: frame %d :: %d\n", scene->r.cfra, endframe);
}
else {
ctime = PIL_check_seconds_timer();
- fetd = (ctime - ptime) * (endframe - CFRA) / baker->quick_step;
+ fetd = (ctime - ptime) * (endframe - scene->r.cfra) / baker->quick_step;
if (use_timer || fetd > 60.0) {
use_timer = true;
@@ -3307,7 +3307,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
printf("Baked for %s, current frame: %i/%i (%.3fs), ETC: %s\r",
run,
- CFRA - startframe + 1,
+ scene->r.cfra - startframe + 1,
endframe - startframe + 1,
ctime - ptime,
etd);
@@ -3321,7 +3321,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
break;
}
- CFRA += 1;
+ scene->r.cfra += 1;
}
if (use_timer) {
@@ -3330,7 +3330,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
printf("\nBake %s %s (%i frames simulated).\n",
(cancel ? "canceled after" : "finished in"),
run,
- CFRA - startframe);
+ scene->r.cfra - startframe);
}
/* clear baking flag */
@@ -3379,7 +3379,7 @@ void BKE_ptcache_bake(PTCacheBaker *baker)
}
scene->r.framelen = frameleno;
- CFRA = cfrao;
+ scene->r.cfra = cfrao;
if (bake) { /* already on cfra unless baking */
BKE_scene_graph_update_for_newframe(depsgraph);
diff --git a/source/blender/blenkernel/intern/sound.c b/source/blender/blenkernel/intern/sound.c
index 343a829cf76..f459b5a82ac 100644
--- a/source/blender/blenkernel/intern/sound.c
+++ b/source/blender/blenkernel/intern/sound.c
@@ -804,7 +804,7 @@ void BKE_sound_set_scene_volume(Scene *scene, float volume)
}
AUD_Sequence_setAnimationData(scene->sound_scene,
AUD_AP_VOLUME,
- CFRA,
+ scene->r.cfra,
&volume,
(scene->audio.flag & AUDIO_VOLUME_ANIMATED) != 0);
}
@@ -855,7 +855,7 @@ static double get_cur_time(Scene *scene)
/* We divide by the current framelen to take into account time remapping.
* Otherwise we will get the wrong starting time which will break A/V sync.
* See T74111 for further details. */
- return FRA2TIME((CFRA + SUBFRA) / (double)scene->r.framelen);
+ return FRA2TIME((scene->r.cfra + scene->r.subframe) / (double)scene->r.framelen);
}
void BKE_sound_play_scene(Scene *scene)
@@ -911,7 +911,7 @@ void BKE_sound_seek_scene(Main *bmain, Scene *scene)
int animation_playing;
const double one_frame = 1.0 / FPS;
- const double cur_time = FRA2TIME(CFRA);
+ const double cur_time = FRA2TIME(scene->r.cfra);
AUD_Device_lock(sound_device);
@@ -1131,13 +1131,13 @@ static void sound_update_base(Scene *scene, Object *object, void *new_set)
mat4_to_quat(quat, object->obmat);
AUD_SequenceEntry_setAnimationData(
- strip->speaker_handle, AUD_AP_LOCATION, CFRA, object->obmat[3], 1);
+ strip->speaker_handle, AUD_AP_LOCATION, scene->r.cfra, object->obmat[3], 1);
AUD_SequenceEntry_setAnimationData(
- strip->speaker_handle, AUD_AP_ORIENTATION, CFRA, quat, 1);
+ strip->speaker_handle, AUD_AP_ORIENTATION, scene->r.cfra, quat, 1);
AUD_SequenceEntry_setAnimationData(
- strip->speaker_handle, AUD_AP_VOLUME, CFRA, &speaker->volume, 1);
+ strip->speaker_handle, AUD_AP_VOLUME, scene->r.cfra, &speaker->volume, 1);
AUD_SequenceEntry_setAnimationData(
- strip->speaker_handle, AUD_AP_PITCH, CFRA, &speaker->pitch, 1);
+ strip->speaker_handle, AUD_AP_PITCH, scene->r.cfra, &speaker->pitch, 1);
AUD_SequenceEntry_setSound(strip->speaker_handle, speaker->sound->playback_handle);
AUD_SequenceEntry_setMuted(strip->speaker_handle, mute);
}
@@ -1172,8 +1172,8 @@ void BKE_sound_update_scene(Depsgraph *depsgraph, Scene *scene)
if (scene->camera) {
mat4_to_quat(quat, scene->camera->obmat);
AUD_Sequence_setAnimationData(
- scene->sound_scene, AUD_AP_LOCATION, CFRA, scene->camera->obmat[3], 1);
- AUD_Sequence_setAnimationData(scene->sound_scene, AUD_AP_ORIENTATION, CFRA, quat, 1);
+ scene->sound_scene, AUD_AP_LOCATION, scene->r.cfra, scene->camera->obmat[3], 1);
+ AUD_Sequence_setAnimationData(scene->sound_scene, AUD_AP_ORIENTATION, scene->r.cfra, quat, 1);
}
AUD_destroySet(scene->speaker_handles);