[Bf-blender-cvs] [acec2a92efb] blender2.8: Pose-mode drawing used alpha where it shouldn't

Campbell Barton noreply at git.blender.org
Thu Apr 27 11:27:43 CEST 2017


Commit: acec2a92efb1cd5b9cfb3700e3df7affd8741188
Author: Campbell Barton
Date:   Thu Apr 27 19:31:19 2017 +1000
Branches: blender2.8
https://developer.blender.org/rBacec2a92efb1cd5b9cfb3700e3df7affd8741188

Pose-mode drawing used alpha where it shouldn't

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

M	source/blender/draw/intern/draw_armature.c
M	source/blender/editors/include/UI_resources.h
M	source/blender/editors/interface/resources.c
M	source/blenderplayer/bad_level_call_stubs/stubs.c

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

diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c
index 535a398bb35..676170de64e 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -181,20 +181,24 @@ static void update_color(const float const_color[4])
 {
 	g_theme.const_color = const_color;
 
-	UI_GetThemeColor4fv(TH_SELECT, g_theme.select_color);
-	UI_GetThemeColor4fv(TH_EDGE_SELECT, g_theme.edge_select_color);
-	UI_GetThemeColorShade4fv(TH_EDGE_SELECT, -20, g_theme.bone_select_color);
-	UI_GetThemeColor4fv(TH_WIRE, g_theme.wire_color);
-	UI_GetThemeColor4fv(TH_WIRE_EDIT, g_theme.wire_edit_color);
-	UI_GetThemeColor4fv(TH_BONE_SOLID, g_theme.bone_solid_color);
-	UI_GetThemeColorBlendShade4fv(TH_WIRE_EDIT, TH_EDGE_SELECT, 0.15f, 0, g_theme.bone_active_unselect_color);
-	UI_GetThemeColor4fv(TH_BONE_POSE, g_theme.bone_pose_color);
-	UI_GetThemeColor4fv(TH_BONE_POSE_ACTIVE, g_theme.bone_pose_active_color);
-	UI_GetThemeColorBlendShade4fv(TH_WIRE, TH_BONE_POSE, 0.15f, 0, g_theme.bone_pose_active_unselect_color);
-	UI_GetThemeColor4fv(TH_TEXT_HI, g_theme.text_hi_color);
-	UI_GetThemeColor4fv(TH_TEXT, g_theme.text_color);
-	UI_GetThemeColor4fv(TH_VERTEX_SELECT, g_theme.vertex_select_color);
-	UI_GetThemeColor4fv(TH_VERTEX, g_theme.vertex_color);
+#define NO_ALPHA(c) (((c)[3] = 1.0f), (c))
+
+	UI_GetThemeColor3fv(TH_SELECT, NO_ALPHA(g_theme.select_color));
+	UI_GetThemeColor3fv(TH_EDGE_SELECT, NO_ALPHA(g_theme.edge_select_color));
+	UI_GetThemeColorShade3fv(TH_EDGE_SELECT, -20, NO_ALPHA(g_theme.bone_select_color));
+	UI_GetThemeColor3fv(TH_WIRE, NO_ALPHA(g_theme.wire_color));
+	UI_GetThemeColor3fv(TH_WIRE_EDIT, NO_ALPHA(g_theme.wire_edit_color));
+	UI_GetThemeColor3fv(TH_BONE_SOLID, NO_ALPHA(g_theme.bone_solid_color));
+	UI_GetThemeColorBlendShade3fv(TH_WIRE_EDIT, TH_EDGE_SELECT, 0.15f, 0, NO_ALPHA(g_theme.bone_active_unselect_color));
+	UI_GetThemeColor3fv(TH_BONE_POSE, NO_ALPHA(g_theme.bone_pose_color));
+	UI_GetThemeColor3fv(TH_BONE_POSE_ACTIVE, NO_ALPHA(g_theme.bone_pose_active_color));
+	UI_GetThemeColorBlendShade3fv(TH_WIRE, TH_BONE_POSE, 0.15f, 0, NO_ALPHA(g_theme.bone_pose_active_unselect_color));
+	UI_GetThemeColor3fv(TH_TEXT_HI, NO_ALPHA(g_theme.text_hi_color));
+	UI_GetThemeColor3fv(TH_TEXT, NO_ALPHA(g_theme.text_color));
+	UI_GetThemeColor3fv(TH_VERTEX_SELECT, NO_ALPHA(g_theme.vertex_select_color));
+	UI_GetThemeColor3fv(TH_VERTEX, NO_ALPHA(g_theme.vertex_color));
+
+#undef NO_ALPHA
 }
 
 static const float *get_bone_solid_color(const EditBone *eBone, const bPoseChannel *pchan, const bArmature *arm)
diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h
index d13d1329721..ac657a4ac73 100644
--- a/source/blender/editors/include/UI_resources.h
+++ b/source/blender/editors/include/UI_resources.h
@@ -363,6 +363,7 @@ void	UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset,
 void    UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset, unsigned char col[4]);
 
 // get four color values, range 0.0-1.0, complete with shading offset for the RGB components and blending
+void    UI_GetThemeColorBlendShade3fv(int colorid1, int colorid2, float fac, int offset, float col[3]);
 void    UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int offset, float col[4]);
 
 // get the 3 or 4 byte values
diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c
index 412e9d1293e..e8eda567a4a 100644
--- a/source/blender/editors/interface/resources.c
+++ b/source/blender/editors/interface/resources.c
@@ -1563,6 +1563,28 @@ void UI_GetThemeColorShadeAlpha4fv(int colorid, int coloffset, int alphaoffset,
 	col[3] = ((float)a) / 255.0f;
 }
 
+void UI_GetThemeColorBlendShade3fv(int colorid1, int colorid2, float fac, int offset, float col[3])
+{
+	int r, g, b;
+	const unsigned char *cp1, *cp2;
+
+	cp1 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid1);
+	cp2 = UI_ThemeGetColorPtr(theme_active, theme_spacetype, colorid2);
+
+	CLAMP(fac, 0.0f, 1.0f);
+
+	r = offset + floorf((1.0f - fac) * cp1[0] + fac * cp2[0]);
+	CLAMP(r, 0, 255);
+	g = offset + floorf((1.0f - fac) * cp1[1] + fac * cp2[1]);
+	CLAMP(g, 0, 255);
+	b = offset + floorf((1.0f - fac) * cp1[2] + fac * cp2[2]);
+	CLAMP(b, 0, 255);
+
+	col[0] = ((float)r) / 255.0f;
+	col[1] = ((float)g) / 255.0f;
+	col[2] = ((float)b) / 255.0f;
+}
+
 void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int offset, float col[4])
 {
 	int r, g, b, a;
diff --git a/source/blenderplayer/bad_level_call_stubs/stubs.c b/source/blenderplayer/bad_level_call_stubs/stubs.c
index 858e1de9176..4a6edb97cee 100644
--- a/source/blenderplayer/bad_level_call_stubs/stubs.c
+++ b/source/blenderplayer/bad_level_call_stubs/stubs.c
@@ -607,6 +607,7 @@ 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
+void UI_GetThemeColorBlendShade3fv(int colorid1, int colorid2, float fac, int offset, float col[3]) RET_NONE
 void UI_GetThemeColorBlendShade4fv(int colorid1, int colorid2, float fac, int offset, float col[4]) RET_NONE
 void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3]) RET_NONE
 void UI_GetThemeColorShadeAlpha4ubv(int colorid, int coloffset, int alphaoffset, unsigned char col[4]) RET_NONE




More information about the Bf-blender-cvs mailing list