From 7b8d4904d21e796f90c68fca797f051c2d536894 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 17 Jun 2019 11:04:17 +0200 Subject: Fix T65817: Video Sequencer doesen't render speakers' sounds Part of the issue was caused by missing speaker objects in the depsgraph used for post-processing. Remaining part was caused by missing scene sound update for this depsgraph. --- source/blender/blenkernel/BKE_scene.h | 2 ++ source/blender/blenkernel/intern/scene.c | 6 +++--- .../depsgraph/intern/builder/deg_builder_nodes.h | 2 +- .../depsgraph/intern/builder/deg_builder_nodes_scene.cc | 7 ++++++- .../depsgraph/intern/builder/deg_builder_relations.h | 2 +- .../intern/builder/deg_builder_relations_scene.cc | 6 +++++- source/blender/depsgraph/intern/depsgraph_build.cc | 17 +++++++---------- source/blender/render/intern/source/pipeline.c | 4 +--- 8 files changed, 26 insertions(+), 20 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/BKE_scene.h b/source/blender/blenkernel/BKE_scene.h index f90429aaebe..eafb91c85e1 100644 --- a/source/blender/blenkernel/BKE_scene.h +++ b/source/blender/blenkernel/BKE_scene.h @@ -147,6 +147,8 @@ int BKE_scene_orientation_slot_get_index(const struct TransformOrientationSlot * /* ** Scene evaluation ** */ +void BKE_scene_update_sound(struct Depsgraph *depsgraph, struct Main *bmain); + void BKE_scene_graph_update_tagged(struct Depsgraph *depsgraph, struct Main *bmain); void BKE_scene_graph_evaluated_ensure(struct Depsgraph *depsgraph, struct Main *bmain); diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c index 7fb9b2f2281..6300d48c700 100644 --- a/source/blender/blenkernel/intern/scene.c +++ b/source/blender/blenkernel/intern/scene.c @@ -1506,7 +1506,7 @@ static void prepare_mesh_for_viewport_render(Main *bmain, const ViewLayer *view_ } } -static void scene_update_sound(Depsgraph *depsgraph, Main *bmain) +void BKE_scene_update_sound(Depsgraph *depsgraph, Main *bmain) { Scene *scene = DEG_get_evaluated_scene(depsgraph); const int recalc = scene->id.recalc; @@ -1566,7 +1566,7 @@ static void scene_graph_update_tagged(Depsgraph *depsgraph, Main *bmain, bool on */ DEG_evaluate_on_refresh(depsgraph); /* Update sound system. */ - scene_update_sound(depsgraph, bmain); + BKE_scene_update_sound(depsgraph, bmain); /* Notify python about depsgraph update. */ if (run_callbacks) { BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_DEPSGRAPH_UPDATE_POST); @@ -1613,7 +1613,7 @@ void BKE_scene_graph_update_for_newframe(Depsgraph *depsgraph, Main *bmain) */ DEG_evaluate_on_framechange(bmain, depsgraph, ctime); /* Update sound system animation. */ - scene_update_sound(depsgraph, bmain); + BKE_scene_update_sound(depsgraph, bmain); /* Notify editors and python about recalc. */ BLI_callback_exec(bmain, &scene->id, BLI_CB_EVT_FRAME_CHANGE_POST); /* Inform editors about possible changes. */ diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h index 095fb17f622..9983b346355 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes.h @@ -153,7 +153,7 @@ class DepsgraphNodeBuilder : public DepsgraphBuilder { void build_id(ID *id); - void build_scene_render(Scene *scene); + void build_scene_render(Scene *scene, ViewLayer *view_layer); void build_scene_parameters(Scene *scene); void build_scene_compositor(Scene *scene); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc index 6f28228f632..3486d2c92ae 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_nodes_scene.cc @@ -27,9 +27,10 @@ namespace DEG { -void DepsgraphNodeBuilder::build_scene_render(Scene *scene) +void DepsgraphNodeBuilder::build_scene_render(Scene *scene, ViewLayer *view_layer) { scene_ = scene; + view_layer_ = view_layer; const bool build_compositor = (scene->r.scemode & R_DOCOMP); const bool build_sequencer = (scene->r.scemode & R_DOSEQ); IDNode *id_node = add_id_node(&scene->id); @@ -43,6 +44,10 @@ void DepsgraphNodeBuilder::build_scene_render(Scene *scene) } if (build_sequencer) { build_scene_sequencer(scene); + build_scene_speakers(scene, view_layer); + } + if (scene->camera != NULL) { + build_object(-1, scene->camera, DEG_ID_LINKED_DIRECTLY, true); } } diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations.h b/source/blender/depsgraph/intern/builder/deg_builder_relations.h index 1a4784b5402..cfed5a73a49 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations.h +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations.h @@ -196,7 +196,7 @@ class DepsgraphRelationBuilder : public DepsgraphBuilder { void build_id(ID *id); - void build_scene_render(Scene *scene); + void build_scene_render(Scene *scene, ViewLayer *view_layer); void build_scene_parameters(Scene *scene); void build_scene_compositor(Scene *scene); diff --git a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc index 46e8b8e7acc..daaf90011c5 100644 --- a/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc +++ b/source/blender/depsgraph/intern/builder/deg_builder_relations_scene.cc @@ -27,7 +27,7 @@ namespace DEG { -void DepsgraphRelationBuilder::build_scene_render(Scene *scene) +void DepsgraphRelationBuilder::build_scene_render(Scene *scene, ViewLayer *view_layer) { scene_ = scene; const bool build_compositor = (scene->r.scemode & R_DOCOMP); @@ -40,6 +40,10 @@ void DepsgraphRelationBuilder::build_scene_render(Scene *scene) } if (build_sequencer) { build_scene_sequencer(scene); + build_scene_speakers(scene, view_layer); + } + if (scene->camera != NULL) { + build_object(NULL, scene->camera); } } diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc index d20bb000724..279c5e7839a 100644 --- a/source/blender/depsgraph/intern/depsgraph_build.cc +++ b/source/blender/depsgraph/intern/depsgraph_build.cc @@ -285,7 +285,7 @@ void DEG_graph_build_from_view_layer(Depsgraph *graph, void DEG_graph_build_for_render_pipeline(Depsgraph *graph, Main *bmain, Scene *scene, - ViewLayer * /*view_layer*/) + ViewLayer *view_layer) { double start_time = 0.0; if (G.debug & (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_TIME)) { @@ -299,13 +299,13 @@ void DEG_graph_build_for_render_pipeline(Depsgraph *graph, /* Generate all the nodes in the graph first */ DEG::DepsgraphNodeBuilder node_builder(bmain, deg_graph, &builder_cache); node_builder.begin_build(); - node_builder.build_scene_render(scene); + node_builder.build_scene_render(scene, view_layer); node_builder.end_build(); /* Hook up relationships between operations - to determine evaluation * order. */ DEG::DepsgraphRelationBuilder relation_builder(bmain, deg_graph, &builder_cache); relation_builder.begin_build(); - relation_builder.build_scene_render(scene); + relation_builder.build_scene_render(scene, view_layer); relation_builder.build_copy_on_write_relations(); /* Finalize building. */ graph_build_finalize_common(deg_graph, bmain); @@ -315,11 +315,8 @@ void DEG_graph_build_for_render_pipeline(Depsgraph *graph, } } -void DEG_graph_build_for_compositor_preview(Depsgraph *graph, - Main *bmain, - Scene *scene, - struct ViewLayer * /*view_layer*/, - bNodeTree *nodetree) +void DEG_graph_build_for_compositor_preview( + Depsgraph *graph, Main *bmain, Scene *scene, struct ViewLayer *view_layer, bNodeTree *nodetree) { double start_time = 0.0; if (G.debug & (G_DEBUG_DEPSGRAPH_BUILD | G_DEBUG_DEPSGRAPH_TIME)) { @@ -333,14 +330,14 @@ void DEG_graph_build_for_compositor_preview(Depsgraph *graph, /* Generate all the nodes in the graph first */ DEG::DepsgraphNodeBuilder node_builder(bmain, deg_graph, &builder_cache); node_builder.begin_build(); - node_builder.build_scene_render(scene); + node_builder.build_scene_render(scene, view_layer); node_builder.build_nodetree(nodetree); node_builder.end_build(); /* Hook up relationships between operations - to determine evaluation * order. */ DEG::DepsgraphRelationBuilder relation_builder(bmain, deg_graph, &builder_cache); relation_builder.begin_build(); - relation_builder.build_scene_render(scene); + relation_builder.build_scene_render(scene, view_layer); relation_builder.build_nodetree(nodetree); relation_builder.build_copy_on_write_relations(); /* Finalize building. */ diff --git a/source/blender/render/intern/source/pipeline.c b/source/blender/render/intern/source/pipeline.c index e0576d6b253..1910cec24a6 100644 --- a/source/blender/render/intern/source/pipeline.c +++ b/source/blender/render/intern/source/pipeline.c @@ -2071,10 +2071,8 @@ void RE_SetReports(Render *re, ReportList *reports) static void render_update_depsgraph(Render *re) { Scene *scene = re->scene; - /* TODO(sergey): This doesn't run any callbacks and doesn't do sound update. But we can not use - * BKE_scene_graph_update_for_newframe() because that one builds dependency graph for view layer - * and not for the render pipeline. */ DEG_evaluate_on_framechange(re->main, re->pipeline_depsgraph, CFRA); + BKE_scene_update_sound(re->pipeline_depsgraph, re->main); } static void render_init_depsgraph(Render *re) -- cgit v1.2.3