[Bf-blender-cvs] [7daa921] master: BMesh: avoid customdata copy for new dyntopo verts

Campbell Barton noreply at git.blender.org
Tue Apr 14 11:00:12 CEST 2015


Commit: 7daa921359a182e00a6bba5b654ace41f26033a2
Author: Campbell Barton
Date:   Tue Apr 14 18:32:10 2015 +1000
Branches: master
https://developer.blender.org/rB7daa921359a182e00a6bba5b654ace41f26033a2

BMesh: avoid customdata copy for new dyntopo verts

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

M	source/blender/blenkernel/intern/pbvh_bmesh.c

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

diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c
index ce26df4..b6e5fcf 100644
--- a/source/blender/blenkernel/intern/pbvh_bmesh.c
+++ b/source/blender/blenkernel/intern/pbvh_bmesh.c
@@ -331,11 +331,15 @@ static BMVert *pbvh_bmesh_vert_create(
         const BMVert *example,
         const int cd_vert_mask_offset)
 {
-	BMVert *v = BM_vert_create(bvh->bm, co, example, BM_CREATE_NOP);
 	PBVHNode *node = &bvh->nodes[node_index];
+	BMVert *v;
 
 	BLI_assert((bvh->totnode == 1 || node_index) && node_index <= bvh->totnode);
 
+	/* avoid initializing customdata because its quite involved */
+	v = BM_vert_create(bvh->bm, co, example, BM_CREATE_SKIP_CD);
+	CustomData_bmesh_set_default(&bvh->bm->vdata, &v->head.data);
+
 	BLI_gset_insert(node->bm_unique_verts, v);
 	BM_ELEM_CD_SET_INT(v, bvh->cd_vert_node_offset, node_index);
 
@@ -1167,14 +1171,14 @@ static bool pbvh_bmesh_collapse_short_edges(
 			continue;
 		}
 
-		if (len_squared_v3v3(v1->co, v2->co) >= min_len_squared)
-			continue;
-
 		/* Check that the edge still exists */
 		if (!(e = BM_edge_exists(v1, v2))) {
 			continue;
 		}
 
+		if (len_squared_v3v3(v1->co, v2->co) >= min_len_squared)
+			continue;
+
 		/* Check that the edge's vertices are still in the PBVH. It's
 		 * possible that an edge collapse has deleted adjacent faces
 		 * and the node has been split, thus leaving wire edges and




More information about the Bf-blender-cvs mailing list