Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/gpencil/gpencil_utils.c
| Show First 20 Lines • Show All 1,771 Lines • ▼ Show 20 Lines | if (ma) { | ||||
| ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) && | ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE) == 0) && | ||||
| ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0) && | ((brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP) == 0) && | ||||
| (brush->gpencil_tool == GPAINT_TOOL_DRAW)) { | (brush->gpencil_tool == GPAINT_TOOL_DRAW)) { | ||||
| radius = 2.0f; | radius = 2.0f; | ||||
| copy_v3_v3(color, gp_style->stroke_rgba); | copy_v3_v3(color, gp_style->stroke_rgba); | ||||
| } | } | ||||
| else { | else { | ||||
| radius = 5.0f; | radius = 5.0f; | ||||
| copy_v3_v3(color, brush->add_col); | UI_GetThemeColor3fv(TH_PAINT_CURSOR, color); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* for sculpt use sculpt brush size */ | /* for sculpt use sculpt brush size */ | ||||
| if (GPENCIL_SCULPT_OR_WEIGHT_MODE(gpd)) { | if (GPENCIL_SCULPT_OR_WEIGHT_MODE(gpd)) { | ||||
| if (gp_brush) { | if (gp_brush) { | ||||
| if ((gp_brush->flag & GP_SCULPT_FLAG_ENABLE_CURSOR) == 0) { | if ((gp_brush->flag & GP_SCULPT_FLAG_ENABLE_CURSOR) == 0) { | ||||
| return; | return; | ||||
| } | } | ||||
| radius = gp_brush->size; | radius = gp_brush->size; | ||||
| if (gp_brush->flag & (GP_SCULPT_FLAG_INVERT | GP_SCULPT_FLAG_TMP_INVERT)) { | if (gp_brush->flag & (GP_SCULPT_FLAG_INVERT | GP_SCULPT_FLAG_TMP_INVERT)) { | ||||
| copy_v3_v3(color, gp_brush->curcolor_sub); | UI_GetThemeColor3fv(TH_PAINT_CURSOR, gp_brush->curcolor_sub); | ||||
| } | } | ||||
| else { | else { | ||||
| copy_v3_v3(color, gp_brush->curcolor_add); | UI_GetThemeColor3fv(TH_PAINT_CURSOR, gp_brush->curcolor_add); | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| /* draw icon */ | /* draw icon */ | ||||
| GPUVertFormat *format = immVertexFormat(); | GPUVertFormat *format = immVertexFormat(); | ||||
| uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | ||||
| Show All 21 Lines | static void gp_brush_cursor_draw(bContext *C, int x, int y, void *customdata) | ||||
| GPU_blend(false); | GPU_blend(false); | ||||
| GPU_line_smooth(false); | GPU_line_smooth(false); | ||||
| /* Draw line for lazy mouse */ | /* Draw line for lazy mouse */ | ||||
| if ((last_mouse_position) && (brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP)) { | if ((last_mouse_position) && (brush->gpencil_settings->flag & GP_BRUSH_STABILIZE_MOUSE_TEMP)) { | ||||
| GPU_line_smooth(true); | GPU_line_smooth(true); | ||||
| GPU_blend(true); | GPU_blend(true); | ||||
| copy_v3_v3(color, brush->add_col); | immUniformThemeColor(TH_PAINT_CURSOR); | ||||
| immUniformColor4f(color[0], color[1], color[2], 0.8f); | |||||
| immBegin(GPU_PRIM_LINES, 2); | immBegin(GPU_PRIM_LINES, 2); | ||||
| immVertex2f(pos, x, y); | immVertex2f(pos, x, y); | ||||
| immVertex2f( | immVertex2f( | ||||
| pos, last_mouse_position[0] + ar->winrct.xmin, last_mouse_position[1] + ar->winrct.ymin); | pos, last_mouse_position[0] + ar->winrct.xmin, last_mouse_position[1] + ar->winrct.ymin); | ||||
| immEnd(); | immEnd(); | ||||
| GPU_blend(false); | GPU_blend(false); | ||||
| ▲ Show 20 Lines • Show All 740 Lines • Show Last 20 Lines | |||||