diff --git a/source/blender/editors/space_view3d/view3d_navigate.cc b/source/blender/editors/space_view3d/view3d_navigate.cc index 856155a5d19..d06f2a2b269 100644 --- a/source/blender/editors/space_view3d/view3d_navigate.cc +++ b/source/blender/editors/space_view3d/view3d_navigate.cc @@ -1557,7 +1557,7 @@ void VIEW3D_OT_view_orbit(wmOperatorType *ot) ot->poll = ED_operator_rv3d_user_region_poll; /* flags */ - ot->flag = 0; + ot->flag = OPTYPE_UNDO_KEEP_PRIOR_REPEAT_UI; /* properties */ prop = RNA_def_float(ot->srna, "angle", 0, -FLT_MAX, FLT_MAX, "Roll", "", -FLT_MAX, FLT_MAX); @@ -1631,7 +1631,7 @@ void VIEW3D_OT_view_pan(wmOperatorType *ot) ot->poll = view3d_location_poll; /* flags */ - ot->flag = 0; + ot->flag = OPTYPE_UNDO_KEEP_PRIOR_REPEAT_UI; /* Properties */ ot->prop = RNA_def_enum( diff --git a/source/blender/editors/space_view3d/view3d_navigate_dolly.c b/source/blender/editors/space_view3d/view3d_navigate_dolly.c index e27f035b02c..b4b148053fe 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_dolly.c +++ b/source/blender/editors/space_view3d/view3d_navigate_dolly.c @@ -351,7 +351,8 @@ void VIEW3D_OT_dolly(wmOperatorType *ot) ot->cancel = view3d_navigate_cancel_fn; /* flags */ - ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR_XY | OPTYPE_DEPENDS_ON_CURSOR; + ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR_XY | OPTYPE_DEPENDS_ON_CURSOR | + OPTYPE_UNDO_KEEP_PRIOR_REPEAT_UI; /* properties */ view3d_operator_properties_common( diff --git a/source/blender/editors/space_view3d/view3d_navigate_fly.c b/source/blender/editors/space_view3d/view3d_navigate_fly.c index 3e83f8085c7..aeeab063f4b 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_fly.c +++ b/source/blender/editors/space_view3d/view3d_navigate_fly.c @@ -1136,7 +1136,7 @@ void VIEW3D_OT_fly(wmOperatorType *ot) ot->poll = ED_operator_region_view3d_active; /* flags */ - ot->flag = OPTYPE_BLOCKING; + ot->flag = OPTYPE_BLOCKING | OPTYPE_UNDO_KEEP_PRIOR_REPEAT_UI; } /** \} */ diff --git a/source/blender/editors/space_view3d/view3d_navigate_move.c b/source/blender/editors/space_view3d/view3d_navigate_move.c index 29343793e45..21ddbeea89a 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_move.c +++ b/source/blender/editors/space_view3d/view3d_navigate_move.c @@ -218,7 +218,7 @@ void VIEW3D_OT_move(wmOperatorType *ot) ot->cancel = view3d_navigate_cancel_fn; /* flags */ - ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR_XY; + ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR_XY | OPTYPE_UNDO_KEEP_PRIOR_REPEAT_UI; /* properties */ view3d_operator_properties_common(ot, V3D_OP_PROP_USE_MOUSE_INIT); diff --git a/source/blender/editors/space_view3d/view3d_navigate_rotate.c b/source/blender/editors/space_view3d/view3d_navigate_rotate.c index b7fee5538ab..10412ee4e91 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_rotate.c +++ b/source/blender/editors/space_view3d/view3d_navigate_rotate.c @@ -478,7 +478,7 @@ void VIEW3D_OT_rotate(wmOperatorType *ot) ot->cancel = view3d_navigate_cancel_fn; /* flags */ - ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR_XY; + ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR_XY | OPTYPE_UNDO_KEEP_PRIOR_REPEAT_UI; view3d_operator_properties_common(ot, V3D_OP_PROP_USE_MOUSE_INIT); } diff --git a/source/blender/editors/space_view3d/view3d_navigate_walk.c b/source/blender/editors/space_view3d/view3d_navigate_walk.c index 9aa8328287b..6087066299d 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_walk.c +++ b/source/blender/editors/space_view3d/view3d_navigate_walk.c @@ -1447,7 +1447,7 @@ void VIEW3D_OT_walk(wmOperatorType *ot) /* flags */ /* NOTE: #OPTYPE_BLOCKING isn't used because this needs to grab & hide the cursor. * where as blocking confines the cursor to the window bounds, even when hidden. */ - ot->flag = 0; + ot->flag = OPTYPE_UNDO_KEEP_PRIOR_REPEAT_UI; } /** \} */ diff --git a/source/blender/editors/space_view3d/view3d_navigate_zoom.c b/source/blender/editors/space_view3d/view3d_navigate_zoom.c index 791e492a7cc..4117af76693 100644 --- a/source/blender/editors/space_view3d/view3d_navigate_zoom.c +++ b/source/blender/editors/space_view3d/view3d_navigate_zoom.c @@ -622,7 +622,7 @@ void VIEW3D_OT_zoom(wmOperatorType *ot) ot->cancel = view3d_navigate_cancel_fn; /* flags */ - ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR_XY; + ot->flag = OPTYPE_BLOCKING | OPTYPE_GRAB_CURSOR_XY | OPTYPE_UNDO_KEEP_PRIOR_REPEAT_UI; /* properties */ view3d_operator_properties_common( diff --git a/source/blender/windowmanager/WM_types.h b/source/blender/windowmanager/WM_types.h index 14ebbf5cef1..c557ffb0a40 100644 --- a/source/blender/windowmanager/WM_types.h +++ b/source/blender/windowmanager/WM_types.h @@ -182,6 +182,14 @@ enum { * Even so, accessing from the menu should behave usefully. */ OPTYPE_DEPENDS_ON_CURSOR = (1 << 11), + /** + * Don't clear the previously registered UI even though an undo step was added. + * This means the redo panel will undo this step as well as it's self. + * + * Typically this is something to avoid as undoing both actions isn't correct. + * Make an exception for some viewport operations see: #106292. + */ + OPTYPE_UNDO_KEEP_PRIOR_REPEAT_UI = (1 << 12), }; /** For #WM_cursor_grab_enable wrap axis. */ diff --git a/source/blender/windowmanager/intern/wm_event_system.cc b/source/blender/windowmanager/intern/wm_event_system.cc index 53f3541c611..c980fbd9999 100644 --- a/source/blender/windowmanager/intern/wm_event_system.cc +++ b/source/blender/windowmanager/intern/wm_event_system.cc @@ -1154,7 +1154,10 @@ static void wm_operator_finished(bContext *C, * therefor a redo panel wouldn't redo this action but the previous registered action, * causing the "redo" to remove/loose this operator. See: #101743. * Register check is needed so nested operator calls don't clear the HUD. See: #103587. */ - if (!(has_register || do_register)) { + if (!(has_register || do_register || + /* In some cases it's preferred undoable actions don't clear the HUD. + * Viewport actions for e.g. see: #106292. */ + (op->type->flag & OPTYPE_UNDO_KEEP_PRIOR_REPEAT_UI))) { if (repeat == 0) { hud_status = CLEAR; }