Property Search: Fix matches in headers not used for expansion

Setting the search match flag every time property search runs can
invalidate the results for panel headers. Instead, clear the flag on
every redraw and or the result of every search in the panel to it.
This commit is contained in:
Hans Goudey 2020-09-23 16:24:20 -05:00
parent 23e4bbefae
commit 15afaa3db2
3 changed files with 18 additions and 13 deletions

View File

@ -820,7 +820,7 @@ extern void ui_draw_aligned_panel(const struct uiStyle *style,
const bool show_pin,
const bool show_background,
const bool region_search_filter_active);
void ui_panel_set_search_filter_match(struct Panel *panel, const bool value);
void ui_panel_tag_search_filter_match(struct Panel *panel);
/* interface_draw.c */
extern void ui_draw_dropshadow(

View File

@ -5338,7 +5338,9 @@ bool UI_block_apply_search_filter(uiBlock *block)
block_search_remove_search_only_roots(block);
if (block->panel != NULL) {
ui_panel_set_search_filter_match(block->panel, has_result);
if (has_result) {
ui_panel_tag_search_filter_match(block->panel);
}
}
if (!panel_label_matches) {

View File

@ -813,9 +813,9 @@ static void ui_offset_panel_block(uiBlock *block)
block->rect.xmin = block->rect.ymin = 0.0;
}
void ui_panel_set_search_filter_match(struct Panel *panel, const bool value)
void ui_panel_tag_search_filter_match(struct Panel *panel)
{
SET_FLAG_FROM_TEST(panel->runtime_flag, value, PANEL_SEARCH_FILTER_MATCH);
panel->runtime_flag |= PANEL_SEARCH_FILTER_MATCH;
}
static void panel_matches_search_filter_recursive(const Panel *panel, bool *filter_matches)
@ -1884,24 +1884,27 @@ static void ui_do_animate(bContext *C, Panel *panel)
}
}
static void panel_list_clear_active(ListBase *lb)
static void panels_layout_begin_clear_flags(ListBase *lb)
{
LISTBASE_FOREACH (Panel *, panel, lb) {
if (panel->runtime_flag & PANEL_ACTIVE) {
panel->runtime_flag = PANEL_WAS_ACTIVE;
}
else {
panel->runtime_flag = 0;
/* Flags to copy over to the next layout pass. */
const short flag_copy = 0;
const bool was_active = panel->runtime_flag & PANEL_ACTIVE;
panel->runtime_flag &= flag_copy;
if (was_active) {
panel->runtime_flag |= PANEL_WAS_ACTIVE;
}
panel_list_clear_active(&panel->children);
panels_layout_begin_clear_flags(&panel->children);
}
}
void UI_panels_begin(const bContext *UNUSED(C), ARegion *region)
{
/* Set all panels as inactive, so that at the end we know which ones were used. */
panel_list_clear_active(&region->panels);
/* Set all panels as inactive, so that at the end we know which ones were used. Also
* clear other flags so we know later that their values were set for th current redraw. */
panels_layout_begin_clear_flags(&region->panels);
}
void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y)