[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [44929] trunk/blender/source/blender/bmesh /operators/bmo_create.c: fix for own silly mistake with face creation ( wasnt checking more then 1 vert was selected)

Campbell Barton ideasman42 at gmail.com
Fri Mar 16 23:25:03 CET 2012


Revision: 44929
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=44929
Author:   campbellbarton
Date:     2012-03-16 22:24:56 +0000 (Fri, 16 Mar 2012)
Log Message:
-----------
fix for own silly mistake with face creation (wasnt checking more then 1 vert was selected)

Modified Paths:
--------------
    trunk/blender/source/blender/bmesh/operators/bmo_create.c

Modified: trunk/blender/source/blender/bmesh/operators/bmo_create.c
===================================================================
--- trunk/blender/source/blender/bmesh/operators/bmo_create.c	2012-03-16 21:39:56 UTC (rev 44928)
+++ trunk/blender/source/blender/bmesh/operators/bmo_create.c	2012-03-16 22:24:56 UTC (rev 44929)
@@ -495,7 +495,6 @@
 				BMVert *v1, *v2, *v3;
 				VertData *vd1, *vd2, *vd3;
 				float vec1[3], vec2[3], vec3[3], n1[3], n2[3], n3[3];
-				int s1, s2, s3;
 				
 				e1 = edges[(i + totedge - 1) % totedge];
 				e2 = edges[i];
@@ -517,22 +516,26 @@
 				cross_v3_v3v3(n2, vec2, vec3);
 				cross_v3_v3v3(n3, vec1, vec3);
 
+				/* this case happens often enough and probably not worth bothering users with,
+				 * maybe enable for debugging code but not for everyday use - campbell */
+#if 0
 				/* Other way to determine if two vectors approach are (nearly) parallel: the
 				 * cross product of the two vectors will approach zero */
-				s1 = (dot_v3v3(n1, n1) < (0.0f + FLT_EPSILON * 10));
-				s2 = (dot_v3v3(n2, n2) < (0.0f + FLT_EPSILON * 10));
-				s3 = (totedge < 3) ? 0 : (dot_v3v3(n3, n3) < (0.0f + FLT_EPSILON * 10));
+				{
+					int s1, s2, s3;
+					s1 = (dot_v3v3(n1, n1) < (0.0f + FLT_EPSILON * 10));
+					s2 = (dot_v3v3(n2, n2) < (0.0f + FLT_EPSILON * 10));
+					s3 = (totedge < 3) ? 0 : (dot_v3v3(n3, n3) < (0.0f + FLT_EPSILON * 10));
 
-				normalize_v3(n1); normalize_v3(n2); normalize_v3(n3);
-
-				/* this case happens often enough and probably not worth bothering users with,
-				 * maybe enable for debugging code but not for everyday use - campbell */
-#if 0
-				if (s1 || s2 || s3) {
-					fprintf(stderr, "%s: s1: %d, s2: %d, s3: %dx (bmesh internal error)\n", __func__, s1, s2, s3);
+					if (s1 || s2 || s3) {
+						fprintf(stderr, "%s: s1: %d, s2: %d, s3: %dx (bmesh internal error)\n", __func__, s1, s2, s3);
+					}
 				}
 #endif
 
+				normalize_v3(n1); normalize_v3(n2); normalize_v3(n3);
+
+
 				if (dot_v3v3(n1, n2) < 0.0f) {
 					if (dot_v3v3(n1, n3) >= 0.0f + FLT_EPSILON * 10) {
 						SWAP(BMEdge *, edges[i], edges[(i + 1) % totedge]);
@@ -1441,7 +1444,7 @@
 		}
 		/* done creating edges */
 	}
-	else {
+	else if (amount > 2) {
 		/* TODO, all these verts may be connected by edges.
 		 * we should check on this before assuming they are a random set of verts */
 




More information about the Bf-blender-cvs mailing list