[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43230] trunk/blender/source/blender/ modifiers/intern/MOD_solidify.c: bugfix for solidify modifier rim faces which were created from triangles, would get wrong customdata copied since it used the 4th index of a tri.

Campbell Barton ideasman42 at gmail.com
Mon Jan 9 10:30:12 CET 2012


Revision: 43230
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43230
Author:   campbellbarton
Date:     2012-01-09 09:30:04 +0000 (Mon, 09 Jan 2012)
Log Message:
-----------
bugfix for solidify modifier rim faces which were created from triangles, would get wrong customdata copied since it used the 4th index of a tri.

fixed already in bmesh.

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

Modified: trunk/blender/source/blender/modifiers/intern/MOD_solidify.c
===================================================================
--- trunk/blender/source/blender/modifiers/intern/MOD_solidify.c	2012-01-09 09:12:55 UTC (rev 43229)
+++ trunk/blender/source/blender/modifiers/intern/MOD_solidify.c	2012-01-09 09:30:04 UTC (rev 43230)
@@ -554,11 +554,18 @@
 		const unsigned char crease_outer= smd->crease_outer * 255.0f;
 		const unsigned char crease_inner= smd->crease_inner * 255.0f;
 
-		const int edge_indices[4][4] = {
-				{1, 0, 0, 1},
-				{2, 1, 1, 2},
-				{3, 2, 2, 3},
-				{0, 3, 3, 0}};
+		const int edge_indices[2][4][4] = {
+		        /* quad */
+		       {{1, 0, 0, 1},
+		        {2, 1, 1, 2},
+		        {3, 2, 2, 3},
+		        {0, 3, 3, 0}},
+		        /* tri */
+		       {{1, 0, 0, 1},
+		        {2, 1, 1, 2},
+		        {0, 2, 2, 0},
+		        {0, 0, 0, 0}} /* unused for tris */
+		        };
 
 		/* add faces & edges */
 		origindex= result->getEdgeDataArray(result, CD_ORIGINDEX);
@@ -581,6 +588,7 @@
 			int eidx= new_edge_arr[i];
 			int fidx= edge_users[eidx];
 			int flip;
+			int is_tri;
 
 			if(fidx >= numFaces) {
 				fidx -= numFaces;
@@ -595,8 +603,10 @@
 			/* copy most of the face settings */
 			DM_copy_face_data(dm, result, fidx, (numFaces * 2) + i, 1);
 
+			is_tri = (orig_mface[fidx].v4 == 0);
+
 			if(flip) {
-				DM_swap_face_data(result, (numFaces * 2) + i, edge_indices[edge_order[eidx]]);
+				DM_swap_face_data(result, (numFaces * 2) + i, edge_indices[is_tri][edge_order[eidx]]);
 
 				mf->v1= ed->v1;
 				mf->v2= ed->v2;
@@ -604,7 +614,7 @@
 				mf->v4= ed->v1 + numVerts;
 			}
 			else {
-				DM_swap_face_data(result, (numFaces * 2) + i, edge_indices[edge_order[eidx]]);
+				DM_swap_face_data(result, (numFaces * 2) + i, edge_indices[is_tri][edge_order[eidx]]);
 
 				mf->v1= ed->v2;
 				mf->v2= ed->v1;



More information about the Bf-blender-cvs mailing list