From 933bf62a611f61bd61e3e7745ce6dea58f571e72 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Fri, 2 Oct 2020 13:10:21 -0500 Subject: Property Search: Differentiate search filtered and inactive buttons Currently there's no way to know if a button is inactive when it doesn't match the search results, because they use the same 50% gray level. This isn't a huge problem, but it could lead to confusion. This commit uses a subtle solution, a 25% opacity when the button is inactive and also filtered by search. This requires flipping the meaning of the UI_SEARCH_FILTER_MATCHES flag in the code, and also adding a widget_alpha_factor utility in the widget code. Differential Revision: https://developer.blender.org/D8975 --- source/blender/editors/interface/interface_layout.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to '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 f8b9f4f0df1..ab641dc74fe 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -5239,26 +5239,19 @@ static bool block_search_filter_tag_buttons(uiBlock *block, const char *search_f LISTBASE_FOREACH (uiLayoutRoot *, root, &block->layouts) { LISTBASE_FOREACH (uiButtonGroup *, button_group, &root->button_groups) { if (button_group_has_search_match(button_group, search_filter)) { + has_result = true; + } + else { LISTBASE_FOREACH (LinkData *, link, &button_group->buttons) { uiBut *but = link->data; - but->flag |= UI_SEARCH_FILTER_MATCHES; + but->flag |= UI_SEARCH_FILTER_NO_MATCH; } - has_result = true; } } } return has_result; } -static void block_search_deactivate_buttons(uiBlock *block) -{ - LISTBASE_FOREACH (uiBut *, but, &block->buttons) { - if (!(but->flag & UI_SEARCH_FILTER_MATCHES)) { - but->flag |= UI_BUT_INACTIVE; - } - } -} - /** * Apply property search behavior, setting panel flags and deactivating buttons that don't match. * @@ -5284,10 +5277,6 @@ bool UI_block_apply_search_filter(uiBlock *block, const char *search_filter) } } - if (!panel_label_matches) { - block_search_deactivate_buttons(block); - } - return has_result; } -- cgit v1.2.3