[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [60351] trunk/blender/source/blender/ editors/util/crazyspace.c: add back crazy space check to only initialize a vertex once.

Campbell Barton ideasman42 at gmail.com
Tue Sep 24 04:16:53 CEST 2013


Revision: 60351
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=60351
Author:   campbellbarton
Date:     2013-09-24 02:16:52 +0000 (Tue, 24 Sep 2013)
Log Message:
-----------
add back crazy space check to only initialize a vertex once. (changed in r60146 caused bug [#36803])

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

Modified Paths:
--------------
    trunk/blender/source/blender/editors/util/crazyspace.c

Modified: trunk/blender/source/blender/editors/util/crazyspace.c
===================================================================
--- trunk/blender/source/blender/editors/util/crazyspace.c	2013-09-24 00:56:47 UTC (rev 60350)
+++ trunk/blender/source/blender/editors/util/crazyspace.c	2013-09-24 02:16:52 UTC (rev 60351)
@@ -40,6 +40,7 @@
 
 #include "BLI_utildefines.h"
 #include "BLI_math.h"
+#include "BLI_bitmap.h"
 
 #include "BKE_DerivedMesh.h"
 #include "BKE_modifier.h"
@@ -51,6 +52,7 @@
 
 typedef struct {
 	float (*vertexcos)[3];
+	BLI_bitmap *vertex_visit;
 } MappedUserData;
 
 BLI_INLINE void tan_calc_v3(float a[3], const float b[3], const float c[3])
@@ -83,7 +85,14 @@
                                     const float UNUSED(no_f[3]), const short UNUSED(no_s[3]))
 {
 	MappedUserData *mappedData = (MappedUserData *)userData;
-	copy_v3_v3(mappedData->vertexcos[index], co);
+
+	if (BLI_BITMAP_GET(mappedData->vertex_visit, index) == 0) {
+		/* we need coord from prototype vertex, not from copies,
+		 * assume they stored in the beginning of vertex array stored in DM
+		 * (mirror modifier for eg does this) */
+		copy_v3_v3(mappedData->vertexcos[index], co);
+		BLI_BITMAP_SET(mappedData->vertex_visit, index);
+	}
 }
 
 static int modifiers_disable_subsurf_temporary(Object *ob)
@@ -108,6 +117,7 @@
 	DerivedMesh *dm;
 	float (*vertexcos)[3];
 	int nverts = me->edit_btmesh->bm->totvert;
+	BLI_bitmap *vertex_visit;
 	MappedUserData userData;
 
 	/* disable subsurf temporal, get mapped cos, and enable it */
@@ -120,8 +130,10 @@
 	dm = editbmesh_get_derived_cage(scene, obedit, me->edit_btmesh, CD_MASK_BAREMESH);
 
 	vertexcos = MEM_callocN(sizeof(*vertexcos) * nverts, "vertexcos map");
+	vertex_visit = BLI_BITMAP_NEW(nverts, "vertexcos flags");
 
 	userData.vertexcos = vertexcos;
+	userData.vertex_visit = vertex_visit;
 	dm->foreachMappedVert(dm, make_vertexcos__mapFunc, &userData, DM_FOREACH_NOP);
 
 	dm->release(dm);
@@ -129,6 +141,8 @@
 	/* set back the flag, no new cage needs to be built, transform does it */
 	modifiers_disable_subsurf_temporary(obedit);
 
+	MEM_freeN(vertex_visit);
+
 	return vertexcos;
 }
 




More information about the Bf-blender-cvs mailing list