diff options
author | Campbell Barton <ideasman42@gmail.com> | 2017-04-27 12:31:19 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2017-04-27 12:31:19 +0300 |
commit | acec2a92efb1cd5b9cfb3700e3df7affd8741188 (patch) | |
tree | 2adbff9660ab6fd6a8914ed68ff81cb951dc1937 /source | |
parent | a845fc0d399deafe54cd1f70e97a97b7588be94d (diff) |
Pose-mode drawing used alpha where it shouldn't
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/intern/draw_armature.c | 32 | ||||
-rw-r--r-- | source/blender/editors/include/UI_resources.h | 1 | ||||
-rw-r--r-- | source/blender/editors/interface/resources.c | 22 | ||||
-rw-r--r-- | source/blenderplayer/bad_level_call_stubs/stubs.c | 1 |
4 files changed, 42 insertions, 14 deletions
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 |