From c5b66560de75a54b5c6920fb675c0d804caeb724 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 22 Feb 2022 16:36:59 +1100 Subject: Fix T93629: Reset to defaults undoes all steps when applied twice Reset Defaults left the undo stack in an invalid state, with the active undo step left at the previous state then it should have been. Now the buttons own undo logic is used to perform undo pushes. --- source/blender/editors/interface/interface_handlers.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source/blender/editors/interface/interface_handlers.c') diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index 905fd452b6c..d947db463ee 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -8802,7 +8802,7 @@ uiBut *UI_context_active_but_prop_get(const bContext *C, return activebut; } -void UI_context_active_but_prop_handle(bContext *C) +void UI_context_active_but_prop_handle(bContext *C, const bool handle_undo) { uiBut *activebut = ui_context_rna_button_active(C); if (activebut) { @@ -8813,6 +8813,11 @@ void UI_context_active_but_prop_handle(bContext *C) if (block->handle_func) { block->handle_func(C, block->handle_func_arg, activebut->retval); } + if (handle_undo) { + /* Update the button so the undo text uses the correct value. */ + ui_but_update(activebut); + ui_apply_but_undo(activebut); + } } } -- cgit v1.2.3