[Bf-blender-cvs] [67d6d1363d1] property-search-ui: Property Search: Properly filter box buttons

Hans Goudey noreply at git.blender.org
Tue Jul 7 21:27:45 CEST 2020


Commit: 67d6d1363d18ecb8991f8c008a29e02565b6e037
Author: Hans Goudey
Date:   Tue Jul 7 15:27:29 2020 -0400
Branches: property-search-ui
https://developer.blender.org/rB67d6d1363d18ecb8991f8c008a29e02565b6e037

Property Search: Properly filter box buttons

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

M	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 a904848e637..1705b937f87 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -5357,30 +5357,11 @@ static void ui_block_search_filter_tag_buttons(uiBlock *block)
  */
 static bool ui_layout_search_clean_recursive(uiLayout *layout)
 {
-  /* Remove all search filtered button items. */
-  bool layout_emptied = uiLayoutGetPropSearch(layout);
-  if (uiLayoutGetPropSearch(layout)) {
-    LISTBASE_FOREACH_MUTABLE (uiItem *, item, &layout->items) {
-      if (item->type == ITEM_BUTTON) {
-        uiButtonItem *button_item = (uiButtonItem *)item;
-        uiBut *but = button_item->but;
-        if (but->flag & UI_FILTERED) {
-          but->flag |= UI_HIDDEN;
-          BLI_remlink(&layout->items, item);
-          MEM_freeN(item);
-        }
-        else {
-          layout_emptied = false;
-        }
-      }
-    }
-  }
-
   /* Recursively clean sub-layouts. */
   bool all_children_empty = true;
   LISTBASE_FOREACH_MUTABLE (uiItem *, item, &layout->items) {
+    /* Deal with buttons after checking children. */
     if (item->type == ITEM_BUTTON) {
-      BLI_assert(!layout_emptied || !uiLayoutGetPropSearch(layout));
       continue;
     }
 
@@ -5394,6 +5375,27 @@ static bool ui_layout_search_clean_recursive(uiLayout *layout)
     }
   }
 
+  /* Remove all search filtered button items. */
+  bool layout_emptied = uiLayoutGetPropSearch(layout);
+  if (uiLayoutGetPropSearch(layout)) {
+    LISTBASE_FOREACH_MUTABLE (uiItem *, item, &layout->items) {
+      if (item->type == ITEM_BUTTON) {
+        uiButtonItem *button_item = (uiButtonItem *)item;
+        uiBut *but = button_item->but;
+        if (but->flag & UI_FILTERED) {
+          if (!((but->type == UI_BTYPE_ROUNDBOX) && !all_children_empty)) {
+            but->flag |= UI_HIDDEN;
+            BLI_remlink(&layout->items, item);
+            MEM_freeN(item);
+          }
+        }
+        else {
+          layout_emptied = false;
+        }
+      }
+    }
+  }
+
   return layout_emptied && all_children_empty;
 }



More information about the Bf-blender-cvs mailing list