From 25803994986f6825842b17446f890f6f70348f06 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Mon, 3 Sep 2018 15:22:02 +0200 Subject: Fix T56593: Crash when enabling collection with curves Was missing update of ID blocks which are becoming visible. --- source/blender/depsgraph/intern/depsgraph_build.cc | 42 ++++++---------------- 1 file changed, 11 insertions(+), 31 deletions(-) (limited to 'source/blender/depsgraph/intern/depsgraph_build.cc') diff --git a/source/blender/depsgraph/intern/depsgraph_build.cc b/source/blender/depsgraph/intern/depsgraph_build.cc index fccb5808711..1425c1bc453 100644 --- a/source/blender/depsgraph/intern/depsgraph_build.cc +++ b/source/blender/depsgraph/intern/depsgraph_build.cc @@ -198,69 +198,49 @@ void DEG_graph_build_from_view_layer(Depsgraph *graph, if (G.debug & G_DEBUG_DEPSGRAPH_BUILD) { start_time = PIL_check_seconds_timer(); } - DEG::Depsgraph *deg_graph = reinterpret_cast(graph); + /* Perform sanity checks. */ BLI_assert(BLI_findindex(&scene->view_layers, view_layer) != -1); - BLI_assert(deg_graph->scene == scene); BLI_assert(deg_graph->view_layer == view_layer); - - /* TODO(sergey): This is a bit tricky, but ensures that all the data - * is evaluated properly when depsgraph is becoming "visible". - * - * This now could happen for both visible scene is changed and extra - * dependency graph was created for render engine. - */ - const bool need_on_visible_update = (deg_graph->id_nodes.size() == 0); - - /* 1) Generate all the nodes in the graph first */ + /* Generate all the nodes in the graph first */ DEG::DepsgraphNodeBuilder node_builder(bmain, deg_graph); node_builder.begin_build(); node_builder.build_view_layer(scene, view_layer, DEG::DEG_ID_LINKED_DIRECTLY); node_builder.end_build(); - - /* 2) Hook up relationships between operations - to determine evaluation - * order. + /* Hook up relationships between operations - to determine evaluation + * order. */ DEG::DepsgraphRelationBuilder relation_builder(bmain, deg_graph); relation_builder.begin_build(); relation_builder.build_view_layer(scene, view_layer); relation_builder.build_copy_on_write_relations(); - /* Detect and solve cycles. */ DEG::deg_graph_detect_cycles(deg_graph); - - /* 3) Simplify the graph by removing redundant relations (to optimize - * traversal later). */ + /* Simplify the graph by removing redundant relations (to optimize + * traversal later). */ /* TODO: it would be useful to have an option to disable this in cases where * it is causing trouble. */ if (G.debug_value == 799) { DEG::deg_graph_transitive_reduction(deg_graph); } - - /* 4) Flush visibility layer and re-schedule nodes for update. */ + /* Store pointers to commonly used valuated datablocks. */ + deg_graph->scene_cow = (Scene *)deg_graph->get_cow_id(°_graph->scene->id); + /* Flush visibility layer and re-schedule nodes for update. */ DEG::deg_graph_build_finalize(bmain, deg_graph); - + DEG_graph_on_visible_update(bmain, graph); #if 0 if (!DEG_debug_consistency_check(deg_graph)) { printf("Consistency validation failed, ABORTING!\n"); abort(); } #endif - /* Relations are up to date. */ deg_graph->need_update = false; - - /* Store pointers to commonly used valuated datablocks. */ - deg_graph->scene_cow = (Scene *)deg_graph->get_cow_id(°_graph->scene->id); - - if (need_on_visible_update) { - DEG_graph_on_visible_update(bmain, graph); - } - + /* Finish statistics. */ if (G.debug & G_DEBUG_DEPSGRAPH_BUILD) { printf("Depsgraph built in %f seconds.\n", PIL_check_seconds_timer() - start_time); -- cgit v1.2.3