[Bf-blender-cvs] [da5b35cb3af] temp-geometry-nodes-attribute-search: Adjust behavior for "add attribute" item
Hans Goudey
noreply at git.blender.org
Thu Feb 25 15:49:12 CET 2021
Commit: da5b35cb3af8b99d43640e8395e74b4de1b379db
Author: Hans Goudey
Date: Thu Feb 25 08:49:04 2021 -0600
Branches: temp-geometry-nodes-attribute-search
https://developer.blender.org/rBda5b35cb3af8b99d43640e8395e74b4de1b379db
Adjust behavior for "add attribute" item
It's no longer added when there is an existing attribute with the same name
===================================================================
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 5ad0ba495e0..9b4eb9a8169 100644
--- a/source/blender/editors/space_node/node_geometry_attribute_search.cc
+++ b/source/blender/editors/space_node/node_geometry_attribute_search.cc
@@ -64,17 +64,16 @@ static void attribute_search_update_fn(
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 the attribute already exists. TODO: Don't add this for input attributes. */
- 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);
+ if (str[0] != '\0' && !attribute_name_hints.contains_as(StringRef(str))) {
+ /* Any string may be valid, so add the current search string with the hints. */
+ UI_search_item_add(items, str, (void *)str, ICON_ADD, 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) {
+ /* Just use the pointer to the name string as the search data,
+ * since it's not used anyway but we need a pointer. */
UI_search_item_add(items, attribute_name.c_str(), (void *)&attribute_name, ICON_NONE, 0, 0);
}
return;
More information about the Bf-blender-cvs
mailing list