From c4345a808c727e4a7052872bce91e35b74c9eea3 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sun, 2 Feb 2014 17:08:26 +1100 Subject: Smallhash: add reserve option to avoid resizing when size is known --- source/blender/editors/mesh/editmesh_knife.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'source/blender/editors/mesh') diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index 0d1e43a709b..1fb3741380a 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -1293,9 +1293,6 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd) /* First use bvh tree to find faces, knife edges, and knife verts that might * intersect the cut plane with rays v1-v3 and v2-v4. * This deduplicates the candidates before doing more expensive intersection tests. */ - BLI_smallhash_init(&faces); - BLI_smallhash_init(&kfes); - BLI_smallhash_init(&kfvs); tree = BKE_bmbvh_tree_get(kcd->bmbvh); planetree = BLI_bvhtree_new(4, FLT_EPSILON * 4, 8, 8); @@ -1308,13 +1305,14 @@ static void knife_find_line_hits(KnifeTool_OpData *kcd) results = BLI_bvhtree_overlap(tree, planetree, &tot); if (!results) { - BLI_smallhash_release(&faces); - BLI_smallhash_release(&kfes); - BLI_smallhash_release(&kfvs); BLI_bvhtree_free(planetree); return; } + BLI_smallhash_init(&faces); + BLI_smallhash_init(&kfes); + BLI_smallhash_init(&kfvs); + for (i = 0, result = results; i < tot; i++, result++) { ls = (BMLoop **)kcd->em->looptris[result->indexA]; f = ls[0]->f; -- cgit v1.2.3