Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2015-04-12 08:01:38 +0300
committerCampbell Barton <ideasman42@gmail.com>2015-04-12 10:38:14 +0300
commit6d2c3a245622fa836ae603666789970a2f83b1c1 (patch)
treeca2faf58620a404ca64be2e1ab808f1e1e834f23 /source
parentf50fed6a6dfc24a52327f9085122e0a530fcc2ae (diff)
BMesh: avoid ghash realloc's making log entry
Diffstat (limited to 'source')
-rw-r--r--source/blender/bmesh/intern/bmesh_log.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c
index 8596fcbf83e..d2397faa7d1 100644
--- a/source/blender/bmesh/intern/bmesh_log.c
+++ b/source/blender/bmesh/intern/bmesh_log.c
@@ -993,6 +993,15 @@ void BM_log_all_added(BMesh *bm, BMLog *log)
BMVert *v;
BMFace *f;
+ /* avoid unnecessary resizing on initialization */
+ if (BLI_ghash_size(log->current_entry->added_verts) == 0) {
+ BLI_ghash_reserve(log->current_entry->added_verts, (unsigned int)bm->totvert);
+ }
+
+ if (BLI_ghash_size(log->current_entry->added_faces) == 0) {
+ BLI_ghash_reserve(log->current_entry->added_faces, (unsigned int)bm->totface);
+ }
+
/* Log all vertices as newly created */
BM_ITER_MESH (v, &bm_iter, bm, BM_VERTS_OF_MESH) {
BM_log_vert_added(log, v, cd_vert_mask_offset);