diff options
author | Hans Goudey <h.goudey@me.com> | 2020-10-03 19:25:13 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-10-03 19:25:13 +0300 |
commit | cb6234fccf7dfd3e09555cac18357427d802be1d (patch) | |
tree | 7d7b97232f84b0cce218e7b8635032ed67875eb5 /source/blender/editors/screen/area.c | |
parent | 724370b2f9727c007b911c036183b844dbc2ab59 (diff) |
Property Search: Set panel expansion when tab changes
This commit makes the panel expansion set based on the search results
when the active tab in the properties editor changes. The multi-tab
search patch (D8859) actually doesn't handle this because it uses a
different code path.
This feature uncovered a subtle but fairly significant issue with the
implementation of property search (More details in T81113). Basically,
the search needed multiple redraws to properly display the expansion of
panels based on the search results. Because there is no animation of
panel expansion when switching tabs, the problem was exposed only now.
With this commit, hiding of "search only" buttons and panel size
calculation happens in a single final step of the panel layout pass.
The "search only" layout root flag is removed. Instead every button
inside a panel header is in a single "uiButtonGroup" marked with a
specific "in header" flag, an idea which could be generalized in the
future.
Differential Revision: https://developer.blender.org/D9006
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r-- | source/blender/editors/screen/area.c | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 7b41b1df0ab..6fa9d203bba 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -2610,8 +2610,7 @@ static void ed_panel_draw(const bContext *C, int w, int em, char *unique_panel_str, - const char *search_filter, - bool search_only) + const char *search_filter) { const uiStyle *style = UI_style_get_dpi(); @@ -2624,7 +2623,6 @@ static void ed_panel_draw(const bContext *C, strncat(block_name, unique_panel_str, INSTANCED_PANEL_UNIQUE_STR_LEN); } uiBlock *block = UI_block_begin(C, region, block_name, UI_EMBOSS); - UI_block_set_search_only(block, search_only); bool open; panel = UI_panel_begin(region, lb, block, pt, panel, &open); @@ -2635,6 +2633,7 @@ static void ed_panel_draw(const bContext *C, int xco, yco, h = 0; int headerend = w - UI_UNIT_X; + UI_panel_header_buttons_begin(panel); if (pt->draw_header_preset && !(pt->flag & PNL_NO_HEADER)) { /* for preset menu */ panel->layout = UI_block_layout(block, @@ -2646,7 +2645,6 @@ static void ed_panel_draw(const bContext *C, 1, 0, style); - uiLayoutRootSetSearchOnly(panel->layout, search_only); pt->draw_header_preset(C, panel); @@ -2678,7 +2676,6 @@ static void ed_panel_draw(const bContext *C, panel->layout = UI_block_layout( block, UI_LAYOUT_HORIZONTAL, UI_LAYOUT_HEADER, labelx, labely, UI_UNIT_Y, 1, 0, style); } - uiLayoutRootSetSearchOnly(panel->layout, search_only); pt->draw_header(C, panel); @@ -2690,6 +2687,7 @@ static void ed_panel_draw(const bContext *C, else { panel->labelofs = 0; } + UI_panel_header_buttons_end(panel); if (open || search_filter_active) { short panelContext; @@ -2715,7 +2713,6 @@ static void ed_panel_draw(const bContext *C, em, 0, style); - uiLayoutRootSetSearchOnly(panel->layout, search_only || !open); pt->draw(C, panel); @@ -2745,13 +2742,12 @@ static void ed_panel_draw(const bContext *C, w, em, unique_panel_str, - search_filter, - !open); + search_filter); } } } - UI_panel_end(region, block, w, h, open); + UI_panel_end(panel, w, h); } /** @@ -2921,8 +2917,7 @@ void ED_region_panels_layout_ex(const bContext *C, (pt->flag & PNL_DRAW_BOX) ? w_box_panel : w, em, NULL, - search_filter, - false); + search_filter); } /* Draw "polyinstantaited" panels that don't have a 1 to 1 correspondence with their types. */ @@ -2956,8 +2951,7 @@ void ED_region_panels_layout_ex(const bContext *C, (panel->type->flag & PNL_DRAW_BOX) ? w_box_panel : w, em, unique_panel_str, - search_filter, - false); + search_filter); } } |