[Bf-blender-cvs] [0afea32db17] temp-geometry-nodes-attribute-search: Attribute Search: Always display search string with + icon
Hans Goudey
noreply at git.blender.org
Thu Feb 25 00:31:56 CET 2021
Commit: 0afea32db17feaf267223469b7a3ebfc8c93dbee
Author: Hans Goudey
Date: Wed Feb 24 17:02:37 2021 -0600
Branches: temp-geometry-nodes-attribute-search
https://developer.blender.org/rB0afea32db17feaf267223469b7a3ebfc8c93dbee
Attribute Search: Always display search string with + icon
===================================================================
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 aa51f21fef8..9cf863db2fb 100644
--- a/source/blender/editors/space_node/node_geometry_attribute_search.cc
+++ b/source/blender/editors/space_node/node_geometry_attribute_search.cc
@@ -66,6 +66,14 @@ static void attribute_search_update_fn(const bContext *C,
const Set<std::string> &attribute_name_hints = ui_storage->attribute_name_hints;
+ if (str[0] != '\0') {
+ /* Any string may be valid, so add the current search string with the hints,
+ * but gray it out if if the attribute already exists. */
+ const bool contains_search = attribute_name_hints.contains_as(StringRef(str));
+ UI_search_item_add(
+ items, str, (void *)str, ICON_ADD, contains_search ? UI_BUT_DISABLED : 0, 0);
+ }
+
StringSearch *search = BLI_string_search_new();
for (const std::string &attribute_name : attribute_name_hints) {
BLI_string_search_add(search, attribute_name.c_str(), (void *)&attribute_name);
More information about the Bf-blender-cvs
mailing list