diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-24 17:47:57 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-24 17:47:57 +0400 |
commit | 0b88b4fad7427fa8f9b623660188ef1d5432801e (patch) | |
tree | f59b5d13fb2ffc4b2703cd4fa2bd5dd9b79af78d /source/blender/blenkernel/intern/mesh_validate.c | |
parent | 17679aaa521e8f01e5c10af9b453d7513ee7b5d0 (diff) |
when the size of an edgehash is known or can be guessed,
pass in the argument to reserve the size.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_validate.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_validate.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/blenkernel/intern/mesh_validate.c b/source/blender/blenkernel/intern/mesh_validate.c index 512f205728d..d42b6fd1bbd 100644 --- a/source/blender/blenkernel/intern/mesh_validate.c +++ b/source/blender/blenkernel/intern/mesh_validate.c @@ -921,7 +921,8 @@ void BKE_mesh_calc_edges(Mesh *mesh, bool update, const bool select) EdgeHashIterator *ehi; MPoly *mp; MEdge *med, *med_orig; - EdgeHash *eh = BLI_edgehash_new(__func__); + EdgeHash *eh; + unsigned int eh_reserve; int i, totedge, totpoly = mesh->totpoly; int med_index; /* select for newly created meshes which are selected [#25595] */ @@ -930,6 +931,9 @@ void BKE_mesh_calc_edges(Mesh *mesh, bool update, const bool select) if (mesh->totedge == 0) update = false; + eh_reserve = max_ii(update ? mesh->totedge : 0, BLI_EDGEHASH_SIZE_GUESS_FROM_POLYS(totpoly)); + eh = BLI_edgehash_new_ex(__func__, eh_reserve); + if (update) { /* assume existing edges are valid * useful when adding more faces and generating edges from them */ |