From 991a1cdf5dae6aeae2053d993f9983d8965a82be Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Thu, 20 May 2021 12:17:54 -0400 Subject: Fix T87316: No undo push for clicking on attribute name Since there is a special callback for assigning the name from the search box, and the callback doesn't call an operator or something else that would do an undo push, I think the solution is to do it manually here. Another option would be adding the button flag "UI_BUT_UNDO", which isn't set by default for search buttons, but that gives us ugly names for the undo steps, so an explicit push is better in this case. Differential Revision: https://developer.blender.org/D11190 --- source/blender/editors/space_node/node_geometry_attribute_search.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'source') diff --git a/source/blender/editors/space_node/node_geometry_attribute_search.cc b/source/blender/editors/space_node/node_geometry_attribute_search.cc index 856a90be5ae..94080a7b616 100644 --- a/source/blender/editors/space_node/node_geometry_attribute_search.cc +++ b/source/blender/editors/space_node/node_geometry_attribute_search.cc @@ -33,6 +33,8 @@ #include "RNA_access.h" #include "RNA_enum_types.h" +#include "ED_undo.h" + #include "BLT_translation.h" #include "UI_interface.h" @@ -132,7 +134,7 @@ static void attribute_search_update_fn(const bContext *UNUSED(C), BLI_string_search_free(search); } -static void attribute_search_exec_fn(bContext *UNUSED(C), void *data_v, void *item_v) +static void attribute_search_exec_fn(bContext *C, void *data_v, void *item_v) { AttributeSearchData *data = static_cast(data_v); AvailableAttributeInfo *item = static_cast(item_v); @@ -140,6 +142,8 @@ static void attribute_search_exec_fn(bContext *UNUSED(C), void *data_v, void *it bNodeSocket &socket = data->socket; bNodeSocketValueString *value = static_cast(socket.default_value); BLI_strncpy(value->value, item->name.c_str(), MAX_NAME); + + ED_undo_push(C, "Assign Attribute Name"); } void node_geometry_add_attribute_search_button(const bContext *C, -- cgit v1.2.3