[Bf-blender-cvs] [1544b9322c4] master: Undo System: add is_final argument (no functional changes)

Campbell Barton noreply at git.blender.org
Thu Jul 11 01:47:15 CEST 2019


Commit: 1544b9322c4f8728277a7a24b028bab95f22f7d6
Author: Campbell Barton
Date:   Thu Jul 11 09:36:59 2019 +1000
Branches: master
https://developer.blender.org/rB1544b9322c4f8728277a7a24b028bab95f22f7d6

Undo System: add is_final argument (no functional changes)

This is needed step out of undo steps which accumulate changes,
larger changes could be made to handle this but better not
make them at this point.

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

M	source/blender/blenkernel/BKE_undo_system.h
M	source/blender/blenkernel/intern/undo_system.c
M	source/blender/editors/armature/editarmature_undo.c
M	source/blender/editors/curve/editcurve_undo.c
M	source/blender/editors/curve/editfont_undo.c
M	source/blender/editors/lattice/editlattice_undo.c
M	source/blender/editors/mesh/editmesh_undo.c
M	source/blender/editors/metaball/editmball_undo.c
M	source/blender/editors/physics/particle_edit_undo.c
M	source/blender/editors/sculpt_paint/paint_curve_undo.c
M	source/blender/editors/sculpt_paint/paint_image_undo.c
M	source/blender/editors/sculpt_paint/sculpt_undo.c
M	source/blender/editors/space_text/text_undo.c
M	source/blender/editors/undo/memfile_undo.c

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

diff --git a/source/blender/blenkernel/BKE_undo_system.h b/source/blender/blenkernel/BKE_undo_system.h
index b5e153fca95..50c29c456d1 100644
--- a/source/blender/blenkernel/BKE_undo_system.h
+++ b/source/blender/blenkernel/BKE_undo_system.h
@@ -106,7 +106,8 @@ typedef struct UndoType {
   void (*step_encode_init)(struct bContext *C, UndoStep *us);
 
   bool (*step_encode)(struct bContext *C, struct Main *bmain, UndoStep *us);
-  void (*step_decode)(struct bContext *C, struct Main *bmain, UndoStep *us, int dir);
+  void (*step_decode)(
+      struct bContext *C, struct Main *bmain, UndoStep *us, int dir, bool is_final);
 
   /**
    * \note When freeing all steps,
diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index 7197a1734c3..d312dc0190b 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -173,7 +173,8 @@ static bool undosys_step_encode(bContext *C, Main *bmain, UndoStack *ustack, Und
   return ok;
 }
 
-static void undosys_step_decode(bContext *C, Main *bmain, UndoStack *ustack, UndoStep *us, int dir)
+static void undosys_step_decode(
+    bContext *C, Main *bmain, UndoStack *ustack, UndoStep *us, int dir, bool is_final)
 {
   CLOG_INFO(&LOG, 2, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name);
 
@@ -188,7 +189,7 @@ static void undosys_step_decode(bContext *C, Main *bmain, UndoStack *ustack, Und
           else {
             /* 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);
+            undosys_step_decode(C, bmain, ustack, us_iter, dir, false);
             /* May have been freed on memfile read. */
             bmain = G.main;
           }
@@ -203,7 +204,7 @@ static void undosys_step_decode(bContext *C, Main *bmain, UndoStack *ustack, Und
   }
 
   UNDO_NESTED_CHECK_BEGIN;
-  us->type->step_decode(C, bmain, us, dir);
+  us->type->step_decode(C, bmain, us, dir, is_final);
   UNDO_NESTED_CHECK_END;
 
 #ifdef WITH_GLOBAL_UNDO_CORRECT_ORDER
@@ -678,7 +679,8 @@ bool BKE_undosys_step_undo_with_data_ex(UndoStack *ustack,
          * - skip successive steps that store the same data, eg: memfile steps.
          * - or steps that include another steps data, eg: a memfile step includes text undo data.
          */
-        undosys_step_decode(C, G_MAIN, ustack, us_iter, -1);
+        undosys_step_decode(C, G_MAIN, ustack, us_iter, -1, false);
+
         us_iter = us_iter->prev;
       }
     }
