diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-01 13:55:37 +0400 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2013-04-01 13:55:37 +0400 |
commit | e8d0e77856872037635c1d2bcd9a466a715910c4 (patch) | |
tree | 29670c695bca86dfb2f66faff90bf40a4ff093b8 /source/blender/editors | |
parent | 271a7a5554a6438df708f2f6f9871b6f1cf702e8 (diff) |
Fix #34813: smooth brush used on a shape key messes up the topology - part2
This reverts rev55642 and fixes issue in a different way.
The thing here is: isolated vertices are for sure not in BVH
and updating keyblock could not only rely on idea that all
vertices are in BVH (no idea why it was noticed just now).
Solved in a way, that uses old keyblock coordinates as new
keyblock, and then refines it using coordinates from BVH.
Hopefully it'll cover all cases now :)
Diffstat (limited to 'source/blender/editors')
-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); |