[Bf-blender-cvs] [4ad498def72] uuid-undo-experiments-swap-reread-datablocks: unudo-experiments: Cleanup: teak depsgraph update after undo step.

Bastien Montagne noreply at git.blender.org
Tue Mar 10 17:35:02 CET 2020


Commit: 4ad498def7275f1ef22263d5eb24fcc7837f6aa2
Author: Bastien Montagne
Date:   Tue Mar 10 15:00:23 2020 +0100
Branches: uuid-undo-experiments-swap-reread-datablocks
https://developer.blender.org/rB4ad498def7275f1ef22263d5eb24fcc7837f6aa2

unudo-experiments: Cleanup: teak depsgraph update after undo step.

===================================================================

M	source/blender/blenkernel/intern/scene.c
M	source/blender/depsgraph/DEG_depsgraph.h
M	source/blender/depsgraph/intern/depsgraph.cc

===================================================================

diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index a33b73a2ec5..c11c58791bb 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -2184,7 +2184,9 @@ void BKE_scene_undo_depsgraphs_restore(Main *bmain, GHash *depsgraph_extract)
       /* We steal the depsgraph back from our 'extract' storage to the scene. */
       Depsgraph *depsgraph = *depsgraph_extract_ptr;
 
-      DEG_graph_update_bmain_pointers(depsgraph, bmain, scene, view_layer);
+      DEG_graph_replace_owners(depsgraph, bmain, scene, view_layer);
+
+      DEG_graph_tag_relations_update(depsgraph);
 
       *depsgraph_scene_ptr = depsgraph;
       *depsgraph_extract_ptr = NULL;
diff --git a/source/blender/depsgraph/DEG_depsgraph.h b/source/blender/depsgraph/DEG_depsgraph.h
index 96a3e602792..c94a8876ab0 100644
--- a/source/blender/depsgraph/DEG_depsgraph.h
+++ b/source/blender/depsgraph/DEG_depsgraph.h
@@ -92,10 +92,10 @@ Depsgraph *DEG_graph_new(struct Main *bmain,
                          struct ViewLayer *view_layer,
                          eEvaluationMode mode);
 
-void DEG_graph_update_bmain_pointers(struct Depsgraph *depsgraph,
-                                     struct Main *bmain,
-                                     struct Scene *scene,
-                                     struct ViewLayer *view_layer);
+void DEG_graph_replace_owners(struct Depsgraph *depsgraph,
+                              struct Main *bmain,
+                              struct Scene *scene,
+                              struct ViewLayer *view_layer);
 
 /* Free Depsgraph itself and all its data */
 void DEG_graph_free(Depsgraph *graph);
diff --git a/source/blender/depsgraph/intern/depsgraph.cc b/source/blender/depsgraph/intern/depsgraph.cc
index 96aa034130b..a19a2958f28 100644
--- a/source/blender/depsgraph/intern/depsgraph.cc
+++ b/source/blender/depsgraph/intern/depsgraph.cc
@@ -285,10 +285,12 @@ Depsgraph *DEG_graph_new(Main *bmain, Scene *scene, ViewLayer *view_layer, eEval
   return reinterpret_cast<Depsgraph *>(deg_depsgraph);
 }
 
-void DEG_graph_update_bmain_pointers(struct Depsgraph *depsgraph,
-                                     Main *bmain,
-                                     Scene *scene,
-                                     ViewLayer *view_layer)
+/* 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);
 
@@ -304,8 +306,6 @@ void DEG_graph_update_bmain_pointers(struct Depsgraph *depsgraph,
   if (do_update_register) {
     DEG::register_graph(deg_graph);
   }
-
-  DEG_graph_tag_relations_update(depsgraph);
 }
 
 /* Free graph's contents and graph itself */



More information about the Bf-blender-cvs mailing list