@@ -702,7 +704,7 @@ bool BKE_undosys_step_undo_with_data_ex(UndoStack *ustack,
                     us_iter->name,
                     us_iter->type->name);
         }
-        undosys_step_decode(C, G_MAIN, ustack, us_iter, -1);
+        undosys_step_decode(C, G_MAIN, ustack, us_iter, -1, is_final);
         ustack->step_active = us_iter;
       } while ((us_active != us_iter) && (us_iter = us_iter->prev));
     }
@@ -745,7 +747,7 @@ bool BKE_undosys_step_redo_with_data_ex(UndoStack *ustack,
     if (ustack->step_active && ustack->step_active->next) {
       UndoStep *us_iter = ustack->step_active->next;
       while (us_iter != us) {
-        undosys_step_decode(C, G_MAIN, ustack, us_iter, 1);
+        undosys_step_decode(C, G_MAIN, ustack, us_iter, 1, false);
         us_iter = us_iter->next;
       }
     }
@@ -769,7 +771,7 @@ bool BKE_undosys_step_redo_with_data_ex(UndoStack *ustack,
                     us_iter->name,
                     us_iter->type->name);
         }
-        undosys_step_decode(C, G_MAIN, ustack, us_iter, 1);
+        undosys_step_decode(C, G_MAIN, ustack, us_iter, 1, is_final);
         ustack->step_active = us_iter;
       } while ((us_active != us_iter) && (us_iter = us_iter->next));
     }
