diff options
author | Campbell Barton <ideasman42@gmail.com> | 2015-04-14 11:32:10 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2015-04-14 11:41:01 +0300 |
commit | 7daa921359a182e00a6bba5b654ace41f26033a2 (patch) | |
tree | d36f274b83b0b14b261d594aff3c99752b6ad2fb /source | |
parent | d36429b9307db13628701831cf84d2f3fb147ab0 (diff) |
BMesh: avoid customdata copy for new dyntopo verts
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/intern/pbvh_bmesh.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/source/blender/blenkernel/intern/pbvh_bmesh.c b/source/blender/blenkernel/intern/pbvh_bmesh.c index ce26df4ee3a..b6e5fcfb405 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 |