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
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-07-11 02:11:49 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-07-11 02:22:42 +0300
commite60d35153f1bb14bcc6b91ddcf9e1caf24069886 (patch)
treed4c16edb22ca33e3d94bc4f50c35e6ac946a2d26 /source
parentd3a8d25fb3d8750b09d6b75b8b55f92e05c1297e (diff)
Cleanup: avoid recursion for undo/redo step skipping
Simplifies making further changes.
Diffstat (limited to 'source')
-rw-r--r--source/blender/blenkernel/intern/undo_system.c55
1 files changed, 41 insertions, 14 deletions
diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c
index 76b37b940ec..7197a1734c3 100644
--- a/source/blender/blenkernel/intern/undo_system.c
+++ b/source/blender/blenkernel/intern/undo_system.c
@@ -683,17 +683,30 @@ bool BKE_undosys_step_undo_with_data_ex(UndoStack *ustack,
}
}
- undosys_step_decode(C, G_MAIN, ustack, us, -1);
-
- ustack->step_active = us_prev;
- undosys_stack_validate(ustack, true);
+ UndoStep *us_active = us_prev;
if (use_skip) {
- if (ustack->step_active && ustack->step_active->skip) {
- CLOG_INFO(
- &LOG, 2, "undo continue with skip %p '%s', type='%s'", us, us->name, us->type->name);
- BKE_undosys_step_undo_with_data(ustack, C, ustack->step_active);
+ while (us_active->skip && us_active->prev) {
+ us_active = us_active->prev;
}
}
+
+ {
+ UndoStep *us_iter = us_prev;
+ do {
+ const bool is_final = (us_iter == us_active);
+ if (is_final == false) {
+ CLOG_INFO(&LOG,
+ 2,
+ "undo continue with skip %p '%s', type='%s'",
+ us_iter,
+ us_iter->name,
+ us_iter->type->name);
+ }
+ undosys_step_decode(C, G_MAIN, ustack, us_iter, -1);
+ ustack->step_active = us_iter;
+ } while ((us_active != us_iter) && (us_iter = us_iter->prev));
+ }
+
return true;
}
return false;
@@ -737,15 +750,29 @@ bool BKE_undosys_step_redo_with_data_ex(UndoStack *ustack,
}
}
- undosys_step_decode(C, G_MAIN, ustack, us, 1);
- ustack->step_active = us_next;
+ UndoStep *us_active = us_next;
if (use_skip) {
- if (ustack->step_active && ustack->step_active->skip) {
- CLOG_INFO(
- &LOG, 2, "redo continue with skip %p '%s', type='%s'", us, us->name, us->type->name);
- BKE_undosys_step_redo_with_data(ustack, C, ustack->step_active);
+ while (us_active->skip && us_active->prev) {
+ us_active = us_active->next;
}
}
+
+ {
+ UndoStep *us_iter = us_next;
+ do {
+ const bool is_final = (us_iter == us_active);
+ if (is_final == false) {
+ CLOG_INFO(&LOG,
+ 2,
+ "redo continue with skip %p '%s', type='%s'",
+ us_iter,
+ us_iter->name,
+ us_iter->type->name);
+ }
+ undosys_step_decode(C, G_MAIN, ustack, us_iter, 1);
+ ustack->step_active = us_iter;
+ } while ((us_active != us_iter) && (us_iter = us_iter->next));
+ }
return true;
}
return false;