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 | |
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!
-rw-r--r-- | release/datafiles/userdef/userdef_default_theme.c | 34 | ||||
-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 |
7 files changed, 27 insertions, 111 deletions
diff --git a/release/datafiles/userdef/userdef_default_theme.c b/release/datafiles/userdef/userdef_default_theme.c index 2b84585b8a5..e8c8f051c07 100644 --- a/release/datafiles/userdef/userdef_default_theme.c +++ b/release/datafiles/userdef/userdef_default_theme.c @@ -265,8 +265,6 @@ const bTheme U_theme_default = { .header = RGBA(0x42424200), .back = RGBA(0x00000028), .sub_back = RGBA(0x00000024), - .show_header = 1, - .show_back = 1, }, .vertex_size = 3, .outline_width = 1, @@ -291,8 +289,6 @@ const bTheme U_theme_default = { .header = RGBA(0x424242e6), .back = RGBA(0x333333f0), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .gradients = { .gradient = RGBA(0x39393900), @@ -384,8 +380,6 @@ const bTheme U_theme_default = { .header = RGBA(0x424242cc), .back = RGBA(0x333333b3), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .hilite = RGBA(0x4f76b3ff), .vertex_size = 3, @@ -416,8 +410,6 @@ const bTheme U_theme_default = { .header = RGBA(0x424242cc), .back = RGBA(0x333333b3), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .shade1 = RGBA(0x96969600), .shade2 = RGBA(0x2e2e2e64), @@ -464,8 +456,6 @@ const bTheme U_theme_default = { .header = RGBA(0x424242cc), .back = RGBA(0x333333b3), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .vertex_size = 3, .outline_width = 1, @@ -504,8 +494,6 @@ const bTheme U_theme_default = { .header = RGBA(0x424242cc), .back = RGBA(0x333333b3), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .shade1 = RGBA(0xc0c0c000), .shade2 = RGBA(0x70707064), @@ -559,8 +547,6 @@ const bTheme U_theme_default = { .header = RGBA(0x424242cc), .back = RGBA(0x333333b3), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .shade1 = RGBA(0x96969600), .grid = RGBA(0x5e5e5eff), @@ -604,8 +590,6 @@ const bTheme U_theme_default = { .header = RGBA(0x424242cc), .back = RGBA(0x333333b3), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .shade1 = RGBA(0xa0a0a000), .grid = RGBA(0x404040ff), @@ -648,8 +632,6 @@ const bTheme U_theme_default = { .header = RGBA(0x424242cc), .back = RGBA(0x333333b3), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .wire_edit = RGBA(0xc0c0c0ff), .vertex_select = RGBA(0xff8500ff), @@ -704,8 +686,6 @@ const bTheme U_theme_default = { .header = RGBA(0x42424200), .back = RGBA(0x333333b3), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .shade2 = RGBA(0x19191aff), .hilite = RGBA(0xff0000ff), @@ -742,8 +722,6 @@ const bTheme U_theme_default = { .header = RGBA(0x424242cc), .back = RGBA(0x333333b3), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .vertex_size = 3, .outline_width = 1, @@ -780,8 +758,6 @@ const bTheme U_theme_default = { .header = RGBA(0x424242cc), .back = RGBA(0x333333b3), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .shade2 = RGBA(0x7f707064), .wire = RGBA(0x808080ff), @@ -833,8 +809,6 @@ const bTheme U_theme_default = { .header = RGBA(0x42424200), .back = RGBA(0x333333b3), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .vertex_size = 3, .outline_width = 1, @@ -860,8 +834,6 @@ const bTheme U_theme_default = { .header = RGBA(0x424242cc), .back = RGBA(0x333333b3), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .console_output = RGBA(0xb3c2ffff), .console_input = RGBA(0xffffffff), @@ -895,8 +867,6 @@ const bTheme U_theme_default = { .header = RGBA(0x424242cc), .back = RGBA(0x333333b3), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .strip = RGBA(0x0c0a0a80), .strip_select = RGBA(0xff8c00ff), @@ -939,8 +909,6 @@ const bTheme U_theme_default = { .header = RGBA(0x424242cc), .back = RGBA(0x333333b3), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .vertex_size = 3, .outline_width = 1, @@ -965,8 +933,6 @@ const bTheme U_theme_default = { .header = RGBA(0x424242cc), .back = RGBA(0x333333b3), .sub_back = RGBA(0x0000003e), - .show_header = 1, - .show_back = 1, }, .vertex_size = 3, .outline_width = 1, 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) |