diff --git a/source/blender/editors/armature/editarmature_undo.c b/source/blender/editors/armature/editarmature_undo.c
index 3a2440af2da..4a82a8fccee 100644
--- a/source/blender/editors/armature/editarmature_undo.c
+++ b/source/blender/editors/armature/editarmature_undo.c
@@ -174,7 +174,8 @@ static bool armature_undosys_step_encode(struct bContext *C,
 static void armature_undosys_step_decode(struct bContext *C,
                                          struct Main *UNUSED(bmain),
                                          UndoStep *us_p,
-                                         int UNUSED(dir))
+                                         int UNUSED(dir),
+                                         bool UNUSED(is_final))
 {
   ArmatureUndoStep *us = (ArmatureUndoStep *)us_p;
 
diff --git a/source/blender/editors/curve/editcurve_undo.c b/source/blender/editors/curve/editcurve_undo.c
index d0c2afcb1d2..835abd1a630 100644
--- a/source/blender/editors/curve/editcurve_undo.c
+++ b/source/blender/editors/curve/editcurve_undo.c
@@ -238,10 +238,8 @@ static bool curve_undosys_step_encode(struct bContext *C,
   return true;
 }
 
-static void curve_undosys_step_decode(struct bContext *C,
-                                      struct Main *bmain,
-                                      UndoStep *us_p,
-                                      int UNUSED(dir))
+static void curve_undosys_step_decode(
+    struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir), bool UNUSED(is_final))
 {
   CurveUndoStep *us = (CurveUndoStep *)us_p;
 
diff --git a/source/blender/editors/curve/editfont_undo.c b/source/blender/editors/curve/editfont_undo.c
index 82c19db7a4a..8f8c23a7772 100644
--- a/source/blender/editors/curve/editfont_undo.c
+++ b/source/blender/editors/curve/editfont_undo.c
@@ -356,7 +356,8 @@ static bool font_undosys_step_encode(struct bContext *C,
 static void font_undosys_step_decode(struct bContext *C,
                                      struct Main *UNUSED(bmain),
                                      UndoStep *us_p,
-                                     int UNUSED(dir))
+                                     int UNUSED(dir),
+                                     bool UNUSED(is_final))
 {
   /* TODO(campbell): undo_system: use low-level API to set mode. */
   ED_object_mode_set(C, OB_MODE_EDIT);
diff --git a/source/blender/editors/lattice/editlattice_undo.c b/source/blender/editors/lattice/editlattice_undo.c
index 166201adc15..5164970198e 100644
--- a/source/blender/editors/lattice/editlattice_undo.c
+++ b/source/blender/editors/lattice/editlattice_undo.c
@@ -176,7 +176,8 @@ static bool lattice_undosys_step_encode(struct bContext *C,
 static void lattice_undosys_step_decode(struct bContext *C,
                                         struct Main *UNUSED(bmain),
                                         UndoStep *us_p,
-                                        int UNUSED(dir))
+                                        int UNUSED(dir),
+                                        bool UNUSED(is_final))
 {
   LatticeUndoStep *us = (LatticeUndoStep *)us_p;
 
diff --git a/source/blender/editors/mesh/editmesh_undo.c b/source/blender/editors/mesh/editmesh_undo.c
index 28b14b0060d..e823fb46140 100644
--- a/source/blender/editors/mesh/editmesh_undo.c
+++ b/source/blender/editors/mesh/editmesh_undo.c
@@ -741,7 +741,8 @@ static bool mesh_undosys_step_encode(struct bContext *C,
 static void mesh_undosys_step_decode(struct bContext *C,
                                      struct Main *UNUSED(bmain),
                                      UndoStep *us_p,
-                                     int UNUSED(dir))
+                                     int UNUSED(dir),
+                                     bool UNUSED(is_final))
 {
   MeshUndoStep *us = (MeshUndoStep *)us_p;
 
diff --git a/source/blender/editors/metaball/editmball_undo.c b/source/blender/editors/metaball/editmball_undo.c
index d255fac26ad..9a95560ccdd 100644
--- a/source/blender/editors/metaball/editmball_undo.c
+++ b/source/blender/editors/metaball/editmball_undo.c
@@ -185,7 +185,8 @@ static bool mball_undosys_step_encode(struct bContext *C,
 static void mball_undosys_step_decode(struct bContext *C,
                                       struct Main *UNUSED(bmain),
                                       UndoStep *us_p,
-                                      int UNUSED(dir))
+                                      int UNUSED(dir),
+                                      bool UNUSED(is_final))
 {
   MBallUndoStep *us = (MBallUndoStep *)us_p;
 
diff --git a/source/blender/editors/physics/particle_edit_undo.c b/source/blender/editors/physics/particle_edit_undo.c
index be625eb939f..40d90676487 100644
--- a/source/blender/editors/physics/particle_edit_undo.c
+++ b/source/blender/editors/physics/particle_edit_undo.c
@@ -252,7 +252,8 @@ static bool particle_undosys_step_encode(struct bContext *C,
 static void particle_undosys_step_decode(struct bContext *C,
                                          struct Main *UNUSED(bmain),
                                          UndoStep *us_p,
-                                         int UNUSED(dir))
+                                         int UNUSED(dir),
+                                         bool UNUSED(is_final))
 {
   /* TODO(campbell): undo_system: use low-level API to set mode. */
   ED_object_mode_set(C, OB_MODE_PARTICLE_EDIT);
diff --git a/source/blender/editors/sculpt_paint/paint_curve_undo.c b/source/blender/editors/sculpt_paint/paint_curve_undo.c
index c03cb69df88..7e283274383 100644
--- a/source/blender/editors/sculpt_paint/paint_curve_undo.c
+++ b/source/blender/editors/sculpt_paint/paint_curve_undo.c
@@ -122,7 +122,8 @@ static bool paintcurve_undosys_step_encode(struct bContext *C,
 static void paintcurve_undosys_step_decode(struct bContext *UNUSED(C),
                                            struct Main *UNUSED(bmain),
                                            UndoStep *us_p,
-                                           int UNUSED(dir))
+                                           int UNUSED(dir),
+                                           bool UNUSED(is_final))
 {
   PaintCurveUndoStep *us = (PaintCurveUndoStep *)us_p;
   undocurve_to_paintcurve(&us->data, us->pc);
diff --git a/source/blender/editors/sculpt_paint/paint_image_undo.c b/source/blender/editors/sc

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list