[Bf-blender-cvs] [d2b2db756af] undo-experiments: Undo: save/restore DEG closer to the actual undostep.

Bastien Montagne noreply at git.blender.org
Fri Nov 29 10:46:14 CET 2019


Commit: d2b2db756af069064bf221b875acfd7a24cc29a1
Author: Bastien Montagne
Date:   Fri Nov 29 10:39:45 2019 +0100
Branches: undo-experiments
https://developer.blender.org/rBd2b2db756af069064bf221b875acfd7a24cc29a1

Undo: save/restore DEG closer to the actual undostep.

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

M	source/blender/blenkernel/intern/undo_system.c

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

diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index a068119b10b..eee07437aa7 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -192,11 +192,15 @@ static void undosys_step_decode(
             /* Common case, we're already using the last memfile state. */
           }
           else {
+            GHash *depsgraphs = BKE_scene_undo_depsgraphs_extract(bmain);
+
             /* Load the previous memfile state so any ID's referenced in this
              * undo step will be correctly resolved, see: T56163. */
             undosys_step_decode(C, bmain, ustack, us_iter, dir, false);
             /* May have been freed on memfile read. */
-            bmain = G.main;
+            bmain = G_MAIN;
+
+            BKE_scene_undo_depsgraphs_restore(bmain, depsgraphs);
           }
           break;
         }
@@ -675,10 +679,6 @@ bool BKE_undosys_step_undo_with_data_ex(UndoStack *ustack,
   if (us != NULL) {
     CLOG_INFO(&LOG, 1, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name);
 
-    Main *bmain = CTX_data_main(C);
-    GHash *depsgraphs = BKE_scene_undo_depsgraphs_extract(bmain);
-    bmain = NULL;
-
     /* Handle accumulate steps. */
     if (ustack->step_active) {
       UndoStep *us_iter = ustack->step_active;
@@ -717,9 +717,6 @@ bool BKE_undosys_step_undo_with_data_ex(UndoStack *ustack,
       } while ((us_active != us_iter) && (us_iter = us_iter->prev));
     }
 
-    bmain = CTX_data_main(C);
-    BKE_scene_undo_depsgraphs_restore(bmain, depsgraphs);
-
     return true;
   }
   return false;



More information about the Bf-blender-cvs mailing list