Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-12-13 22:57:55 +0300
committerHans Goudey <h.goudey@me.com>2021-12-13 22:58:30 +0300
commit0606adceb3b6efa020c7389bdb31fe541b7d1d5f (patch)
treef61b37c6f495c8e5643e1ee4a3fd5803e2b1d4fc /source/blender/editors/interface
parenta90c3564676649aa4a0b74112c852a75de6d3521 (diff)
UI: String Search: Add an optional weight parameter
This builds off of rBf951aa063f7, adding a weight parameter which can be used to change the order of items when they have the same match score. In the future, if string searching gets a C++ API, we could use an optional parameter for the weight, since it is not used yet. This will be used for the node link drag search menu (D8286). Differential Revision: https://developer.blender.org/D13559
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface.c2
-rw-r--r--source/blender/editors/interface/interface_template_attribute_search.cc2
-rw-r--r--source/blender/editors/interface/interface_template_search_menu.cc2
-rw-r--r--source/blender/editors/interface/interface_templates.c4
-rw-r--r--source/blender/editors/interface/interface_utils.c2
5 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c
index 27ec600943b..df508b87ce4 100644
--- a/source/blender/editors/interface/interface.c
+++ b/source/blender/editors/interface/interface.c
@@ -6733,7 +6733,7 @@ static void operator_enum_search_update_fn(const struct bContext *C,
StringSearch *search = BLI_string_search_new();
for (const EnumPropertyItem *item = all_items; item->identifier; item++) {
- BLI_string_search_add(search, item->name, (void *)item);
+ BLI_string_search_add(search, item->name, (void *)item, 0);
}
const EnumPropertyItem **filtered_items;
diff --git a/source/blender/editors/interface/interface_template_attribute_search.cc b/source/blender/editors/interface/interface_template_attribute_search.cc
index 85a6147432b..6d4b7a37bff 100644
--- a/source/blender/editors/interface/interface_template_attribute_search.cc
+++ b/source/blender/editors/interface/interface_template_attribute_search.cc
@@ -106,7 +106,7 @@ void attribute_search_add_items(StringRefNull str,
continue;
}
- BLI_string_search_add(search, item->name.c_str(), (void *)item);
+ BLI_string_search_add(search, item->name.c_str(), (void *)item, 0);
}
GeometryAttributeInfo **filtered_items;
diff --git a/source/blender/editors/interface/interface_template_search_menu.cc b/source/blender/editors/interface/interface_template_search_menu.cc
index fe7660e4221..7a079e01e61 100644
--- a/source/blender/editors/interface/interface_template_search_menu.cc
+++ b/source/blender/editors/interface/interface_template_search_menu.cc
@@ -1014,7 +1014,7 @@ static void menu_search_update_fn(const bContext *UNUSED(C),
StringSearch *search = BLI_string_search_new();
LISTBASE_FOREACH (MenuSearch_Item *, item, &data->items) {
- BLI_string_search_add(search, item->drawwstr_full, item);
+ BLI_string_search_add(search, item->drawwstr_full, item, 0);
}
MenuSearch_Item **filtered_items;
diff --git a/source/blender/editors/interface/interface_templates.c b/source/blender/editors/interface/interface_templates.c
index e45884ea73b..a4fd817001a 100644
--- a/source/blender/editors/interface/interface_templates.c
+++ b/source/blender/editors/interface/interface_templates.c
@@ -435,7 +435,7 @@ static void id_search_cb(const bContext *C,
/* ID listbase */
LISTBASE_FOREACH (ID *, id, lb) {
if (id_search_allows_id(template_ui, flag, id, str)) {
- BLI_string_search_add(search, id->name + 2, id);
+ BLI_string_search_add(search, id->name + 2, id, 0);
}
}
@@ -470,7 +470,7 @@ static void id_search_cb_tagged(const bContext *C,
LISTBASE_FOREACH (ID *, id, lb) {
if (id->tag & LIB_TAG_DOIT) {
if (id_search_allows_id(template_ui, flag, id, str)) {
- BLI_string_search_add(search, id->name + 2, id);
+ BLI_string_search_add(search, id->name + 2, id, 0);
}
id->tag &= ~LIB_TAG_DOIT;
}
diff --git a/source/blender/editors/interface/interface_utils.c b/source/blender/editors/interface/interface_utils.c
index 30436c52c38..84ec5f939d2 100644
--- a/source/blender/editors/interface/interface_utils.c
+++ b/source/blender/editors/interface/interface_utils.c
@@ -546,7 +546,7 @@ void ui_rna_collection_search_update_fn(const struct bContext *C,
cis->name_prefix_offset = name_prefix_offset;
cis->has_sep_char = has_sep_char;
if (!skip_filter) {
- BLI_string_search_add(search, name, cis);
+ BLI_string_search_add(search, name, cis, 0);
}
BLI_addtail(items_list, cis);
if (name != name_buf) {