Commit: dd43a3701641a57871564447bdeecf154dbe13a2
Author: Hans Goudey
Date:   Wed Mar 3 13:48:27 2021 -0600
Branches: master
https://developer.blender.org/rBdd43a3701641a57871564447bdeecf154dbe13a2

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.

===================================================================

M       source/blender/editors/space_node/node_geometry_attribute_search.cc

===================================================================

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) {

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to