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-01-09 12:21:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-01-09 12:21:24 +0300
commit3cbe2a19dffdcf9aea5fee28fba4f2e66dcff08a (patch)
tree2aaf4932b3ccddb5cd0ea290a12bf7f85d08b96e /source/blender/blenkernel/intern/undo_system.c
parentef33215bb777eb3eb0d7d5527f39fb7788deb7ec (diff)
Undo System: apply accumulation steps
Apply steps between the active and the undo state being decoded.
Diffstat (limited to 'source/blender/blenkernel/intern/undo_system.c')
-rw-r--r--source/blender/blenkernel/intern/undo_system.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index abc53bf031a..139f6a20a59 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -563,14 +563,28 @@ bool BKE_undosys_step_undo_with_data_ex(
undosys_stack_validate(ustack, true);
}
UndoStep *us_prev = us ? us->prev : NULL;
- if (us && us->type->mode == BKE_UNDOTYPE_MODE_STORE) {
+ if (us) {
/* The current state is a copy, we need to load the previous state. */
us = us_prev;
}
if (us != NULL) {
CLOG_INFO(&LOG, 1, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name);
- undosys_step_decode(C, us, -1);
+
+ /* Handle accumulate steps. */
+ if (ustack->step_active) {
+ UndoStep *us_iter = ustack->step_active;
+ while (us_iter != us) {
+ if (us_iter->type->mode == BKE_UNDOTYPE_MODE_ACCUMULATE) {
+ undosys_step_decode(C, us_iter, -1);
+ }
+ us_iter = us_iter->prev;
+ }
+ }
+
+ if (us->type->mode != BKE_UNDOTYPE_MODE_ACCUMULATE) {
+ undosys_step_decode(C, us, -1);
+ }
ustack->step_active = us_prev;
undosys_stack_validate(ustack, true);
if (use_skip) {
@@ -611,6 +625,19 @@ bool BKE_undosys_step_redo_with_data_ex(
if (us != NULL) {
CLOG_INFO(&LOG, 1, "addr=%p, name='%s', type='%s'", us, us->name, us->type->name);
+
+ /* Handle accumulate steps. */
+ if (ustack->step_active && ustack->step_active->next) {
+ UndoStep *us_iter = ustack->step_active->next;
+ while (us_iter != us) {
+ if (us_iter->type->mode == BKE_UNDOTYPE_MODE_ACCUMULATE) {
+ undosys_step_decode(C, us_iter, 1);
+ }
+ us_iter = us_iter->next;
+ }
+ }
+
+ /* Unlike undo, always redo accumulation state. */
undosys_step_decode(C, us, 1);
ustack->step_active = us_next;
if (use_skip) {