diff options
author | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-13 19:22:17 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2018-06-13 19:39:30 +0300 |
commit | 3102833962853b1fb0ebd942a1c8111a70eb12bd (patch) | |
tree | b15526cecc6df7f35e7baabe83b47d365c7ae153 /source/blender/blenkernel/intern/undo_system.c | |
parent | 90e6323ed8575fa406ece8903b9ceca603737d83 (diff) |
Fix undo of transform after frame change undoing too much.
For grouped undo we should not skip the undo push, rather replace the
previous undo push. This way undo goes back to the state after the last
operation in the group.
Diffstat (limited to 'source/blender/blenkernel/intern/undo_system.c')
-rw-r--r-- | source/blender/blenkernel/intern/undo_system.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/undo_system.c b/source/blender/blenkernel/intern/undo_system.c index a8f895853ed..ba7d432fab3 100644 --- a/source/blender/blenkernel/intern/undo_system.c +++ b/source/blender/blenkernel/intern/undo_system.c @@ -234,6 +234,23 @@ void BKE_undosys_stack_clear(UndoStack *ustack) ustack->step_active = NULL; } +void BKE_undosys_stack_clear_active(UndoStack *ustack) +{ + /* Remove active and all following undos. */ + UndoStep *us = ustack->step_active; + + if (us) { + ustack->step_active = us->prev; + bool is_not_empty = ustack->step_active != NULL; + + while (ustack->steps.last != ustack->step_active) { + UndoStep *us_iter = ustack->steps.last; + undosys_step_free_and_unlink(ustack, us_iter); + undosys_stack_validate(ustack, is_not_empty); + } + } +} + static bool undosys_stack_push_main(UndoStack *ustack, const char *name, struct Main *bmain) { UNDO_NESTED_ASSERT(false); |