[Bf-blender-cvs] [15afaa3db25] master: Property Search: Fix matches in headers not used for expansion

Hans Goudey noreply at git.blender.org
Wed Sep 23 23:24:30 CEST 2020


Commit: 15afaa3db25a2416889abf39b800bca6d16f27d1
Author: Hans Goudey
Date:   Wed Sep 23 16:24:20 2020 -0500
Branches: master
https://developer.blender.org/rB15afaa3db25a2416889abf39b800bca6d16f27d1

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.

===================================================================

M	source/blender/editors/interface/interface_intern.h
M	source/blender/editors/interface/interface_layout.c
M	source/blender/editors/interface/interface_panel.c

===================================================================

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)



More information about the Bf-blender-cvs mailing list