UI: Draw background for headerless panels with region-overlap

These were drawing without a backdrop.
This commit is contained in:
Campbell Barton 2019-05-16 18:06:55 +10:00
parent 6519982876
commit 0e667723d4
2 changed files with 15 additions and 2 deletions

View File

@ -1687,6 +1687,12 @@ void UI_block_draw(const bContext *C, uiBlock *block)
}
else if (block->panel) {
bool show_background = ar->alignment != RGN_ALIGN_FLOAT;
if (show_background) {
if (block->panel->type && (block->panel->type->flag & PNL_NO_HEADER)) {
/* Without a header there is no background except for region overlap. */
show_background = ar->overlap != 0;
}
}
ui_draw_aligned_panel(&style, block, &rect, UI_panel_category_is_visible(ar), show_background);
}

View File

@ -649,8 +649,17 @@ void ui_draw_aligned_panel(uiStyle *style,
/* FIXME(campbell): currently no background means floating panel which
* can't be dragged. This may be changed in future. */
show_background);
const int panel_col = is_subpanel ? TH_PANEL_SUB_BACK : TH_PANEL_BACK;
if (panel->type && (panel->type->flag & PNL_NO_HEADER)) {
if (show_background) {
uint pos = GPU_vertformat_attr_add(
immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(panel_col);
immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
immUnbindProgram();
}
return;
}
@ -781,8 +790,6 @@ void ui_draw_aligned_panel(uiStyle *style,
if (show_background) {
/* panel backdrop */
int panel_col = is_subpanel ? TH_PANEL_SUB_BACK : TH_PANEL_BACK;
immUniformThemeColor(panel_col);
immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax);
}