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>2014-05-29 08:03:22 +0400
committerCampbell Barton <ideasman42@gmail.com>2014-06-13 18:47:12 +0400
commit9db947df41204b3b19e649a54669655642402300 (patch)
treeec81c6eff91799f070b657ac17e8ca8c35e4a08a /source
parent365ff6698700fb23c8bd9d0509c49df71180431e (diff)
Editmesh: Replace SmallHash with GSet for MESH_OT_loop_to_region
There no reason to assume hash will be small in this case
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/mesh/editmesh_select.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/source/blender/editors/mesh/editmesh_select.c b/source/blender/editors/mesh/editmesh_select.c
index 467723e5e0a..f58034c1066 100644
--- a/source/blender/editors/mesh/editmesh_select.c
+++ b/source/blender/editors/mesh/editmesh_select.c
@@ -3189,7 +3189,7 @@ void MESH_OT_region_to_loop(wmOperatorType *ot)
}
static int loop_find_region(BMLoop *l, int flag,
- SmallHash *fhash, BMFace ***region_out)
+ GSet *visit_face_set, BMFace ***region_out)
{
BMFace **region = NULL;
BMFace **stack = NULL;
@@ -3198,7 +3198,7 @@ static int loop_find_region(BMLoop *l, int flag,
BMFace *f;
BLI_array_append(stack, l->f);
- BLI_smallhash_insert(fhash, (uintptr_t)l->f, NULL);
+ BLI_gset_insert(visit_face_set, l->f);
while (BLI_array_count(stack) > 0) {
BMIter liter1, liter2;
@@ -3217,11 +3217,10 @@ static int loop_find_region(BMLoop *l, int flag,
if (BM_elem_flag_test(l2->f, BM_ELEM_TAG)) {
continue;
}
- if (BLI_smallhash_haskey(fhash, (uintptr_t)l2->f))
- continue;
-
- BLI_array_append(stack, l2->f);
- BLI_smallhash_insert(fhash, (uintptr_t)l2->f, NULL);
+
+ if (BLI_gset_add(visit_face_set, l2->f)) {
+ BLI_array_append(stack, l2->f);
+ }
}
}
}
@@ -3254,13 +3253,13 @@ static int verg_radial(const void *va, const void *vb)
*/
static int loop_find_regions(BMEditMesh *em, const bool selbigger)
{
- SmallHash visithash;
+ GSet *visit_face_set;
BMIter iter;
const int edges_len = em->bm->totedgesel;
BMEdge *e, **edges;
int count = 0, i;
- BLI_smallhash_init_ex(&visithash, edges_len);
+ visit_face_set = BLI_gset_ptr_new_ex(__func__, edges_len);
edges = MEM_mallocN(sizeof(*edges) * edges_len, __func__);
i = 0;
@@ -3289,10 +3288,10 @@ static int loop_find_regions(BMEditMesh *em, const bool selbigger)
continue;
BM_ITER_ELEM (l, &liter, e, BM_LOOPS_OF_EDGE) {
- if (BLI_smallhash_haskey(&visithash, (uintptr_t)l->f))
+ if (BLI_gset_haskey(visit_face_set, l->f))
continue;
-
- c = loop_find_region(l, BM_ELEM_SELECT, &visithash, &region_out);
+
+ c = loop_find_region(l, BM_ELEM_SELECT, visit_face_set, &region_out);
if (!region || (selbigger ? c >= tot : c < tot)) {
/* this region is the best seen so far */
@@ -3327,7 +3326,7 @@ static int loop_find_regions(BMEditMesh *em, const bool selbigger)
}
MEM_freeN(edges);
- BLI_smallhash_release(&visithash);
+ BLI_gset_free(visit_face_set, NULL);
return count;
}