Fix T50976: Blender UI problems with certain theme files.
Core of the issue was that some of our Theme colors are RGB-only, but were loaded as RGBA. Note that tracking all possible cases is pretty impossible, so we'll have to tackle those as they get reported am afraid.
This commit is contained in:
@@ -414,7 +414,8 @@ void UI_draw_icon_tri(float x, float y, char dir, const float color[4])
|
|||||||
static void ui_draw_tria_rect(const rctf *rect, char dir)
|
static void ui_draw_tria_rect(const rctf *rect, char dir)
|
||||||
{
|
{
|
||||||
float color[4];
|
float color[4];
|
||||||
UI_GetThemeColor4fv(TH_TITLE, color);
|
UI_GetThemeColor3fv(TH_TITLE, color);
|
||||||
|
color[3] = 1.0f;
|
||||||
|
|
||||||
if (dir == 'h') {
|
if (dir == 'h') {
|
||||||
float half = 0.5f * BLI_rctf_size_y(rect);
|
float half = 0.5f * BLI_rctf_size_y(rect);
|
||||||
@@ -553,7 +554,8 @@ static void ui_draw_aligned_panel_header(uiStyle *style, uiBlock *block, const r
|
|||||||
pnl_icons = (panel->labelofs + PNL_ICON + 5) / block->aspect + 0.001f;
|
pnl_icons = (panel->labelofs + PNL_ICON + 5) / block->aspect + 0.001f;
|
||||||
|
|
||||||
/* draw text label */
|
/* draw text label */
|
||||||
UI_GetThemeColor4ubv(TH_TITLE, col_title);
|
UI_GetThemeColor3ubv(TH_TITLE, col_title);
|
||||||
|
col_title[3] = 255;
|
||||||
|
|
||||||
hrect = *rect;
|
hrect = *rect;
|
||||||
if (dir == 'h') {
|
if (dir == 'h') {
|
||||||
@@ -718,7 +720,7 @@ void ui_draw_aligned_panel(uiStyle *style, uiBlock *block, const rcti *rect, con
|
|||||||
if (panel->control & UI_PNL_CLOSE) {
|
if (panel->control & UI_PNL_CLOSE) {
|
||||||
const int ofsx = 6;
|
const int ofsx = 6;
|
||||||
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
|
||||||
immUniformThemeColor(TH_TITLE);
|
immUniformThemeColor3(TH_TITLE);
|
||||||
ui_draw_x_icon(pos, rect->xmin + 2 + ofsx, rect->ymax + 2);
|
ui_draw_x_icon(pos, rect->xmin + 2 + ofsx, rect->ymax + 2);
|
||||||
immUnbindProgram();
|
immUnbindProgram();
|
||||||
}
|
}
|
||||||
|
@@ -47,6 +47,7 @@ void immBindBuiltinProgram(GPUBuiltinShader shader_id);
|
|||||||
* Extend immUniformColor to take Blender's themes
|
* Extend immUniformColor to take Blender's themes
|
||||||
*/
|
*/
|
||||||
void immUniformThemeColor(int color_id);
|
void immUniformThemeColor(int color_id);
|
||||||
|
void immUniformThemeColor3(int color_id);
|
||||||
void immUniformThemeColorShade(int color_id, int offset);
|
void immUniformThemeColorShade(int color_id, int offset);
|
||||||
void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset);
|
void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset);
|
||||||
void immUniformThemeColorBlendShade(int color_id1, int color_id2, float fac, int offset);
|
void immUniformThemeColorBlendShade(int color_id1, int color_id2, float fac, int offset);
|
||||||
|
@@ -45,6 +45,13 @@ void immUniformThemeColor(int color_id)
|
|||||||
immUniformColor4fv(color);
|
immUniformColor4fv(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void immUniformThemeColor3(int color_id)
|
||||||
|
{
|
||||||
|
float color[3];
|
||||||
|
UI_GetThemeColor3fv(color_id, color);
|
||||||
|
immUniformColor3fv(color);
|
||||||
|
}
|
||||||
|
|
||||||
void immUniformThemeColorShade(int color_id, int offset)
|
void immUniformThemeColorShade(int color_id, int offset)
|
||||||
{
|
{
|
||||||
float color[4];
|
float color[4];
|
||||||
|
@@ -600,6 +600,7 @@ const char *uiLayoutIntrospect(uiLayout *layout) RET_NULL
|
|||||||
void UI_reinit_font(void) RET_NONE
|
void UI_reinit_font(void) RET_NONE
|
||||||
int UI_rnaptr_icon_get(struct bContext *C, struct PointerRNA *ptr, int rnaicon, const bool big) RET_ZERO
|
int UI_rnaptr_icon_get(struct bContext *C, struct PointerRNA *ptr, int rnaicon, const bool big) RET_ZERO
|
||||||
struct bTheme *UI_GetTheme(void) RET_NULL
|
struct bTheme *UI_GetTheme(void) RET_NULL
|
||||||
|
void UI_GetThemeColor3fv(int colorid, float col[4]) RET_NONE
|
||||||
void UI_GetThemeColor4fv(int colorid, float col[4]) RET_NONE
|
void UI_GetThemeColor4fv(int colorid, float col[4]) RET_NONE
|
||||||
void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4]) RET_NONE
|
void UI_GetThemeColorShade4fv(int colorid, int offset, float col[4]) RET_NONE
|
||||||
void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4]) RET_NONE
|
void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4]) RET_NONE
|
||||||
|
Reference in New Issue
Block a user