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!
This commit is contained in:
Pablo Vazquez 2018-07-10 00:47:08 +02:00
parent 8373544df3
commit 1112f49a14
Notes: blender-bot 2023-02-14 05:36:13 +01:00
Referenced by issue #55924, [2.8] Crash when enabled collection vierport with child collections
Referenced by issue #55903, Crash Bug:  Adjusting the Energy of a Sun Light crashes Blender 2.8
Referenced by issue #55887, Crashed on Shading selection
Referenced by issue #55888, Blender 2.8 eevee crashes when I try to increase shadow cube size and hit render
Referenced by issue #55879, Render preset. crash
Referenced by issue #55880, UV/Image Editor
Referenced by issue #55881, Eevee/viewport not loading multiview EXR texture
Referenced by issue #55882, Crash: Sidebar (N) > Opening, Moving & Closing User Preferences Window
Referenced by issue #55884, Blender crashes after selecting one of the options for color at World tab
Referenced by issue #55871, Creating Armature > Single Bone makes 1st Mesh Object in Scene Invisible when Selected.
7 changed files with 27 additions and 111 deletions

View File

@ -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,

View File

@ -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,

View File

@ -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);

View File

@ -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);

View File

@ -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;

View File

@ -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 {

View File

@ -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)