diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 215b0c3c410..ef43823cc48 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -645,12 +645,15 @@ void ui_draw_aligned_panel(uiStyle *style, const bool is_closed_x = (panel->flag & PNL_CLOSEDX) ? true : false; const bool is_closed_y = (panel->flag & PNL_CLOSEDY) ? true : false; const bool is_subpanel = (panel->type && panel->type->parent); + const bool is_sub_subpanel = (panel->type && panel->type->parent && panel->type->parent->parent); const bool show_drag = (!is_subpanel && /* 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; + const float pad = is_subpanel ? (is_sub_subpanel ? 16.0f * U.dpi_fac : 8.0f * U.dpi_fac) : 4.0f * U.dpi_fac; + if (panel->type && (panel->type->flag & PNL_NO_HEADER)) { if (show_background) { uint pos = GPU_vertformat_attr_add( @@ -677,26 +680,40 @@ void ui_draw_aligned_panel(uiStyle *style, uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); - if (show_background && !is_subpanel) { - float minx = rect->xmin; - float maxx = is_closed_x ? (minx + PNL_HEADER / block->aspect) : rect->xmax; + /* draw panel header */ + if (show_background && !is_closed_y) { + float minx = rect->xmin + pad; + float maxx = is_closed_x ? (minx + PNL_HEADER / block->aspect) : rect->xmax - pad; float y = headrect.ymax; GPU_blend(true); - + /* draw with background color */ - immUniformThemeColor(TH_PANEL_HEADER); - immRectf(pos, minx, headrect.ymin, maxx, y); + float h_col[4]; + UI_GetThemeColor4fv(TH_PANEL_HEADER, h_col); + h_col[3] *= is_subpanel ? (is_sub_subpanel ? 0.3f : 0.6f) : 1.0f; + + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_aa(true, + minx, + headrect.ymin + 1.0f * U.dpi_fac, + maxx, + y - 1.0f * U.dpi_fac, + 4, + h_col); + + // immUniformThemeColor(TH_PANEL_HEADER); + // immRectf(pos, minx, headrect.ymin + 1.0f, maxx, y - 1.0f); - immBegin(GPU_PRIM_LINES, 4); + // immBegin(GPU_PRIM_LINES, 4); - immVertex2f(pos, minx, y); - immVertex2f(pos, maxx, y); + // immVertex2f(pos, minx, y); + // immVertex2f(pos, maxx, y); - immVertex2f(pos, minx, y); - immVertex2f(pos, maxx, y); + // immVertex2f(pos, minx, y); + // immVertex2f(pos, maxx, y); - immEnd(); + // immEnd(); GPU_blend(false); }