From e535ff44ffd686def7aafec401acec657f5a614c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 5 Feb 2019 14:24:11 +1100 Subject: 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. --- source/blender/editors/undo/memfile_undo.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/undo') diff --git a/source/blender/editors/undo/memfile_undo.c b/source/blender/editors/undo/memfile_undo.c index 8fdbfa389a0..04a2c220f73 100644 --- a/source/blender/editors/undo/memfile_undo.c +++ b/source/blender/editors/undo/memfile_undo.c @@ -89,6 +89,19 @@ static void memfile_undosys_step_decode(struct bContext *C, struct Main *bmain, MemFileUndoStep *us = (MemFileUndoStep *)us_p; BKE_memfile_undo_decode(us->data, C); + for (UndoStep *us_iter = us_p->next; us_iter; us_iter = us_iter->next) { + if (BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP(us_iter->type)) { + continue; + } + us_iter->is_applied = false; + } + for (UndoStep *us_iter = us_p; us_iter; us_iter = us_iter->prev) { + if (BKE_UNDOSYS_TYPE_IS_MEMFILE_SKIP(us_iter->type)) { + continue; + } + us_iter->is_applied = true; + } + /* bmain has been freed. */ bmain = CTX_data_main(C); ED_editors_init_for_undo(bmain); @@ -120,7 +133,6 @@ void ED_memfile_undosys_type(UndoType *ut) ut->step_decode = memfile_undosys_step_decode; ut->step_free = memfile_undosys_step_free; - ut->mode = BKE_UNDOTYPE_MODE_STORE; ut->use_context = true; ut->step_size = sizeof(MemFileUndoStep); -- cgit v1.2.3