From 1112f49a14ba3bdf2c960a61a1975458e3ee986f Mon Sep 17 00:00:00 2001 From: Pablo Vazquez Date: Tue, 10 Jul 2018 00:47:08 +0200 Subject: UI: Cleanup - Remove Show Panel Header and Background A toggle for this is no longer required now that both header and background colors are RGBA (disabling Show Header is the same setting the alpha to 0). Thanks Brecht for reviewing! --- .../blender/editors/interface/interface_layout.c | 20 ++++--- source/blender/editors/interface/interface_panel.c | 63 ++++++---------------- source/blender/editors/interface/resources.c | 8 --- 3 files changed, 26 insertions(+), 65 deletions(-) (limited to 'source/blender/editors/interface') diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index 16016a799ef..159e8b1d022 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -4326,7 +4326,7 @@ void UI_menutype_draw(bContext *C, MenuType *mt, struct uiLayout *layout) static void ui_paneltype_draw_impl( - bContext *C, PanelType *pt, uiLayout *layout, bool show_header) + bContext *C, PanelType *pt, uiLayout *layout) { Panel *panel = MEM_callocN(sizeof(Panel), "popover panel"); panel->type = pt; @@ -4335,15 +4335,13 @@ static void ui_paneltype_draw_impl( uiLayout *last_item = layout->items.last; /* Draw main panel. */ - if (show_header) { - uiLayout *row = uiLayoutRow(layout, false); - if (pt->draw_header) { - panel->layout = row; - pt->draw_header(C, panel); - panel->layout = NULL; - } - uiItemL(row, pt->label, ICON_NONE); + uiLayout *row = uiLayoutRow(layout, false); + if (pt->draw_header) { + panel->layout = row; + pt->draw_header(C, panel); + panel->layout = NULL; } + uiItemL(row, pt->label, ICON_NONE); panel->layout = layout; pt->draw(C, panel); @@ -4363,7 +4361,7 @@ static void ui_paneltype_draw_impl( } uiLayout *col = uiLayoutColumn(layout, false); - ui_paneltype_draw_impl(C, child_pt, col, true); + ui_paneltype_draw_impl(C, child_pt, col); } } } @@ -4377,7 +4375,7 @@ void UI_paneltype_draw(bContext *C, PanelType *pt, uiLayout *layout) CTX_store_set(C, layout->context); } - ui_paneltype_draw_impl(C, pt, layout, false); + ui_paneltype_draw_impl(C, pt, layout); if (layout->context) { CTX_store_set(C, NULL); diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 27afdcdd202..79d92eedfa3 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -580,9 +580,8 @@ static void ui_draw_panel_dragwidget(unsigned int pos, unsigned int col, const r const int x_ofs = y_ofs; int i_x, i_y; - int col_id = UI_GetThemeValue(TH_PANEL_SHOW_HEADER) ? TH_PANEL_HEADER : TH_PANEL_BACK; - UI_GetThemeColorShade4fv(col_id, col_tint, col_high); - UI_GetThemeColorShade4fv(col_id, -col_tint, col_dark); + UI_GetThemeColorShade4fv(TH_PANEL_HEADER, col_tint, col_high); + UI_GetThemeColorShade4fv(TH_PANEL_BACK, -col_tint, col_dark); /* draw multiple boxes */ immBegin(GWN_PRIM_TRIS, 4 * 2 * (6 * 2)); @@ -688,43 +687,19 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con GPU_blend(true); - if (UI_GetThemeValue(TH_PANEL_SHOW_HEADER)) { - /* draw with background color */ - immUniformThemeColor(TH_PANEL_HEADER); - immRectf(pos, minx, headrect.ymin, maxx, y); + /* draw with background color */ + immUniformThemeColor(TH_PANEL_HEADER); + immRectf(pos, minx, headrect.ymin, maxx, y); - immBegin(GWN_PRIM_LINES, 4); + immBegin(GWN_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(); - } - else if (!(panel->runtime_flag & PNL_FIRST)) { - /* draw embossed separator */ - - if (is_closed_x == false) { - minx += 5.0f / block->aspect; - maxx -= 5.0f / block->aspect; - } - - immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); - - immBegin(GWN_PRIM_LINES, 2); - immVertex2f(pos, minx, y); - immVertex2f(pos, maxx, y); - immEnd(); - - immUniformColor4f(1.0f, 1.0f, 1.0f, 0.25f); - - immBegin(GWN_PRIM_LINES, 2); - immVertex2f(pos, minx, y - 1); - immVertex2f(pos, maxx, y - 1); - immEnd(); - } + immEnd(); GPU_blend(false); } @@ -798,17 +773,13 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); + GPU_blend(true); + /* panel backdrop */ - if (is_subpanel) { - GPU_blend(true); - immUniformThemeColor(TH_PANEL_SUB_BACK); - immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax); - } - else if (UI_GetThemeValue(TH_PANEL_SHOW_BACK)) { - GPU_blend(true); - immUniformThemeColor(TH_PANEL_BACK); - immRectf(pos, rect->xmin, rect->ymin, rect->xmax, rect->ymax); - } + 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); if (panel->control & UI_PNL_SCALE) ui_draw_panel_scalewidget(pos, rect); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index 3a67b8ff0ba..aa71c31c541 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -260,14 +260,6 @@ const unsigned char *UI_ThemeGetColorPtr(bTheme *btheme, int spacetype, int colo cp = ts->panelcolors.back; break; case TH_PANEL_SUB_BACK: cp = ts->panelcolors.sub_back; break; - case TH_PANEL_SHOW_HEADER: - cp = &setting; - setting = ts->panelcolors.show_header; - break; - case TH_PANEL_SHOW_BACK: - cp = &setting; - setting = ts->panelcolors.show_back; - break; case TH_BUTBACK: cp = ts->button; break; -- cgit v1.2.3