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:
authorBrecht Van Lommel <brecht@blender.org>2021-07-12 18:07:35 +0300
committerBrecht Van Lommel <brecht@blender.org>2021-07-12 18:41:26 +0300
commita072e87e04ee583f899db4bd174e1804c97b3c9d (patch)
tree5f72600e66a908f65d8e26c85292800899327a4c
parent2ea565b0ec94136d01fb3ff5bdc31cecfe1c2440 (diff)
Fix T89040: dependency graph not handling time remapping correctly
In this bug report it resulted in rendering animations stopping too early, but this affected more areas. After the previous cleanup commit, it becomes clear that frame and ctime values were mixed up.
-rw-r--r--source/blender/blenkernel/intern/scene.c4
-rw-r--r--source/blender/depsgraph/DEG_depsgraph.h2
-rw-r--r--source/blender/depsgraph/intern/depsgraph.cc1
-rw-r--r--source/blender/depsgraph/intern/depsgraph.h4
-rw-r--r--source/blender/depsgraph/intern/depsgraph_eval.cc13
-rw-r--r--source/blender/render/intern/engine.c2
-rw-r--r--source/blender/render/intern/pipeline.c2
7 files changed, 18 insertions, 10 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index e47720f9bcd..cc5a8536a5a 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -2739,8 +2739,8 @@ void BKE_scene_graph_update_for_newframe_ex(Depsgraph *depsgraph, const bool cle
* edits from callback are properly taken into account. Doing a time update on those would
* lose any possible unkeyed changes made by the handler. */
if (pass == 0) {
- const float ctime = BKE_scene_ctime_get(scene);
- DEG_evaluate_on_framechange(depsgraph, ctime);
+ const float frame = BKE_scene_frame_get(scene);
+ DEG_evaluate_on_framechange(depsgraph, frame);
}
else {
DEG_evaluate_on_refresh(depsgraph);
diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h
index 27441c9a7ae..749b1bba871 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -159,7 +159,7 @@ void DEG_ids_restore_recalc(Depsgraph *depsgraph);
/* Graph Evaluation ----------------------------- */
/* Frame changed recalculation entry point. */
-void DEG_evaluate_on_framechange(Depsgraph *graph, float ctime);
+void DEG_evaluate_on_framechange(Depsgraph *graph, float frame);
/* Data changed recalculation entry point. */
void DEG_evaluate_on_refresh(Depsgraph *graph);
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index a2cdee35cbe..076e15a3175 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -68,6 +68,7 @@ Depsgraph::Depsgraph(Main *bmain, Scene *scene, ViewLayer *view_layer, eEvaluati
scene(scene),
view_layer(view_layer),
mode(mode),
+ frame(BKE_scene_frame_get(scene)),
ctime(BKE_scene_ctime_get(scene)),
scene_cow(nullptr),
is_active(false),
diff --git a/source/blender/depsgraph/intern/depsgraph.h b/source/blender/depsgraph/intern/depsgraph.h
index ff536c19c05..913b61ca563 100644
--- a/source/blender/depsgraph/intern/depsgraph.h
+++ b/source/blender/depsgraph/intern/depsgraph.h
@@ -140,7 +140,9 @@ struct Depsgraph {
ViewLayer *view_layer;
eEvaluationMode mode;
- /* Time at which dependency graph is being or was last evaluated. */
+ /* Time at which dependency graph is being or was last evaluated.
+ * frame is the value before, and ctime the value after time remapping. */
+ float frame;
float ctime;
/* Evaluated version of datablocks we access a lot.
diff --git a/source/blender/depsgraph/intern/depsgraph_eval.cc b/source/blender/depsgraph/intern/depsgraph_eval.cc
index de2d6d976c6..cc7ce871419 100644
--- a/source/blender/depsgraph/intern/depsgraph_eval.cc
+++ b/source/blender/depsgraph/intern/depsgraph_eval.cc
@@ -51,7 +51,7 @@ static void deg_flush_updates_and_refresh(deg::Depsgraph *deg_graph)
{
/* Update the time on the cow scene. */
if (deg_graph->scene_cow) {
- BKE_scene_frame_set(deg_graph->scene_cow, deg_graph->ctime);
+ BKE_scene_frame_set(deg_graph->scene_cow, deg_graph->frame);
}
deg::deg_graph_flush_updates(deg_graph);
@@ -63,10 +63,12 @@ void DEG_evaluate_on_refresh(Depsgraph *graph)
{
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph);
const Scene *scene = DEG_get_input_scene(graph);
+ const float frame = BKE_scene_frame_get(scene);
const float ctime = BKE_scene_ctime_get(scene);
- if (ctime != deg_graph->ctime) {
+ if (deg_graph->frame != frame || ctime != deg_graph->ctime) {
deg_graph->tag_time_source();
+ deg_graph->frame = frame;
deg_graph->ctime = ctime;
}
@@ -74,10 +76,13 @@ void DEG_evaluate_on_refresh(Depsgraph *graph)
}
/* Frame-change happened for root scene that graph belongs to. */
-void DEG_evaluate_on_framechange(Depsgraph *graph, float ctime)
+void DEG_evaluate_on_framechange(Depsgraph *graph, float frame)
{
deg::Depsgraph *deg_graph = reinterpret_cast<deg::Depsgraph *>(graph);
+ const Scene *scene = DEG_get_input_scene(graph);
+
deg_graph->tag_time_source();
- deg_graph->ctime = ctime;
+ deg_graph->frame = frame;
+ deg_graph->ctime = BKE_scene_frame_to_ctime(scene, frame);
deg_flush_updates_and_refresh(deg_graph);
}
diff --git a/source/blender/render/intern/engine.c b/source/blender/render/intern/engine.c
index 86ed88d37ab..657cd1f606b 100644
--- a/source/blender/render/intern/engine.c
+++ b/source/blender/render/intern/engine.c
@@ -679,7 +679,7 @@ static void engine_depsgraph_init(RenderEngine *engine, ViewLayer *view_layer)
DRW_render_context_enable(engine->re);
}
- DEG_evaluate_on_framechange(depsgraph, CFRA);
+ DEG_evaluate_on_framechange(depsgraph, BKE_scene_frame_get(scene));
if (use_gpu_context) {
DRW_render_context_disable(engine->re);
diff --git a/source/blender/render/intern/pipeline.c b/source/blender/render/intern/pipeline.c
index eb2b58a46cb..6329901b4ce 100644
--- a/source/blender/render/intern/pipeline.c
+++ b/source/blender/render/intern/pipeline.c
@@ -1828,7 +1828,7 @@ void RE_SetReports(Render *re, ReportList *reports)
static void render_update_depsgraph(Render *re)
{
Scene *scene = re->scene;
- DEG_evaluate_on_framechange(re->pipeline_depsgraph, CFRA);
+ DEG_evaluate_on_framechange(re->pipeline_depsgraph, BKE_scene_frame_get(scene));
BKE_scene_update_sound(re->pipeline_depsgraph, re->main);
}