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.
This commit is contained in:
parent
2eec6ec793
commit
8aab26b3b3
|
@ -521,6 +521,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.
|
||||
*/
|
||||
|
@ -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) {
|
||||
|
|
|
@ -1940,13 +1940,6 @@ void uiTemplateModifiers(uiLayout *UNUSED(layout), bContext *C)
|
|||
|
||||
panel = panel->next;
|
||||
}
|
||||
|
||||
/* The expansion might have been changed elsewhere, so we still need to set it. */
|
||||
LISTBASE_FOREACH (Panel *, panel_iter, ®ion->panels) {
|
||||
if ((panel_iter->type != NULL) && (panel_iter->type->flag & PNL_INSTANCED)) {
|
||||
UI_panel_set_expand_from_list_data(C, panel_iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2114,13 +2107,6 @@ void uiTemplateConstraints(uiLayout *UNUSED(layout), bContext *C, bool use_bone_
|
|||
|
||||
panel = panel->next;
|
||||
}
|
||||
|
||||
/* The expansion might have been changed elsewhere, so we still need to set it. */
|
||||
LISTBASE_FOREACH (Panel *, panel_iter, ®ion->panels) {
|
||||
if ((panel_iter->type != NULL) && (panel_iter->type->flag & PNL_INSTANCED)) {
|
||||
UI_panel_set_expand_from_list_data(C, panel_iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2195,13 +2181,6 @@ void uiTemplateGpencilModifiers(uiLayout *UNUSED(layout), bContext *C)
|
|||
|
||||
panel = panel->next;
|
||||
}
|
||||
|
||||
/* The expansion might have been changed elsewhere, so we still need to set it. */
|
||||
LISTBASE_FOREACH (Panel *, panel_iter, ®ion->panels) {
|
||||
if ((panel_iter->type != NULL) && (panel_iter->type->flag & PNL_INSTANCED)) {
|
||||
UI_panel_set_expand_from_list_data(C, panel_iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2277,13 +2256,6 @@ void uiTemplateShaderFx(uiLayout *UNUSED(layout), bContext *C)
|
|||
|
||||
panel = panel->next;
|
||||
}
|
||||
|
||||
/* The expansion might have been changed elsewhere, so we still need to set it. */
|
||||
LISTBASE_FOREACH (Panel *, panel_iter, ®ion->panels) {
|
||||
if ((panel_iter->type != NULL) && (panel_iter->type->flag & PNL_INSTANCED)) {
|
||||
UI_panel_set_expand_from_list_data(C, panel_iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue