[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [42966] trunk/blender/source/blender/ modifiers/intern/MOD_mirror.c: minor edits to trunk mirror modifier, use unsigned ints since the vertex values are unsigned + minor formatting edits

Campbell Barton ideasman42 at gmail.com
Thu Dec 29 07:07:43 CET 2011


Revision: 42966
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=42966
Author:   campbellbarton
Date:     2011-12-29 06:07:34 +0000 (Thu, 29 Dec 2011)
Log Message:
-----------
minor edits to trunk mirror modifier, use unsigned ints since the vertex values are unsigned + minor formatting edits

Modified Paths:
--------------
    trunk/blender/source/blender/modifiers/intern/MOD_mirror.c

Modified: trunk/blender/source/blender/modifiers/intern/MOD_mirror.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_mirror.c	2011-12-29 05:40:48 UTC (rev 42965)
+++ trunk/blender/source/blender/modifiers/intern/MOD_mirror.c	2011-12-29 06:07:34 UTC (rev 42966)
@@ -95,10 +95,10 @@
 }
 
 static DerivedMesh *doMirrorOnAxis(MirrorModifierData *mmd,
-		Object *ob,
-		DerivedMesh *dm,
-		int initFlags,
-		int axis)
+                                   Object *ob,
+                                   DerivedMesh *dm,
+                                   int initFlags,
+                                   int axis)
 {
 	int i;
 	float tolerance = mmd->tolerance;
@@ -109,7 +109,7 @@
 	int maxFaces = dm->getNumFaces(dm);
 	int *flip_map= NULL, flip_map_len= 0;
 	int do_vgroup_mirr= (mmd->flag & MOD_MIR_VGROUP);
-	int (*indexMap)[2];
+	unsigned int (*indexMap)[2];
 	float mtx[4][4], imtx[4][4];
 
 	numVerts = numEdges = numFaces = 0;
@@ -153,25 +153,27 @@
 			isShared = ABS(co[axis])<=tolerance;
 		
 		/* Because the topology result (# of vertices) must be the same if
-		* the mesh data is overridden by vertex cos, have to calc sharedness
-		* based on original coordinates. This is why we test before copy.
-		*/
+		 * the mesh data is overridden by vertex cos, have to calc sharedness
+		 * based on original coordinates. This is why we test before copy.
+		 */
 		DM_copy_vert_data(dm, result, i, numVerts, 1);
 		*mv = inMV;
+
+		indexMap[i][0] = numVerts;
+		indexMap[i][1] = !isShared;
+
 		numVerts++;
-		
-		indexMap[i][0] = numVerts - 1;
-		indexMap[i][1] = !isShared;
-		//
+
 		if(isShared ) {
-			co[axis] = 0;
+			co[axis] = 0.0f;
 			if (mmd->mirror_ob) {
 				mul_m4_v3(imtx, co);
 			}
 			copy_v3_v3(mv->co, co);
 			
 			mv->flag |= ME_VERT_MERGED;
-		} else {
+		}
+		else {
 			MVert *mv2 = CDDM_get_vert(result, numVerts);
 			
 			DM_copy_vert_data(dm, result, i, numVerts, 1);
@@ -236,10 +238,11 @@
 		mf->v3 = indexMap[inMF.v3][0];
 		mf->v4 = indexMap[inMF.v4][0];
 		
-		if(indexMap[inMF.v1][1]
-				 || indexMap[inMF.v2][1]
-				 || indexMap[inMF.v3][1]
-				 || (mf->v4 && indexMap[inMF.v4][1])) {
+		if ( indexMap[inMF.v1][1] ||
+		     indexMap[inMF.v2][1] ||
+		     indexMap[inMF.v3][1] ||
+		     (mf->v4 && indexMap[inMF.v4][1]))
+		{
 			MFace *mf2 = CDDM_get_face(result, numFaces);
 			static int corner_indices[4] = {2, 1, 0, 3};
 			




More information about the Bf-blender-cvs mailing list