diff options
author | Pablo Dobarro <pablodp606> | 2020-09-07 18:24:52 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-09-07 18:26:21 +0300 |
commit | 1dc11d15a60b1fdb21f72c9bd39ba27e3acdb80f (patch) | |
tree | feaa5137cd9a287bea6eb5093b43a2c628098e01 /source/blender/editors/sculpt_paint/paint_cursor.c | |
parent | bbbfd7130ae36b9ba1652b919ef6ae426107acd8 (diff) |
Fix T79914: Grab active vertex using wrong coordinates
This was introduced in the first commit of the cloth brush. In order to
support the cloth brush deformations with subsurf modifiers, the sculpt
API was changed to return the deformed coordinates from the PBVH instead
of the mesh coordinates. When using grab active vertex and rendering the
original mesh wireframe it should render the undeformed mesh coordinates
when available.
Reviewed By: sergey
Maniphest Tasks: T79914
Differential Revision: https://developer.blender.org/D8630
Diffstat (limited to 'source/blender/editors/sculpt_paint/paint_cursor.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/paint_cursor.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index 08733a26187..f4d7869e40a 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -1154,7 +1154,8 @@ static void sculpt_geometry_preview_lines_draw(const uint gpuattr, if (ss->preview_vert_index_count > 0) { immBegin(GPU_PRIM_LINES, ss->preview_vert_index_count); for (int i = 0; i < ss->preview_vert_index_count; i++) { - immVertex3fv(gpuattr, SCULPT_vertex_co_get(ss, ss->preview_vert_index_list[i])); + immVertex3fv(gpuattr, + SCULPT_vertex_co_for_grab_active_get(ss, ss->preview_vert_index_list[i])); } immEnd(); } @@ -1572,7 +1573,14 @@ static void paint_cursor_draw_3d_view_brush_cursor_inactive(PaintCursorContext * /* Cursor location symmetry points. */ - const float *active_vertex_co = SCULPT_active_vertex_co_get(pcontext->ss); + const float *active_vertex_co; + if (brush->sculpt_tool == SCULPT_TOOL_GRAB && brush->flag & BRUSH_GRAB_ACTIVE_VERTEX) { + active_vertex_co = SCULPT_vertex_co_for_grab_active_get( + pcontext->ss, SCULPT_active_vertex_get(pcontext->ss)); + } + else { + active_vertex_co = SCULPT_active_vertex_co_get(pcontext->ss); + } if (len_v3v3(active_vertex_co, pcontext->location) < pcontext->radius) { immUniformColor3fvAlpha(pcontext->outline_col, pcontext->outline_alpha); cursor_draw_point_with_symmetry(pcontext->pos, |