From 2c2d30df60b3b7afcf8f44d60ec9e00323537d97 Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Mon, 14 Sep 2020 17:33:18 -0500 Subject: Property Search: Apply fixes from all tab code --- source/blender/editors/include/UI_interface.h | 3 +-- source/blender/editors/interface/interface.c | 5 ----- source/blender/editors/interface/interface_layout.c | 6 ++++-- source/blender/editors/screen/area.c | 6 ++++-- source/blender/editors/space_buttons/space_buttons.c | 3 +-- 5 files changed, 10 insertions(+), 13 deletions(-) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 64b4a058ca2..6a0b643fb84 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -674,7 +674,6 @@ enum { void UI_block_theme_style_set(uiBlock *block, char theme_style); char UI_block_emboss_get(uiBlock *block); void UI_block_emboss_set(uiBlock *block, char emboss); -bool UI_block_has_search_filter(const uiBlock *block); bool UI_block_is_search_only(const uiBlock *block); void UI_block_set_search_only(uiBlock *block, bool search_only); void UI_block_set_search_filter(uiBlock *block, const char *search_filter); @@ -1871,7 +1870,7 @@ uiLayout *UI_block_layout(uiBlock *block, void UI_block_layout_set_current(uiBlock *block, uiLayout *layout); void UI_block_layout_resolve(uiBlock *block, int *r_x, int *r_y); -void UI_block_apply_search_filter(uiBlock *block); +bool UI_block_apply_search_filter(uiBlock *block); void UI_region_message_subscribe(struct ARegion *region, struct wmMsgBus *mbus); diff --git a/source/blender/editors/interface/interface.c b/source/blender/editors/interface/interface.c index 98140a2c058..8aa25100b0b 100644 --- a/source/blender/editors/interface/interface.c +++ b/source/blender/editors/interface/interface.c @@ -3509,11 +3509,6 @@ void UI_block_theme_style_set(uiBlock *block, char theme_style) block->theme_style = theme_style; } -bool UI_block_has_search_filter(const uiBlock *block) -{ - return block->search_filter != NULL && block->search_filter[0] != '\0'; -} - bool UI_block_is_search_only(const uiBlock *block) { return block->flag & UI_BLOCK_SEARCH_ONLY; diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 78f2a3ac084..e6b05c97c06 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -5285,10 +5285,10 @@ static void block_search_deactivate_buttons(uiBlock *block) * * \note Must be run before #UI_block_layout_resolve. */ -void UI_block_apply_search_filter(uiBlock *block) +bool UI_block_apply_search_filter(uiBlock *block) { if (!(block->search_filter && block->search_filter[0])) { - return; + return false; } const bool panel_label_matches = block_search_panel_label_matches(block); @@ -5304,6 +5304,8 @@ void UI_block_apply_search_filter(uiBlock *block) if (!panel_label_matches) { block_search_deactivate_buttons(block); } + + return has_result; } /** \} */ diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 81150d78c9e..bc60bf32635 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -2610,6 +2610,8 @@ static void ed_panel_draw(const bContext *C, bool open; panel = UI_panel_begin(region, lb, block, pt, panel, &open); + const bool search_filter_active = search_filter != NULL && search_filter[0] != '\0'; + /* bad fixed values */ int xco, yco, h = 0; int headerend = w - UI_UNIT_X; @@ -2670,7 +2672,7 @@ static void ed_panel_draw(const bContext *C, panel->labelofs = 0; } - if (open || UI_block_has_search_filter(block) || search_only) { + if (open || search_filter_active) { short panelContext; /* panel context can either be toolbar region or normal panels region */ @@ -2710,7 +2712,7 @@ static void ed_panel_draw(const bContext *C, UI_block_end(C, block); /* Draw child panels. */ - if (open || UI_block_has_search_filter(block)) { + if (open || search_filter_active) { LISTBASE_FOREACH (LinkData *, link, &pt->children) { PanelType *child_pt = link->data; Panel *child_panel = UI_panel_find_by_type(&panel->children, child_pt); diff --git a/source/blender/editors/space_buttons/space_buttons.c b/source/blender/editors/space_buttons/space_buttons.c index 390a33d1349..3bac191f9ab 100644 --- a/source/blender/editors/space_buttons/space_buttons.c +++ b/source/blender/editors/space_buttons/space_buttons.c @@ -110,8 +110,7 @@ static void buttons_free(SpaceLink *sl) MEM_freeN(ct); } - BLI_assert(sbuts->runtime != NULL); - MEM_freeN(sbuts->runtime); + MEM_SAFE_FREE(sbuts->runtime); } /* spacetype; init callback */ -- cgit v1.2.3