[Bf-blender-cvs] [52a71c9] master: Transform: PET quick checks to speedup wire-only edge case

Campbell Barton noreply at git.blender.org
Wed Jun 18 08:10:54 CEST 2014


Commit: 52a71c9db397145179b5fc54fb853d060e590a14
Author: Campbell Barton
Date:   Wed Jun 18 16:09:02 2014 +1000
https://developer.blender.org/rB52a71c9db397145179b5fc54fb853d060e590a14

Transform: PET quick checks to speedup wire-only edge case

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

M	source/blender/editors/transform/transform_conversions.c

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

diff --git a/source/blender/editors/transform/transform_conversions.c b/source/blender/editors/transform/transform_conversions.c
index 72ac4ad..ab0d977 100644
--- a/source/blender/editors/transform/transform_conversions.c
+++ b/source/blender/editors/transform/transform_conversions.c
@@ -1899,31 +1899,43 @@ static void editmesh_set_connectivity_distance(BMesh *bm, float mtx[3][3], float
 		memcpy(dists_prev, dists, sizeof(float) * bm->totvert);
 
 		while ((v = BLI_LINKSTACK_POP(queue))) {
-			BMIter iter;
-			BMEdge *e;
-			BMLoop *l;
+			/* quick checks */
+			bool has_edges = (v->e != NULL);
+			bool has_faces = false;
 
 			/* connected edge-verts */
-			BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
-				if (BM_elem_flag_test(e, BM_ELEM_HIDDEN) == 0) {
-					BMVert *v_other = BM_edge_other_vert(e, v);
-					if (bmesh_test_dist_add(v, v_other, dists, dists_prev, mtx)) {
-						if (BM_elem_flag_test(v_other, BM_ELEM_TAG) == 0) {
-							BM_elem_flag_enable(v_other, BM_ELEM_TAG);
-							BLI_LINKSTACK_PUSH(queue_next, v_other);
+			if (has_edges) {
+				BMIter iter;
+				BMEdge *e;
+
+				BM_ITER_ELEM (e, &iter, v, BM_EDGES_OF_VERT) {
+					has_faces |= (BM_edge_is_wire(e) == false);
+
+					if (BM_elem_flag_test(e, BM_ELEM_HIDDEN) == 0) {
+						BMVert *v_other = BM_edge_other_vert(e, v);
+						if (bmesh_test_dist_add(v, v_other, dists, dists_prev, mtx)) {
+							if (BM_elem_flag_test(v_other, BM_ELEM_TAG) == 0) {
+								BM_elem_flag_enable(v_other, BM_ELEM_TAG);
+								BLI_LINKSTACK_PUSH(queue_next, v_other);
+							}
 						}
 					}
 				}
 			}
 			
 			/* imaginary edge diagonally across quad */
-			BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
-				if ((BM_elem_flag_test(l->f, BM_ELEM_HIDDEN) == 0) && (l->f->len == 4)) {
-					BMVert *v_other = l->next->next->v;
-					if (bmesh_test_dist_add(v, v_other, dists, dists_prev, mtx)) {
-						if (BM_elem_flag_test(v_other, BM_ELEM_TAG) == 0) {
-							BM_elem_flag_enable(v_other, BM_ELEM_TAG);
-							BLI_LINKSTACK_PUSH(queue_next, v_other);
+			if (has_faces) {
+				BMIter iter;
+				BMLoop *l;
+
+				BM_ITER_ELEM (l, &iter, v, BM_LOOPS_OF_VERT) {
+					if ((BM_elem_flag_test(l->f, BM_ELEM_HIDDEN) == 0) && (l->f->len == 4)) {
+						BMVert *v_other = l->next->next->v;
+						if (bmesh_test_dist_add(v, v_other, dists, dists_prev, mtx)) {
+							if (BM_elem_flag_test(v_other, BM_ELEM_TAG) == 0) {
+								BM_elem_flag_enable(v_other, BM_ELEM_TAG);
+								BLI_LINKSTACK_PUSH(queue_next, v_other);
+							}
 						}
 					}
 				}




More information about the Bf-blender-cvs mailing list