diff options
Diffstat (limited to 'source/blender/depsgraph/intern')
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_query.cc | 14 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/depsgraph_query_iter.cc | 5 | ||||
-rw-r--r-- | source/blender/depsgraph/intern/eval/deg_eval.cc | 28 |
3 files changed, 23 insertions, 24 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph_query.cc b/source/blender/depsgraph/intern/depsgraph_query.cc index 8f4bf2d082e..fea28736627 100644 --- a/source/blender/depsgraph/intern/depsgraph_query.cc +++ b/source/blender/depsgraph/intern/depsgraph_query.cc @@ -110,6 +110,7 @@ Scene *DEG_get_evaluated_scene(const Depsgraph *graph) * that calleer is OK with just a pointer in case scene is not up[dated * yet? */ + BLI_assert(DEG::deg_copy_on_write_is_expanded(&scene_cow->id)); return scene_cow; } @@ -118,19 +119,6 @@ ViewLayer *DEG_get_evaluated_view_layer(const Depsgraph *graph) const DEG::Depsgraph *deg_graph = reinterpret_cast<const DEG::Depsgraph *>(graph); Scene *scene_cow = DEG_get_evaluated_scene(graph); - /* We update copy-on-write scene in the following cases: - * - It was not expanded yet. - * - It was tagged for update of CoW component. - * This allows us to have proper view layer pointer. - */ - if (DEG_depsgraph_use_copy_on_write() && - (!DEG::deg_copy_on_write_is_expanded(&scene_cow->id) || - scene_cow->id.recalc & ID_RECALC_COPY_ON_WRITE)) - { - const DEG::IDDepsNode *id_node = - deg_graph->find_id_node(°_graph->scene->id); - DEG::deg_update_copy_on_write_datablock(deg_graph, id_node); - } /* Do name-based lookup. */ /* TODO(sergey): Can this be optimized? */ ViewLayer *view_layer_orig = deg_graph->view_layer; diff --git a/source/blender/depsgraph/intern/depsgraph_query_iter.cc b/source/blender/depsgraph/intern/depsgraph_query_iter.cc index c610e7fc500..6e8e474fca6 100644 --- a/source/blender/depsgraph/intern/depsgraph_query_iter.cc +++ b/source/blender/depsgraph/intern/depsgraph_query_iter.cc @@ -209,11 +209,6 @@ void DEG_iterator_objects_begin(BLI_Iterator *iter, DEGObjectIterData *data) return; } - /* TODO: Calling this forces the scene datablock to be expanded, - * otherwise we get crashes on load with copy-on-write. There may - * be a better solution for this. */ - DEG_get_evaluated_view_layer(depsgraph); - iter->data = data; data->dupli_parent = NULL; data->dupli_list = NULL; diff --git a/source/blender/depsgraph/intern/eval/deg_eval.cc b/source/blender/depsgraph/intern/eval/deg_eval.cc index 4dd3842070e..110f2d98f17 100644 --- a/source/blender/depsgraph/intern/eval/deg_eval.cc +++ b/source/blender/depsgraph/intern/eval/deg_eval.cc @@ -39,12 +39,14 @@ #include "BLI_ghash.h" #include "DNA_object_types.h" +#include "DNA_scene_types.h" #include "DEG_depsgraph.h" #include "DEG_depsgraph_query.h" #include "atomic_ops.h" +#include "intern/eval/deg_eval_copy_on_write.h" #include "intern/eval/deg_eval_flush.h" #include "intern/eval/deg_eval_stats.h" #include "intern/nodes/deg_node.h" @@ -219,6 +221,25 @@ static void schedule_children(TaskPool *pool, } } +static void depsgraph_ensure_view_layer(Depsgraph *graph) +{ + /* We update copy-on-write scene in the following cases: + * - It was not expanded yet. + * - It was tagged for update of CoW component. + * This allows us to have proper view layer pointer. + */ + if (!DEG_depsgraph_use_copy_on_write()) { + return; + } + Scene *scene_cow = graph->scene_cow; + if (!deg_copy_on_write_is_expanded(&scene_cow->id) || + scene_cow->id.recalc & ID_RECALC_COPY_ON_WRITE) + { + const IDDepsNode *id_node = graph->find_id_node(&graph->scene->id); + deg_update_copy_on_write_datablock(graph, id_node); + } +} + /** * Evaluate all nodes tagged for updating, * \warning This is usually done as part of main loop, but may also be @@ -234,12 +255,7 @@ void deg_evaluate_on_refresh(Depsgraph *graph) } const bool do_time_debug = ((G.debug & G_DEBUG_DEPSGRAPH_TIME) != 0); const double start_time = do_time_debug ? PIL_check_seconds_timer() : 0; - - /* TODO: Calling this forces the scene datablock to be expanded, - * otherwise we get crashes on load with copy-on-write. There may - * be a better solution for this. */ - DEG_get_evaluated_view_layer((const ::Depsgraph*)graph); - + depsgraph_ensure_view_layer(graph); /* Set up evaluation state. */ DepsgraphEvalState state; state.graph = graph; |