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:
authorCampbell Barton <ideasman42@gmail.com>2019-02-05 06:24:11 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-02-06 03:52:04 +0300
commite535ff44ffd686def7aafec401acec657f5a614c (patch)
tree39910c4513dd223378f71af51730fae3a62ac3ae /source/blender/blenkernel/BKE_undo_system.h
parent8996e26116f063ce28a9784899fc36d87f31dabe (diff)
Undo System: remove accumulate/store modes
This complicated handling of undo steps in a generic way especially switching between undo systems that stored data to ones that accumulated changes. Now each undo system must treat it's steps as check-point, internally it can apply/rewind changes. This commit also fixes projection paint where the object mode wasn't following the undo steps.
Diffstat (limited to 'source/blender/blenkernel/BKE_undo_system.h')
-rw-r--r--source/blender/blenkernel/BKE_undo_system.h21
1 files changed, 5 insertions, 16 deletions
diff --git a/source/blender/blenkernel/BKE_undo_system.h b/source/blender/blenkernel/BKE_undo_system.h
index 2b1c67f372b..15f4bac17a9 100644
--- a/source/blender/blenkernel/BKE_undo_system.h
+++ b/source/blender/blenkernel/BKE_undo_system.h
@@ -72,24 +72,11 @@ typedef struct UndoStep {
bool skip;
/** Some situations require the global state to be stored, edge cases when exiting modes. */
bool use_memfile_step;
+ /** For use by undo systems that accumulate changes (text editor, painting). */
+ bool is_applied;
/* Over alloc 'type->struct_size'. */
} UndoStep;
-typedef enum eUndoTypeMode {
- /**
- * Each undo step stores a version of the state.
- * This means we can simply load in a previous state at any time.
- */
- BKE_UNDOTYPE_MODE_STORE = 1,
- /**
- * Each undo step is a series of edits.
- * This means to change states we need to apply each edit.
- * It also means the 'step_decode' callback needs to detect the difference between undo and redo.
- * (Currently used for text edit and image & sculpt painting).
- */
- BKE_UNDOTYPE_MODE_ACCUMULATE = 2,
-} eUndoTypeMode;
-
typedef void (*UndoTypeForEachIDRefFn)(void *user_data, struct UndoRefID *id_ref);
typedef struct UndoType {
@@ -122,7 +109,6 @@ typedef struct UndoType {
void (*step_foreach_ID_ref)(UndoStep *us, UndoTypeForEachIDRefFn foreach_ID_ref_fn, void *user_data);
- eUndoTypeMode mode;
bool use_context;
int step_size;
@@ -136,6 +122,9 @@ extern const UndoType *BKE_UNDOSYS_TYPE_PARTICLE;
extern const UndoType *BKE_UNDOSYS_TYPE_SCULPT;
extern const UndoType *BKE_UNDOSYS_TYPE_TEXT;
+#define BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP(ty) \
+ ELEM(ty, BKE_UNDOSYS_TYPE_IMAGE)
+
UndoStack *BKE_undosys_stack_create(void);
void BKE_undosys_stack_destroy(UndoStack *ustack);
void BKE_undosys_stack_clear(UndoStack *ustack);