diff options
author | Hans Goudey <h.goudey@me.com> | 2020-10-02 21:10:21 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-10-02 21:10:21 +0300 |
commit | 933bf62a611f61bd61e3e7745ce6dea58f571e72 (patch) | |
tree | 671de906d3acbea69f32428899bbeb64a009d45c /source/blender/editors/interface/interface_layout.c | |
parent | 6f96dd85766a8159d5ffb761cbb4dbd20b7cad00 (diff) |
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
Diffstat (limited to 'source/blender/editors/interface/interface_layout.c')
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 19 |
1 files changed, 4 insertions, 15 deletions
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; } |