[Bf-blender-cvs] [7971e44] master: Knife: no need to find the face-loops

Campbell Barton noreply at git.blender.org
Sat Sep 6 03:31:07 CEST 2014


Commit: 7971e441c15b5740ac2e09f898e24011b88f51a5
Author: Campbell Barton
Date:   Fri Sep 5 16:24:46 2014 +1000
Branches: master
https://developer.blender.org/rB7971e441c15b5740ac2e09f898e24011b88f51a5

Knife: no need to find the face-loops

Just check if verts are used in the face.

===================================================================

M	source/blender/editors/mesh/editmesh_knife.c

===================================================================

diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c
index 4182d0e..5955792 100644
--- a/source/blender/editors/mesh/editmesh_knife.c
+++ b/source/blender/editors/mesh/editmesh_knife.c
@@ -2267,31 +2267,28 @@ static bool find_hole_chains(KnifeTool_OpData *kcd, ListBase *hole, BMFace *f, L
 
 static bool knife_verts_edge_in_face(KnifeVert *v1, KnifeVert *v2, BMFace *f)
 {
-	BMLoop *l1, *l2, *l;
-	float mid[3];
-	BMIter iter;
-	int v1inside, v2inside;
+	bool v1_inside, v2_inside;
+	bool v1_inface, v2_inface;
 
 	if (!f || !v1 || !v2)
 		return false;
 
-	l1 = NULL;
-	l2 = NULL;
-
 	/* find out if v1 and v2, if set, are part of the face */
-	BM_ITER_ELEM (l, &iter, f, BM_LOOPS_OF_FACE) {
-		if (v1->v && l->v == v1->v)
-			l1 = l;
-		if (v2->v && l->v == v2->v)
-			l2 = l;
-	}
+	v1_inface = v1->v ? BM_vert_in_face(f, v1->v) : false;
+	v2_inface = v2->v ? BM_vert_in_face(f, v2->v) : false;
 
 	/* BM_face_point_inside_test uses best-axis projection so this isn't most accurate test... */
-	v1inside = l1 ? 0 : BM_face_point_inside_test(f, v1->co);
-	v2inside = l2 ? 0 : BM_face_point_inside_test(f, v2->co);
-	if ((l1 && v2inside) || (l2 && v1inside) || (v1inside && v2inside))
+	v1_inside = v1_inface ? false : BM_face_point_inside_test(f, v1->co);
+	v2_inside = v2_inface ? false : BM_face_point_inside_test(f, v2->co);
+	if ((v1_inface && v2_inside) ||
+	    (v2_inface && v1_inside) ||
+	    (v1_inside && v2_inside))
+	{
 		return true;
-	if (l1 && l2) {
+	}
+
+	if (v1_inface && v2_inface) {
+		float mid[3];
 		/* Can have case where v1 and v2 are on shared chain between two faces.
 		 * BM_face_splits_check_legal does visibility and self-intersection tests,
 		 * but it is expensive and maybe a bit buggy, so use a simple




More information about the Bf-blender-cvs mailing list