Fix T59505: Knife tool cut preview line becomes black
authormano-wii <germano.costa@ig.com.br>
Mon, 24 Dec 2018 01:32:56 +0000 (23:32 -0200)
committermano-wii <germano.costa@ig.com.br>
Tue, 25 Dec 2018 16:36:50 +0000 (14:36 -0200)
The real reason for the problem is still unknown, but this solution adds less overhead than rBdafaa6f22881.

source/blender/editors/include/UI_resources.h
source/blender/editors/interface/resources.c
source/blender/editors/mesh/editmesh_knife.c

index 277aae9..0be8f91 100644 (file)
@@ -369,6 +369,7 @@ void UI_GetThemeColor3ubv(int colorid, unsigned char col[3]);
 void UI_GetThemeColor4ubv(int colorid, unsigned char col[4]);
 
 // get a theme color from specified space type
+void UI_GetThemeColorType3ubv(int colorid, int spacetype, char col[3]);
 void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4]);
 
 // get theme color for coloring monochrome icons
index 09b8933..a30dde3 100644 (file)
@@ -1118,6 +1118,16 @@ void UI_GetThemeColor4ubv(int colorid, unsigned char col[4])
        col[3] = cp[3];
 }
 
+void UI_GetThemeColorType3ubv(int colorid, int spacetype, char col[3])
+{
+       const unsigned char *cp;
+
+       cp = UI_ThemeGetColorPtr(theme_active, spacetype, colorid);
+       col[0] = cp[0];
+       col[1] = cp[1];
+       col[2] = cp[2];
+}
+
 void UI_GetThemeColorType4ubv(int colorid, int spacetype, char col[4])
 {
        const unsigned char *cp;
index b89a7dd..b85627d 100644 (file)
@@ -1027,13 +1027,13 @@ static void knife_init_colors(KnifeColors *colors)
        /* possible BMESH_TODO: add explicit themes or calculate these by
         * figuring out contrasting colors with grid / edges / verts
         * a la UI_make_axis_color */
-       UI_GetThemeColor3ubv(TH_NURB_VLINE, colors->line);
-       UI_GetThemeColor3ubv(TH_NURB_ULINE, colors->edge);
-       UI_GetThemeColor3ubv(TH_HANDLE_SEL_VECT, colors->curpoint);
-       UI_GetThemeColor3ubv(TH_HANDLE_SEL_VECT, colors->curpoint_a);
+       UI_GetThemeColorType3ubv(TH_NURB_VLINE, SPACE_VIEW3D, colors->line);
+       UI_GetThemeColorType3ubv(TH_NURB_ULINE, SPACE_VIEW3D, colors->edge);
+       UI_GetThemeColorType3ubv(TH_HANDLE_SEL_VECT, SPACE_VIEW3D, colors->curpoint);
+       UI_GetThemeColorType3ubv(TH_HANDLE_SEL_VECT, SPACE_VIEW3D, colors->curpoint_a);
        colors->curpoint_a[3] = 102;
-       UI_GetThemeColor3ubv(TH_ACTIVE_SPLINE, colors->point);
-       UI_GetThemeColor3ubv(TH_ACTIVE_SPLINE, colors->point_a);
+       UI_GetThemeColorType3ubv(TH_ACTIVE_SPLINE, SPACE_VIEW3D, colors->point);
+       UI_GetThemeColorType3ubv(TH_ACTIVE_SPLINE, SPACE_VIEW3D, colors->point_a);
        colors->point_a[3] = 102;
 }