UI: Remove "Adjust Last Operation" region when button sends undo push

Addresses #78171, #61828, #62473 and many closed reports about this.

Until now, the "Adjust Last Operation" would keep being available after
changing various properties in the UI. Actually using it to adjust the
last operation parameters would undo the other changes done through the
UI, which is unexpected and easy to miss. Users would keep running into
this, thinking it was a bug, as the many reports merged into #78171
indicate.

As agreed on in the report, adjusting the last operation shouldn't be
possible after changing properties in the UI that send an undo push.
That's what this PR implements, together with removing the "Adjust Last
Operation" region at that point.

Pull Request: https://projects.blender.org/blender/blender/pulls/133003
This commit is contained in:
Julian Eisel 2025-01-14 12:45:34 +01:00 committed by Julian Eisel
parent e18011fddc
commit 1bde901bf2
2 changed files with 18 additions and 0 deletions

View file

@ -1125,6 +1125,9 @@ static void ui_apply_but_funcs_after(bContext *C)
ui_afterfunc_update_preferences_dirty(&after);
if (after.undostr[0]) {
/* Remove "Adjust Last Operation" HUD. Using it would revert this undo push which isn't
* obvious, see #78171. */
WM_operator_stack_clear(CTX_wm_manager(C));
ED_undo_push(C, after.undostr);
}
}

View file

@ -217,11 +217,26 @@ static void hud_region_draw(const bContext *C, ARegion *region)
}
}
static void hud_region_listener(const wmRegionListenerParams *params)
{
ARegion *region = params->region;
const wmNotifier *wmn = params->notifier;
switch (wmn->category) {
case NC_WM:
if (wmn->data == ND_HISTORY) {
ED_region_tag_redraw(region);
}
break;
}
}
ARegionType *ED_area_type_hud(int space_type)
{
ARegionType *art = MEM_cnew<ARegionType>(__func__);
art->regionid = RGN_TYPE_HUD;
art->keymapflag = ED_KEYMAP_UI | ED_KEYMAP_VIEW2D;
art->listener = hud_region_listener;
art->layout = hud_region_layout;
art->draw = hud_region_draw;
art->init = hud_region_init;