[Bf-blender-cvs] [904e7830e10] property-search-ui-v2: Property Search: Search based on label buttons
Hans Goudey
noreply at git.blender.org
Thu Aug 13 23:34:42 CEST 2020
Commit: 904e7830e104b6e58022ef0b176139bd970836a6
Author: Hans Goudey
Date: Thu Aug 13 17:34:33 2020 -0400
Branches: property-search-ui-v2
https://developer.blender.org/rB904e7830e104b6e58022ef0b176139bd970836a6
Property Search: Search based on label buttons
===================================================================
M source/blender/editors/interface/interface_layout.c
===================================================================
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 40f6fe24650..5164caa1e0b 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -5177,6 +5177,11 @@ static void layout_free_and_hide_buttons(uiLayout *layout)
static bool button_matches_search_filter(uiBut *but, char *search_filter)
{
+ /* Do the shorter checks first, in case the check returns true. */
+ if (BLI_strcasestr(but->str, search_filter)) {
+ return true;
+ }
+
if (but->optype != NULL) {
if (BLI_strcasestr(but->optype->name, search_filter)) {
return true;
@@ -5184,10 +5189,6 @@ static bool button_matches_search_filter(uiBut *but, char *search_filter)
}
if (but->rnaprop != NULL) {
- /* Do the shorter checks first, in case the check returns true. */
- if (BLI_strcasestr(but->str, search_filter)) {
- return true;
- }
if (BLI_strcasestr(RNA_property_ui_name(but->rnaprop), search_filter)) {
return true;
}
@@ -5208,7 +5209,15 @@ static bool block_search_filter_tag_buttons(uiBlock *block)
{
bool has_result = false;
LISTBASE_FOREACH (uiBut *, but, &block->buttons) {
- if (button_matches_search_filter(but, block->search_filter)) {
+ /* First match regular buttons. */
+ if (!ELEM(but->type, UI_BTYPE_LABEL) &&
+ button_matches_search_filter(but, block->search_filter)) {
+ has_result = true;
+ but->flag |= UI_SEARCH_FILTER_MATCHES;
+ }
+ /* Then match their labels. */
+ if (but->label_but != NULL &&
+ button_matches_search_filter(but->label_but, block->search_filter)) {
has_result = true;
but->flag |= UI_SEARCH_FILTER_MATCHES;
}
More information about the Bf-blender-cvs
mailing list