Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-03-03 22:48:27 +0300
committerHans Goudey <h.goudey@me.com>2021-03-03 22:48:39 +0300
commitdd43a3701641a57871564447bdeecf154dbe13a2 (patch)
treeb468d2aca95067f2d36bea45d65b7b76501750bf
parentf53221bff7ffdcfb3acf03389450ed5ffb8f7964 (diff)
Geometry Nodes: Allow clearing an attribute text field
Because pressing enter will choose the current search item from the menu, and there was no search item with an empty string, it was impossible to clear the text of an attribute text field. This commit adds a simple "X" icon in the top row when you delete the string.
-rw-r--r--source/blender/editors/space_node/node_geometry_attribute_search.cc6
1 files changed, 6 insertions, 0 deletions
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 41f04dad221..982c57eb3ec 100644
--- a/source/blender/editors/space_node/node_geometry_attribute_search.cc
+++ b/source/blender/editors/space_node/node_geometry_attribute_search.cc
@@ -69,6 +69,12 @@ static void attribute_search_update_fn(
UI_search_item_add(items, str, (void *)str, ICON_ADD, 0, 0);
}
+ if (str[0] == '\0' && !is_first) {
+ /* Allow clearing the text field when the string is empty, but not on the first pass,
+ * or opening an attribute field for the first time would show this search item. */
+ UI_search_item_add(items, str, (void *)str, ICON_X, 0, 0);
+ }
+
/* Skip the filter when the menu is first opened, so all of the items are visible. */
if (is_first) {
for (const std::string &attribute_name : attribute_name_hints) {