diff options
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 9bb7760fcc0..5edd14cd8e3 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3220,24 +3220,23 @@ static void sculpt_flush_stroke_deform(Sculpt *sd, Object *ob) PBVHNode **nodes; float (*vertCos)[3] = NULL; - if (ss->kb) + if (ss->kb) { vertCos = MEM_mallocN(sizeof(*vertCos) * me->totvert, "flushStrokeDeofrm keyVerts"); + /* mesh could have isolated verts which wouldn't be in BVH, + * to deal with this we copy old coordinates over new ones + * and then update coordinates for all vertices from BVH + */ + memcpy(vertCos, ss->orig_cos, 3 * sizeof(float) * me->totvert); + } + BKE_pbvh_search_gather(ss->pbvh, NULL, NULL, &nodes, &totnode); #pragma omp parallel for schedule(guided) if (sd->flags & SCULPT_USE_OPENMP) for (n = 0; n < totnode; n++) { PBVHVertexIter vd; - int mode = PBVH_ITER_UNIQUE; - /* when sculpting on a shape key, we need to gather all vertices, even - * hidden one, so key block update happens correct (otherwise we'll - * miss coordinates for hidden vertices) - */ - if (ss->kb) - mode = PBVH_ITER_ALL; - - BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, mode) + BKE_pbvh_vertex_iter_begin(ss->pbvh, nodes[n], vd, PBVH_ITER_UNIQUE) { sculpt_flush_pbvhvert_deform(ob, &vd); |