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>2020-09-24 00:24:20 +0300
committerHans Goudey <h.goudey@me.com>2020-09-24 00:24:20 +0300
commit15afaa3db25a2416889abf39b800bca6d16f27d1 (patch)
tree5052e510d97a4a4fa0a562c22fdf710a502a19df /source/blender/editors/interface
parent23e4bbefae26838b7e677ae1676f2f0fe7a30d26 (diff)
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.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r--source/blender/editors/interface/interface_intern.h2
-rw-r--r--source/blender/editors/interface/interface_layout.c4
-rw-r--r--source/blender/editors/interface/interface_panel.c25
3 files changed, 18 insertions, 13 deletions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h
index c233bebd88b..766c8f95565 100644
--- a/source/blender/editors/interface/interface_intern.h
+++ b/source/blender/editors/interface/interface_intern.h
@@ -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(
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 704246621fb..2574279f0cd 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -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) {
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 7bbc2c7e4a7..18b134ced4a 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -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)