diff options
author | Hans Goudey <h.goudey@me.com> | 2020-09-15 23:34:27 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-09-15 23:34:27 +0300 |
commit | 8aab26b3b3761108bb21b872738f8d324c2f860f (patch) | |
tree | 40b0e90cf175036221a86885f5b8bb83c61ad33b /source/blender/editors/interface/interface_panel.c | |
parent | 2eec6ec793386cef522193f69e2790a4bd301391 (diff) |
UI: Refactor some list panel expansion code
This commit moves the "get panel expansion from list data" function to
UI_panels_end, which is an improvement because it's more centralized.
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index c11e4397b4c..f956a34def9 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -522,6 +522,19 @@ void UI_panel_set_expand_from_list_data(const bContext *C, Panel *panel) } /** + * Set expansion based on the data for instanced panels. + */ +static void region_panels_set_expansion_from_list_data(const bContext *C, ARegion *region) +{ + LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { + PanelType *panel_type = panel->type; + if (panel_type != NULL && panel->type->flag & PNL_INSTANCED) { + UI_panel_set_expand_from_list_data(C, panel); + } + } +} + +/** * Recursive implementation for #set_panels_list_data_expand_flag. */ static void get_panel_expand_flag(Panel *panel, short *flag, short *flag_index) @@ -1898,6 +1911,8 @@ void UI_panels_end(const bContext *C, ARegion *region, int *r_x, int *r_y) { ScrArea *area = CTX_wm_area(C); + region_panels_set_expansion_from_list_data(C, region); + /* offset contents */ LISTBASE_FOREACH (uiBlock *, block, ®ion->uiblocks) { if (block->active && block->panel) { |