diff options
author | Hans Goudey <h.goudey@me.com> | 2021-03-03 22:48:27 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2021-03-03 22:48:39 +0300 |
commit | dd43a3701641a57871564447bdeecf154dbe13a2 (patch) | |
tree | b468d2aca95067f2d36bea45d65b7b76501750bf /source/blender/editors | |
parent | f53221bff7ffdcfb3acf03389450ed5ffb8f7964 (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.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/space_node/node_geometry_attribute_search.cc | 6 |
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) { |