BMesh Island Walker: use direct loop access
authorCampbell Barton <ideasman42@gmail.com>
Wed, 11 May 2016 19:30:20 +0000 (05:30 +1000)
committerCampbell Barton <ideasman42@gmail.com>
Wed, 11 May 2016 19:30:20 +0000 (05:30 +1000)
source/blender/bmesh/intern/bmesh_walkers_impl.c

index 36bbdde311c7b520745308f5ae38485b445e5786..2a94e683cc52f1f1c6064b6f9b17f3a8e7c8df70 100644 (file)
@@ -788,22 +788,21 @@ static void *bmw_IslandWalker_yield(BMWalker *walker)
 static void *bmw_IslandWalker_step(BMWalker *walker)
 {
        BMwIslandWalker *iwalk, owalk;
-       BMIter iter, liter;
-       BMFace *f;
-       BMLoop *l;
+       BMLoop *l_iter, *l_first;
        
        BMW_state_remove_r(walker, &owalk);
        iwalk = &owalk;
 
-       l = BM_iter_new(&liter, walker->bm, BM_LOOPS_OF_FACE, iwalk->cur);
-       for ( ; l; l = BM_iter_step(&liter)) {
+       l_iter = l_first = BM_FACE_FIRST_LOOP(iwalk->cur);
+       do {
                /* could skip loop here too, but don't add unless we need it */
-               if (!bmw_mask_check_edge(walker, l->e)) {
+               if (!bmw_mask_check_edge(walker, l_iter->e)) {
                        continue;
                }
 
-               f = BM_iter_new(&iter, walker->bm, BM_FACES_OF_EDGE, l->e);
-               for ( ; f; f = BM_iter_step(&iter)) {
+               BMLoop *l_radial_iter = l_iter;
+               while ((l_radial_iter = l_radial_iter->radial_next) != l_iter) {
+                       BMFace *f = l_radial_iter->f;
 
                        if (!bmw_mask_check_face(walker, f)) {
                                continue;
@@ -817,14 +816,14 @@ static void *bmw_IslandWalker_step(BMWalker *walker)
                        if (BLI_gset_haskey(walker->visit_set, f)) {
                                continue;
                        }
-                       
+
                        iwalk = BMW_state_add(walker);
                        iwalk->cur = f;
                        BLI_gset_insert(walker->visit_set, f);
                        break;
                }
-       }
-       
+       } while ((l_iter = l_iter->next) != l_first);
+
        return owalk.cur;
 }