From e1a9ba94c59950ed6af09b524d7a7fe22919055b Mon Sep 17 00:00:00 2001 From: Falk David Date: Tue, 20 Apr 2021 15:45:32 +0200 Subject: [PATCH] Fix T87637: Dragging button value cancel not working Dragging a number button, then holding the value and pressing escape would not reset the value correctly. This was because eb06ccc32462 assumed that `data->value` and `data->startvalue` were set during dragging which they are not. The fix moves the if statement into the section where we check if a number was entered (number edit) making sure that we only cancel if the button was in "string enter" mode and that the value entered was the same as before. Reviewed By: HooglyBoogly, Severin Maniphest Tasks: T87637 Differential Revision: https://developer.blender.org/D11021 --- .../blender/editors/interface/interface_handlers.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index c64e562c36c..4cbf5fca49a 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -1121,17 +1121,17 @@ static void ui_apply_but_NUM(bContext *C, uiBut *but, uiHandleButtonData *data) data->cancel = true; return; } + + /* If the value entered is the exact same, do not trigger an update. */ + if (data->value == data->startvalue) { + data->cancel = true; + return; + } } else { ui_but_value_set(but, data->value); } - /* If the value entered is the exact same, do not trigger an update. */ - if (data->value == data->startvalue) { - data->cancel = true; - return; - } - ui_but_update_edited(but); ui_apply_but_func(C, but);