Pose-mode drawing used alpha where it shouldn't

This commit is contained in:
Campbell Barton 2017-04-27 19:31:19 +10:00
parent a845fc0d39
commit acec2a92ef
4 changed files with 42 additions and 14 deletions

View File

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

View File

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

View File

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

View File

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