From 115a5bf65a6b7f4b16a50f4c9a4611925d9eccb0 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 18 Nov 2019 23:53:34 +1100 Subject: Correct error in last commit --- source/blender/editors/sculpt_paint/sculpt.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 6032c3615c6..89bc7912ccf 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -7868,6 +7868,19 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) } ED_object_sculptmode_enter_ex(bmain, depsgraph, scene, ob, false, op->reports); BKE_paint_toolslots_brush_validate(bmain, &ts->sculpt->paint); + + if (ob->mode & mode_flag) { + Mesh *me = ob->data; + /* Dyntopo add's it's own undo step. */ + if ((me->flag & ME_SCULPT_DYNAMIC_TOPOLOGY) == 0) { + /* Without this the memfile undo step is used, + * while it works it causes lag when undoing the first undo step, see T71564. */ + wmWindowManager *wm = CTX_wm_manager(C); + if (wm->op_undo_depth <= 1) { + sculpt_undo_push_begin(op->type->name); + } + } + } } WM_event_add_notifier(C, NC_SCENE | ND_MODE, scene); @@ -7876,13 +7889,6 @@ static int sculpt_mode_toggle_exec(bContext *C, wmOperator *op) WM_toolsystem_update_from_context_view3d(C); - /* Without this the memfile undo step is used, - * while it works it causes lag when undoing the first undo step, see T71564. */ - wmWindowManager *wm = CTX_wm_manager(C); - if (wm->op_undo_depth <= 1) { - sculpt_undo_push_begin(op->type->name); - } - return OPERATOR_FINISHED; } -- cgit v1.2.3