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:
Diffstat (limited to 'source/blender/depsgraph/intern/depsgraph.cc')
-rw-r--r--source/blender/depsgraph/intern/depsgraph.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index ce6797939b5..a19a2958f28 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -285,6 +285,29 @@ Depsgraph *DEG_graph_new(Main *bmain, Scene *scene, ViewLayer *view_layer, eEval
return reinterpret_cast<Depsgraph *>(deg_depsgraph);
}
+/* Replace the "owner" pointers (currently Main/Scene/ViewLayer) of this depsgraph.
+ * Used during undo steps when we do want to re-use the old depsgraph data as much as possible. */
+void DEG_graph_replace_owners(struct Depsgraph *depsgraph,
+ Main *bmain,
+ Scene *scene,
+ ViewLayer *view_layer)
+{
+ DEG::Depsgraph *deg_graph = reinterpret_cast<DEG::Depsgraph *>(depsgraph);
+
+ const bool do_update_register = deg_graph->bmain != bmain;
+ if (do_update_register && deg_graph->bmain != NULL) {
+ DEG::unregister_graph(deg_graph);
+ }
+
+ deg_graph->bmain = bmain;
+ deg_graph->scene = scene;
+ deg_graph->view_layer = view_layer;
+
+ if (do_update_register) {
+ DEG::register_graph(deg_graph);
+ }
+}
+
/* Free graph's contents and graph itself */
void DEG_graph_free(Depsgraph *graph)
{