From 651b8fb14eb6ee5cbfa98bffe80a966a0753b14e Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 19 Mar 2018 14:17:59 +0100 Subject: Undo: unified undo system w/ linear history - Use a single undo history for all operations. - UndoType's are registered and poll the context to check if they should be used when performing an undo push. - Mode switching is used to ensure the state is correct before undo data is restored. - Some undo types accumulate changes (image & text editing) others store the state multiple times (with de-duplication). This is supported by checking UndoStack.mode `ACCUMULATE` / `STORE`. - Each undo step stores ID datablocks they use with utilities to help manage restoring correct ID's. Needed since global undo is now mixed with other modes undo. - Currently performs each undo step when going up/down history Previously this wasn't done, making history fail in some cases. This can be optimized to skip some combinations of undo steps. grease-pencil is an exception which has not been updated since it integrates undo into the draw-session. See D3113 --- source/blender/blenkernel/BKE_blender_undo.h | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'source/blender/blenkernel/BKE_blender_undo.h') diff --git a/source/blender/blenkernel/BKE_blender_undo.h b/source/blender/blenkernel/BKE_blender_undo.h index 84a6d07be7d..a96f8af1fdb 100644 --- a/source/blender/blenkernel/BKE_blender_undo.h +++ b/source/blender/blenkernel/BKE_blender_undo.h @@ -31,22 +31,13 @@ extern "C" { struct bContext; struct Scene; struct Main; +struct MemFileUndoData; #define BKE_UNDO_STR_MAX 64 -/* global undo */ -extern void BKE_undo_write(struct bContext *C, const char *name); -extern void BKE_undo_step(struct bContext *C, int step); -extern void BKE_undo_name(struct bContext *C, const char *name); -extern bool BKE_undo_is_valid(const char *name); -extern void BKE_undo_reset(void); -extern void BKE_undo_number(struct bContext *C, int nr); -extern const char *BKE_undo_get_name(int nr, bool *r_active); -extern const char *BKE_undo_get_name_last(void); -extern bool BKE_undo_save_file(const char *filename); -extern struct Main *BKE_undo_get_main(struct Scene **r_scene); - -extern void BKE_undo_callback_wm_kill_jobs_set(void (*callback)(struct bContext *C)); +struct MemFileUndoData *BKE_memfile_undo_encode(struct Main *bmain, struct MemFileUndoData *mfu_prev); +bool BKE_memfile_undo_decode(struct MemFileUndoData *mfu, struct bContext *C); +void BKE_memfile_undo_free(struct MemFileUndoData *mfu); #ifdef __cplusplus } -- cgit v1.2.3