[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [55694] trunk/blender/source/blender/ editors/sculpt_paint/sculpt.c: Fix #34813: smooth brush used on a shape key messes up the topology - part2

Sergey Sharybin sergey.vfx at gmail.com
Mon Apr 1 11:55:37 CEST 2013


Revision: 55694
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55694
Author:   nazgul
Date:     2013-04-01 09:55:37 +0000 (Mon, 01 Apr 2013)
Log Message:
-----------
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 :)

Revision Links:
--------------
    http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=55642

Modified Paths:
--------------
    trunk/blender/source/blender/editors/sculpt_paint/sculpt.c

Modified: trunk/blender/source/blender/editors/sculpt_paint/sculpt.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2013-04-01 09:46:35 UTC (rev 55693)
+++ trunk/blender/source/blender/editors/sculpt_paint/sculpt.c	2013-04-01 09:55:37 UTC (rev 55694)
@@ -3220,24 +3220,23 @@
 		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);
 




More information about the Bf-blender-cvs mailing list