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.
This commit is contained in:
Sergey Sharybin
2019-06-17 11:04:17 +02:00
parent 5364e62b05
commit 7b8d4904d2
8 changed files with 26 additions and 20 deletions

View File

@@ -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);

View File

@@ -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. */

View File

@@ -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);

View File

@@ -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);
}
}

View File

@@ -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);

View File

@@ -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);
}
}

View File

@@ -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. */

View File

@@ -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)