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/sculpt.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/sculpt.c')
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index f2eb1359af7..c8ee4a75b1d 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -204,6 +204,14 @@ const float *SCULPT_vertex_persistent_co_get(SculptSession *ss, int index) return SCULPT_vertex_co_get(ss, index); } +const float *SCULPT_vertex_co_for_grab_active_get(SculptSession *ss, int index) +{ + if (ss->mvert) { + return ss->mvert[index].co; + } + return SCULPT_vertex_co_get(ss, index); +} + void SCULPT_vertex_limit_surface_get(SculptSession *ss, int index, float r_co[3]) { switch (BKE_pbvh_type(ss->pbvh)) { @@ -6694,7 +6702,8 @@ static void sculpt_update_brush_delta(UnifiedPaintSettings *ups, Object *ob, Bru if (SCULPT_stroke_is_first_brush_step_of_symmetry_pass(ss->cache)) { if (tool == SCULPT_TOOL_GRAB && brush->flag & BRUSH_GRAB_ACTIVE_VERTEX) { - copy_v3_v3(cache->orig_grab_location, SCULPT_active_vertex_co_get(ss)); + copy_v3_v3(cache->orig_grab_location, + SCULPT_vertex_co_for_grab_active_get(ss, SCULPT_active_vertex_get(ss))); } else { copy_v3_v3(cache->orig_grab_location, cache->true_location); @@ -8366,7 +8375,7 @@ void SCULPT_geometry_preview_lines_update(bContext *C, SculptSession *ss, float totpoints++; if (!BLI_BITMAP_TEST(visited_vertices, to_v)) { BLI_BITMAP_ENABLE(visited_vertices, to_v); - const float *co = SCULPT_vertex_co_get(ss, to_v); + const float *co = SCULPT_vertex_co_for_grab_active_get(ss, to_v); if (len_squared_v3v3(brush_co, co) < radius * radius) { BLI_gsqueue_push(not_visited_vertices, &to_v); } |