Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/paint_cursor.c
| Show First 20 Lines • Show All 1,247 Lines • ▼ Show 20 Lines | if (!ups->stroke_active) { | ||||
| paint_calculate_rake_rotation(ups, brush, translation); | paint_calculate_rake_rotation(ups, brush, translation); | ||||
| } | } | ||||
| /* draw overlay */ | /* draw overlay */ | ||||
| bool alpha_overlay_active = paint_draw_alpha_overlay(ups, brush, &vc, x, y, zoomx, mode); | bool alpha_overlay_active = paint_draw_alpha_overlay(ups, brush, &vc, x, y, zoomx, mode); | ||||
| /* TODO: as sculpt and other paint modes are unified, this | /* TODO: as sculpt and other paint modes are unified, this | ||||
| * special mode of drawing will go away */ | * special mode of drawing will go away */ | ||||
| if ((mode == PAINT_MODE_SCULPT) && vc.obact->sculpt) { | Object *obact = vc.obact; | ||||
| if ((mode == PAINT_MODE_SCULPT) && obact && obact->sculpt) { | |||||
| float location[3]; | float location[3]; | ||||
| int pixel_radius; | int pixel_radius; | ||||
| /* test if brush is over the mesh */ | /* test if brush is over the mesh */ | ||||
| bool hit = sculpt_get_brush_geometry(C, &vc, x, y, &pixel_radius, location, ups); | bool hit = sculpt_get_brush_geometry(C, &vc, x, y, &pixel_radius, location, ups); | ||||
| if (BKE_brush_use_locked_size(scene, brush)) { | if (BKE_brush_use_locked_size(scene, brush)) { | ||||
| BKE_brush_size_set(scene, brush, pixel_radius); | BKE_brush_size_set(scene, brush, pixel_radius); | ||||
| Show All 22 Lines | static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) | ||||
| /* make lines pretty */ | /* make lines pretty */ | ||||
| GPU_line_width(2.0f); | GPU_line_width(2.0f); | ||||
| GPU_blend(true); /* TODO: also set blend mode? */ | GPU_blend(true); /* TODO: also set blend mode? */ | ||||
| GPU_line_smooth(true); | GPU_line_smooth(true); | ||||
| uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); | uint pos = GPU_vertformat_attr_add(immVertexFormat(), "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); | ||||
| immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR); | ||||
jbakker: Just fix to 3d cursor drawing.
There are more places in this method that sticks to 3d drawing… | |||||
Not Done Inline Actions
Not sure what these would be? If you are talking about everything in if ((mode == PAINT_MODE_SCULPT), that is implicitly not is_2d_painting... (could also put that in the condition as well, but like I said, it is implicit...) I mean, I dont have a strong opinion here, but sticking to 3D drawing in 2D is kinda confusing as well, right? lichtwerk: > There are more places in this method that sticks to 3d drawing that aren't touched by this… | |||||
| /* set brush color */ | /* set brush color */ | ||||
| immUniformColor3fvAlpha(outline_col, outline_alpha); | immUniformColor3fvAlpha(outline_col, outline_alpha); | ||||
| /* draw brush outline */ | /* draw brush outline */ | ||||
| if (ups->stroke_active && BKE_brush_use_size_pressure(scene, brush)) { | if (ups->stroke_active && BKE_brush_use_size_pressure(scene, brush)) { | ||||
| /* inner at full alpha */ | /* inner at full alpha */ | ||||
| imm_draw_circle_wire_2d( | imm_draw_circle_wire_2d( | ||||
| pos, translation[0], translation[1], final_radius * ups->size_pressure_value, 40); | pos, translation[0], translation[1], final_radius * ups->size_pressure_value, 40); | ||||
| /* outer at half alpha */ | /* outer at half alpha */ | ||||
| immUniformColor3fvAlpha(outline_col, outline_alpha * 0.5f); | immUniformColor3fvAlpha(outline_col, outline_alpha * 0.5f); | ||||
| } | } | ||||
| /* Only sculpt mode cursor for now */ | /* Only sculpt mode cursor for now */ | ||||
| /* Disable for PBVH_GRIDS */ | /* Disable for PBVH_GRIDS */ | ||||
| SculptSession *ss = vc.obact->sculpt; | SculptSession *ss = obact ? obact->sculpt : NULL; | ||||
| bool is_multires = ss && ss->pbvh && BKE_pbvh_type(ss->pbvh) == PBVH_GRIDS; | bool is_multires = ss && ss->pbvh && BKE_pbvh_type(ss->pbvh) == PBVH_GRIDS; | ||||
| if ((mode == PAINT_MODE_SCULPT) && ss && !is_multires && | if ((mode == PAINT_MODE_SCULPT) && ss && !is_multires && | ||||
| !(brush->falloff_shape & BRUSH_AIRBRUSH)) { | !(brush->falloff_shape & BRUSH_AIRBRUSH)) { | ||||
| Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | Sculpt *sd = CTX_data_tool_settings(C)->sculpt; | ||||
| wmWindow *win = CTX_wm_window(C); | wmWindow *win = CTX_wm_window(C); | ||||
| /* Update WM mouse cursor, disable when the 3D brush cursor is enabled */ | /* Update WM mouse cursor, disable when the 3D brush cursor is enabled */ | ||||
| ▲ Show 20 Lines • Show All 146 Lines • Show Last 20 Lines | |||||
Just fix to 3d cursor drawing.
There are more places in this method that sticks to 3d drawing, that aren't touched by this patch that might lead to confusion when looking at the code in the future.