Fix T59505: Knife tool cut preview line becomes black

The real reason for the problem is still unknown, but this solution adds less overhead than rBdafaa6f22881.
This commit is contained in:
Germano Cavalcante 2018-12-23 23:32:56 -02:00
parent 34a538ba1b
commit 67dc68d104
Notes: blender-bot 2023-02-14 07:25:46 +01:00
Referenced by issue #59505, Knife tool cut preview line becomes black.
3 changed files with 17 additions and 6 deletions

View 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

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

View 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;
}