Undo System: add is_final argument (no functional changes)
authorCampbell Barton <ideasman42@gmail.com>
Wed, 10 Jul 2019 23:36:59 +0000 (09:36 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 10 Jul 2019 23:36:59 +0000 (09:36 +1000)
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.

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

index b5e153fca95c2991ad8287e7a56c957d629491e3..50c29c456d1906fc5e67bd8e5f6921ecfb9d0d10 100644 (file)
@@ -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,
index 7197a1734c337d693a0018b3f1e523a2882149b3..d312dc0190b41019fde1ea4900d3553221832739 100644 (file)
@@ -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));
     }
index 3a2440af2da27e49032ca7e671854112d3465456..4a82a8fccee7191cc27add170492f7791097d31c 100644 (file)
@@ -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;
 
index d0c2afcb1d20e41d9fb8e58a2cd331cc4b862a7a..835abd1a6306a8dea07d4deec7a17007a07a81e5 100644 (file)
@@ -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;
 
index 82c19db7a4a9b9ce87f2afe00ed5e99433fd4447..8f8c23a777223da4ca82e04424ac70b76fa9e9ba 100644 (file)
@@ -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);
index 166201adc15911d14a5c413baccad805c9226cb3..5164970198ef26c8293d6b94cee84a929a1d84ce 100644 (file)
@@ -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;
 
index 28b14b0060d286d0214ad3570f6fcc70e7a9048d..e823fb46140e53f09f1f0d09afe5e53997e2fad9 100644 (file)
@@ -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;
 
index d255fac26ad47e9b5555744fdb40c0822b56ea45..9a95560ccdda043806259b264852acdcd12f1521 100644 (file)
@@ -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;
 
index be625eb939f088c849e7d2d4f28f6091c3f9aef9..40d906764876a30eebb4cdc8978b69a9101ee17b 100644 (file)
@@ -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);
index c03cb69df88430cc817d3c1905e22c41ea42e9a3..7e283274383df9d0f180d3f54a97acd171176d03 100644 (file)
@@ -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);
index bb73d424152c5c91b5024a18c1a501f83330da85..e7f100ebacb1f0a9ab3a2929b6435c76f13a1a49 100644 (file)
@@ -540,10 +540,8 @@ static void image_undosys_step_decode_redo(ImageUndoStep *us)
   }
 }
 
-static void image_undosys_step_decode(struct bContext *C,
-                                      struct Main *bmain,
-                                      UndoStep *us_p,
-                                      int dir)
+static void image_undosys_step_decode(
+    struct bContext *C, struct Main *bmain, UndoStep *us_p, int dir, bool UNUSED(is_final))
 {
   ImageUndoStep *us = (ImageUndoStep *)us_p;
 #if 0
index a20fe375ec7dd4bc80d59d10605b3187371284ce..81bb9c35817ac087b45b9d4c5f0ee93690a46484 100644 (file)
@@ -1109,10 +1109,8 @@ static void sculpt_undosys_step_decode_redo(struct bContext *C, SculptUndoStep *
   }
 }
 
-static void sculpt_undosys_step_decode(struct bContext *C,
-                                       struct Main *bmain,
-                                       UndoStep *us_p,
-                                       int dir)
+static void sculpt_undosys_step_decode(
+    struct bContext *C, struct Main *bmain, UndoStep *us_p, int dir, bool UNUSED(is_final))
 {
   /* Ensure sculpt mode. */
   {
index 7710c5637a2d16f074d78128caa3d0a3c4054752..ae12473e600563416f094e6c2528fe3b48082110 100644 (file)
@@ -175,10 +175,8 @@ static void text_undosys_step_decode_redo(TextUndoStep *us)
   }
 }
 
-static void text_undosys_step_decode(struct bContext *C,
-                                     struct Main *UNUSED(bmain),
-                                     UndoStep *us_p,
-                                     int dir)
+static void text_undosys_step_decode(
+    struct bContext *C, struct Main *UNUSED(bmain), UndoStep *us_p, int dir, bool UNUSED(is_final))
 {
   TextUndoStep *us = (TextUndoStep *)us_p;
 
index 0f495d64b29acc8a8794b28176301b9c40f73750..f3e2ee92558a80f9723d7f8f6677b6d234a15f8e 100644 (file)
@@ -83,10 +83,8 @@ static bool memfile_undosys_step_encode(struct bContext *UNUSED(C),
   return true;
 }
 
-static void memfile_undosys_step_decode(struct bContext *C,
-                                        struct Main *bmain,
-                                        UndoStep *us_p,
-                                        int UNUSED(dir))
+static void memfile_undosys_step_decode(
+    struct bContext *C, struct Main *bmain, UndoStep *us_p, int UNUSED(dir), bool UNUSED(is_final))
 {
   ED_editors_exit(bmain, false);