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:
authorSergey Sharybin <sergey.vfx@gmail.com>2020-03-27 18:37:29 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2020-04-01 10:39:58 +0300
commit7952274cf0c4a262c274fa93c800c84c1aa2d5d7 (patch)
treec528ad6438723e46456b4752d019e09d85f63350 /source/blender/editors/sculpt_paint/sculpt_intern.h
parent60d3a801db3a848fa82bc4bece08e0d27c7b8ecf (diff)
Sculpt Undo: Refactor Geometry undo nodes
Made it so there is a single UNDO node in the list which has both original and modified mesh state. Makes it easier to achieve "interleaved" undo nodes stored in the undo step (as opposite of either storing geometry or other data). Should be no functional changes, just preparing for an upcoming work to support undo of operation like Apply Base. Differential Revision: https://developer.blender.org/D7290
Diffstat (limited to 'source/blender/editors/sculpt_paint/sculpt_intern.h')
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h37
1 files changed, 28 insertions, 9 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index fe56283dbcb..478d2be9a30 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -299,6 +299,23 @@ typedef enum {
SCULPT_UNDO_FACE_SETS,
} SculptUndoType;
+/* Storage of geometry for the undo node.
+ * Is used as a storage for either original or modified geometry. */
+typedef struct SculptUndoNodeGeometry {
+ /* Is used for sanity check, helping with ensuring that two and only two
+ * geometry pushes happenned in the undo stack. */
+ bool is_initialized;
+
+ CustomData vdata;
+ CustomData edata;
+ CustomData ldata;
+ CustomData pdata;
+ int totvert;
+ int totedge;
+ int totloop;
+ int totpoly;
+} SculptUndoNodeGeometry;
+
typedef struct SculptUndoNode {
struct SculptUndoNode *next, *prev;
@@ -332,15 +349,17 @@ typedef struct SculptUndoNode {
/* shape keys */
char shapeName[sizeof(((KeyBlock *)0))->name];
- /* geometry modification operations and bmesh enter data */
- CustomData geom_vdata;
- CustomData geom_edata;
- CustomData geom_ldata;
- CustomData geom_pdata;
- int geom_totvert;
- int geom_totedge;
- int geom_totloop;
- int geom_totpoly;
+ /* Geometry modification operations.
+ *
+ * Original geometry is stored before some modification is run and is used to restore state of
+ * the object when undoing the operation
+ *
+ * Modified geometry is stored after the modification and is used to redo the modification. */
+ SculptUndoNodeGeometry geometry_original;
+ SculptUndoNodeGeometry geometry_modified;
+
+ /* Geometry at the bmesh enter moment. */
+ SculptUndoNodeGeometry geometry_bmesh_enter;
/* pivot */
float pivot_pos[3];