diff options
author | Pablo Vazquez <venomgfx@gmail.com> | 2018-07-10 01:47:08 +0300 |
---|---|---|
committer | Pablo Vazquez <venomgfx@gmail.com> | 2018-07-10 01:47:08 +0300 |
commit | 1112f49a14ba3bdf2c960a61a1975458e3ee986f (patch) | |
tree | cfbce6cac6a13efc991b7e03a341be1182c910e1 /source/blender | |
parent | 8373544df30a0e24b080a03c4d4c0b5108c4932d (diff) |
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!
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/include/UI_resources.h | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 20 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 63 | ||||
-rw-r--r-- | source/blender/editors/interface/resources.c | 8 | ||||
-rw-r--r-- | source/blender/makesdna/DNA_userdef_types.h | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 8 |
6 files changed, 27 insertions, 77 deletions
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index cab0fa8645d..5e6c346d9cf 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -75,8 +75,6 @@ typedef enum ThemeColorID { TH_PANEL_HEADER, TH_PANEL_BACK, TH_PANEL_SUB_BACK, - TH_PANEL_SHOW_HEADER, - TH_PANEL_SHOW_BACK, TH_BUTBACK, TH_BUTBACK_TEXT, 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; diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index d2782dee9ff..1e199904356 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -156,8 +156,7 @@ typedef struct uiPanelColors { char header[4]; char back[4]; char sub_back[4]; - short show_header; - short show_back; + char pad2[4]; } uiPanelColors; typedef struct uiGradientColors { diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index f088ac9f442..aa6eb4c4dc2 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1029,14 +1029,6 @@ static void rna_def_userdef_theme_ui_panel(BlenderRNA *brna) prop = RNA_def_property(srna, "sub_back", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_ui_text(prop, "Sub Background", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); - - prop = RNA_def_property(srna, "show_header", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Show Header", ""); - RNA_def_property_update(prop, 0, "rna_userdef_update"); - - prop = RNA_def_property(srna, "show_back", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_ui_text(prop, "Show Background", ""); - RNA_def_property_update(prop, 0, "rna_userdef_update"); } static void rna_def_userdef_theme_ui_gradient(BlenderRNA *brna) |