[Bf-blender-cvs] [28dc6ab915c] temp-geometry-nodes-attribute-search: Use exposed "is first search" boolean
Hans Goudey
noreply at git.blender.org
Thu Feb 25 03:46:08 CET 2021
Commit: 28dc6ab915c992a0f3cf88ad6cdab25a18e41787
Author: Hans Goudey
Date: Wed Feb 24 17:40:50 2021 -0600
Branches: temp-geometry-nodes-attribute-search
https://developer.blender.org/rB28dc6ab915c992a0f3cf88ad6cdab25a18e41787
Use exposed "is first search" boolean
===================================================================
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 85cbe79550f..5ad0ba495e0 100644
--- a/source/blender/editors/space_node/node_geometry_attribute_search.cc
+++ b/source/blender/editors/space_node/node_geometry_attribute_search.cc
@@ -52,10 +52,8 @@ struct AttributeSearchData {
uiBlock *button_store_block;
};
-static void attribute_search_update_fn(const bContext *C,
- void *arg,
- const char *str,
- uiSearchItems *items)
+static void attribute_search_update_fn(
+ const bContext *C, void *arg, const char *str, uiSearchItems *items, const bool is_first)
{
AttributeSearchData *data = static_cast<AttributeSearchData *>(arg);
const NodeUIStorage *ui_storage = BKE_node_tree_ui_storage_get_from_context(
@@ -74,6 +72,14 @@ static void attribute_search_update_fn(const bContext *C,
items, str, (void *)str, ICON_ADD, contains_search ? UI_BUT_DISABLED : 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) {
+ UI_search_item_add(items, attribute_name.c_str(), (void *)&attribute_name, ICON_NONE, 0, 0);
+ }
+ return;
+ }
+
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