From 5ce6b344d5463f5d0fd764970796ebf57b237e7c Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Thu, 10 Jan 2019 16:51:36 +1100 Subject: 3D View: use faded color for dupli instance wire & points Similar to 2.7x, so instanced geometry can be differentiated. --- source/blender/editors/include/UI_resources.h | 1 + source/blender/editors/interface/resources.c | 14 ++++++++++++++ 2 files changed, 15 insertions(+) (limited to 'source/blender/editors') diff --git a/source/blender/editors/include/UI_resources.h b/source/blender/editors/include/UI_resources.h index d686594f334..74991ad8ab1 100644 --- a/source/blender/editors/include/UI_resources.h +++ b/source/blender/editors/include/UI_resources.h @@ -343,6 +343,7 @@ int UI_GetThemeValueType(int colorid, int spacetype); void UI_GetThemeColor3fv(int colorid, float col[3]); void UI_GetThemeColorBlend3ubv(int colorid1, int colorid2, float fac, unsigned char col[3]); void UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[3]); +void UI_GetThemeColorBlend4f(int colorid1, int colorid2, float fac, float r_col[4]); // get the color, range 0.0-1.0, complete with shading offset void UI_GetThemeColorShade3fv(int colorid, int offset, float col[3]); void UI_GetThemeColorShade3ubv(int colorid, int offset, unsigned char col[3]); diff --git a/source/blender/editors/interface/resources.c b/source/blender/editors/interface/resources.c index d7451b0d0e4..5f132295c04 100644 --- a/source/blender/editors/interface/resources.c +++ b/source/blender/editors/interface/resources.c @@ -864,6 +864,20 @@ void UI_GetThemeColorBlend3f(int colorid1, int colorid2, float fac, float r_col[ r_col[2] = ((1.0f - fac) * cp1[2] + fac * cp2[2]) / 255.0f; } +void UI_GetThemeColorBlend4f(int colorid1, int colorid2, float fac, float r_col[4]) +{ + const uchar *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_col[0] = ((1.0f - fac) * cp1[0] + fac * cp2[0]) / 255.0f; + r_col[1] = ((1.0f - fac) * cp1[1] + fac * cp2[1]) / 255.0f; + r_col[2] = ((1.0f - fac) * cp1[2] + fac * cp2[2]) / 255.0f; + r_col[3] = ((1.0f - fac) * cp1[3] + fac * cp2[3]) / 255.0f; +} + void UI_FontThemeColor(int fontid, int colorid) { uchar color[4]; -- cgit v1.2.3