[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [58605] trunk/blender/source/blender/bmesh /intern/bmesh_construct.c: fix for face normal flipping calculation.

Campbell Barton ideasman42 at gmail.com
Thu Jul 25 20:16:56 CEST 2013


Revision: 58605
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=58605
Author:   campbellbarton
Date:     2013-07-25 18:16:55 +0000 (Thu, 25 Jul 2013)
Log Message:
-----------
fix for face normal flipping calculation.

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/intern/bmesh_construct.c

Modified: trunk/blender/source/blender/bmesh/intern/bmesh_construct.c
===================================================================
--- trunk/blender/source/blender/bmesh/intern/bmesh_construct.c	2013-07-25 16:04:26 UTC (rev 58604)
+++ trunk/blender/source/blender/bmesh/intern/bmesh_construct.c	2013-07-25 18:16:55 UTC (rev 58605)
@@ -200,6 +200,8 @@
 	ev1 = edges[0]->v1;
 	ev2 = edges[0]->v2;
 
+	BLI_assert(ELEM(v1, ev1, ev2) && ELEM(v2, ev1, ev2));
+
 	if (v1 == ev2) {
 		/* Swapping here improves performance and consistency of face
 		 * structure in the special case that the edges are already in
@@ -344,6 +346,7 @@
 				/* we want to use the reverse winding to the existing order */
 				BM_edge_ordered_verts(edge_arr[i], &test_v2, &test_v1);
 				winding[(vert_arr[i_prev] == test_v2)]++;
+				BLI_assert(vert_arr[i_prev] == test_v2 || vert_arr[i_prev] == test_v1);
 			}
 		}
 
@@ -370,7 +373,11 @@
 	/* --- */
 
 	/* create the face */
-	return BM_face_create_ngon(bm, vert_arr[winding[0]], vert_arr[winding[1]], edge_arr, len, create_flag);
+	return BM_face_create_ngon(
+	        bm,
+	        vert_arr[(len - 2) + winding[0]],
+	        vert_arr[(len - 1) + winding[1]],
+	        edge_arr, len, create_flag);
 }
 
 




More information about the Bf-blender-cvs mailing list