diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_cursor.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_cursor.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index d5bb552b470..cabf17e8534 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -1526,11 +1526,21 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) immUniformColor3fvAlpha(outline_col, outline_alpha); GPU_line_width(2.0f); imm_draw_circle_wire_3d(pos, 0, 0, rds, 80); + GPU_line_width(1.0f); immUniformColor3fvAlpha(outline_col, outline_alpha * 0.5f); imm_draw_circle_wire_3d(pos, 0, 0, rds * clamp_f(brush->alpha, 0.0f, 1.0f), 80); GPU_matrix_pop(); + /* Cloth brush simulation areas. */ + if (brush->sculpt_tool == SCULPT_TOOL_CLOTH) { + GPU_matrix_push(); + const float white[3] = {1.0f, 1.0f, 1.0f}; + SCULPT_cloth_simulation_limits_draw( + pos, brush, vc.obact->obmat, gi.location, gi.normal, rds, 1.0f, white, 0.25f); + GPU_matrix_pop(); + } + /* Update and draw dynamic mesh preview lines. */ GPU_matrix_push(); GPU_matrix_mul(vc.obact->obmat); @@ -1620,6 +1630,48 @@ static void paint_draw_cursor(bContext *C, int x, int y, void *UNUSED(unused)) GPU_matrix_pop_projection(); } + if (brush->sculpt_tool == SCULPT_TOOL_CLOTH && !ss->cache->first_time) { + GPU_matrix_push_projection(); + ED_view3d_draw_setup_view(CTX_wm_window(C), + CTX_data_depsgraph_pointer(C), + CTX_data_scene(C), + ar, + CTX_wm_view3d(C), + NULL, + NULL, + NULL); + + /* Plane falloff preview */ + if (brush->cloth_force_falloff_type == BRUSH_CLOTH_FORCE_FALLOFF_PLANE) { + GPU_matrix_push(); + GPU_matrix_mul(vc.obact->obmat); + SCULPT_cloth_plane_falloff_preview_draw(pos, ss, outline_col, outline_alpha); + GPU_matrix_pop(); + } + + /* Display the simulation limits if sculpting outside them. */ + /* This does not makes much sense of plane fallof as the fallof is infinte. */ + else if (brush->cloth_force_falloff_type == BRUSH_CLOTH_FORCE_FALLOFF_RADIAL) { + if (len_v3v3(ss->cache->true_location, ss->cache->true_initial_location) > + ss->cache->radius * (1.0f + brush->cloth_sim_limit)) { + const float red[3] = {1.0f, 0.2f, 0.2f}; + GPU_matrix_push(); + SCULPT_cloth_simulation_limits_draw(pos, + brush, + vc.obact->obmat, + ss->cache->true_initial_location, + ss->cache->true_initial_normal, + ss->cache->radius, + 2.0f, + red, + 0.8f); + GPU_matrix_pop(); + } + } + + GPU_matrix_pop_projection(); + } + wmWindowViewport(win); } } |