[Bf-blender-cvs] [1f6037c8878] blender2.8: Fix T50976: Blender UI problems with certain theme files.

Bastien Montagne noreply at git.blender.org
Wed Apr 5 11:01:39 CEST 2017


Commit: 1f6037c887863e67a5a8b211738e04fd6dce16ad
Author: Bastien Montagne
Date:   Wed Apr 5 10:59:46 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB1f6037c887863e67a5a8b211738e04fd6dce16ad

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.

===================================================================

M	source/blender/editors/interface/interface_panel.c
M	source/blender/gpu/GPU_immediate.h
M	source/blender/gpu/intern/gpu_immediate.c
M	source/blenderplayer/bad_level_call_stubs/stubs.c

===================================================================

diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c
index 6f1d8c36d1f..5030b1d1e73 100644
--- a/source/blender/editors/interface/interface_panel.c
+++ b/source/blender/editors/interface/interface_panel.c
@@ -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)
 {
 	float color[4];
-	UI_GetThemeColor4fv(TH_TITLE, color);
+	UI_GetThemeColor3fv(TH_TITLE, color);
+	color[3] = 1.0f;
 
 	if (dir == 'h') {
 		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;
 
 	/* draw text label */
-	UI_GetThemeColor4ubv(TH_TITLE, col_title);
+	UI_GetThemeColor3ubv(TH_TITLE, col_title);
+	col_title[3] = 255;
 
 	hrect = *rect;
 	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) {
 		const int ofsx = 6;
 		immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
-		immUniformThemeColor(TH_TITLE);
+		immUniformThemeColor3(TH_TITLE);
 		ui_draw_x_icon(pos, rect->xmin + 2 + ofsx, rect->ymax + 2);
 		immUnbindProgram();
 	}
diff --git a/source/blender/gpu/GPU_immediate.h b/source/blender/gpu/GPU_immediate.h
index 35964a81030..28522da5f28 100644
--- a/source/blender/gpu/GPU_immediate.h
+++ b/source/blender/gpu/GPU_immediate.h
@@ -47,6 +47,7 @@ void immBindBuiltinProgram(GPUBuiltinShader shader_id);
  * Extend immUniformColor to take Blender's themes
  */
 void immUniformThemeColor(int color_id);
+void immUniformThemeColor3(int color_id);
 void immUniformThemeColorShade(int color_id, int offset);
 void immUniformThemeColorShadeAlpha(int color_id, int color_offset, int alpha_offset);
 void immUniformThemeColorBlendShade(int color_id1, int color_id2, float fac, int offset);
diff --git a/source/blender/gpu/intern/gpu_immediate.c b/source/blender/gpu/intern/gpu_immediate.c
index 5188ca4c0e2..34d32be15ed 100644
--- a/source/blender/gpu/intern/gpu_immediate.c
+++ b/source/blender/gpu/intern/gpu_immediate.c
@@ -45,6 +45,13 @@ void immUniformThemeColor(int color_id)
 	immUniformColor4fv(color);
 }
 
+void immUniformThemeColor3(int color_id)
+{
+	float color[3];
+	UI_GetThemeColor3fv(color_id, color);
+	immUniformColor3fv(color);
+}
+
 void immUniformThemeColorShade(int color_id, int offset)
 {
 	float color[4];
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 66b7f23c2f9..aa3b89c6fdf 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -600,6 +600,7 @@ const char *uiLayoutIntrospect(uiLayout *layout) RET_NULL
 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
 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_GetThemeColorShade4fv(int colorid, int offset, float col[4]) RET_NONE
 void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset, float col[4]) RET_NONE




More information about the Bf-blender-cvs mailing list