diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-05-14 08:26:32 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-05-14 08:26:32 +0300 |
commit | de6a86611440568277dce1ea91135dc9611224ff (patch) | |
tree | 26f3ba0328a17e0cfaf15c66766d2f599b38fef6 /source/blender | |
parent | 0892ce85b21342a32322aca4a88caa67720c675d (diff) | |
parent | 1cbc3a8f2b4772a96f173083e3a7b32b33b96f0b (diff) |
Merge branch 'blender-v2.83-release'
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/undo/ed_undo.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/source/blender/editors/undo/ed_undo.c b/source/blender/editors/undo/ed_undo.c index f7300221028..6633e1c427c 100644 --- a/source/blender/editors/undo/ed_undo.c +++ b/source/blender/editors/undo/ed_undo.c @@ -79,15 +79,26 @@ static CLG_LogRef LOG = {"ed.undo"}; void ED_undo_push(bContext *C, const char *str) { CLOG_INFO(&LOG, 1, "name='%s'", str); + WM_file_tag_modified(); - const int steps = U.undosteps; - + wmWindowManager *wm = CTX_wm_manager(C); + int steps = U.undosteps; + + /* Ensure steps that have been initialized are always pushed, + * even when undo steps are zero. + * + * Note that some modes (paint, sculpt) initialize an undo step before an action runs, + * then accumulate changes there, or restore data from it in the case of 2D painting. + * + * For this reason we need to handle the undo step even when undo steps is set to zero. + */ + if ((steps <= 0) && wm->undo_stack->step_init != NULL) { + steps = 1; + } if (steps <= 0) { return; } - wmWindowManager *wm = CTX_wm_manager(C); - /* Only apply limit if this is the last undo step. */ if (wm->undo_stack->step_active && (wm->undo_stack->step_active->next == NULL)) { BKE_undosys_stack_limit_steps_and_memory(wm->undo_stack, steps - 1, 0); @@ -103,8 +114,6 @@ void ED_undo_push(bContext *C, const char *str) if (CLOG_CHECK(&LOG, 1)) { BKE_undosys_print(wm->undo_stack); } - - WM_file_tag_modified(); } /** |