Code Cleanup: remove bmesh_radial_loop_next() function,
authorCampbell Barton <ideasman42@gmail.com>
Thu, 1 Mar 2012 17:13:02 +0000 (17:13 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 1 Mar 2012 17:13:02 +0000 (17:13 +0000)
just access l->radial_next

source/blender/bmesh/intern/bmesh_core.c
source/blender/bmesh/intern/bmesh_iterators.c
source/blender/bmesh/intern/bmesh_queries.c
source/blender/bmesh/intern/bmesh_structure.c
source/blender/bmesh/intern/bmesh_structure.h
source/blender/bmesh/intern/bmesh_walkers_impl.c
source/blender/bmesh/operators/bmo_dissolve.c
source/blender/bmesh/tools/BME_bevel.c

index 503e87b9026403272033859c10d2e15b04f0936c..a04e5eda5a2218bb725eec4f76cfea6f857a90e6 100644 (file)
@@ -789,7 +789,7 @@ static int count_flagged_radial(BMesh *bm, BMLoop *l, int flag)
                }
                
                i += BM_ELEM_API_FLAG_TEST(l2->f, flag) ? 1 : 0;
-               l2 = bmesh_radial_loop_next(l2);
+               l2 = l2->radial_next;
                if (UNLIKELY(c >= BM_LOOP_RADIAL_MAX)) {
                        BMESH_ASSERT(0);
                        goto error;
@@ -1452,7 +1452,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
                        radlen = bmesh_radial_length(ke->l);
                        if (ke->l) {
                                /* first step, fix the neighboring loops of all loops in ke's radial cycl */
-                               for (i = 0, killoop = ke->l; i < radlen; i++, killoop = bmesh_radial_loop_next(killoop)) {
+                               for (i = 0, killoop = ke->l; i < radlen; i++, killoop = killoop->radial_next) {
                                        /* relink loops and fix vertex pointer */
                                        if (killoop->next->v == kv) {
                                                killoop->next->v = tv;
@@ -1481,7 +1481,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
                                        /* this should be wrapped into a bme_free_radial function to be used by bmesh_KF as well.. */
                                        for (i = 0; i < radlen; i++) {
                                                loops[i] = killoop;
-                                               killoop = bmesh_radial_loop_next(killoop);
+                                               killoop = killoop->radial_next;
                                        }
                                        for (i = 0; i < radlen; i++) {
                                                bm->totloop--;
@@ -1508,7 +1508,7 @@ BMEdge *bmesh_jekv(BMesh *bm, BMEdge *ke, BMVert *kv, const short check_edge_dou
                        BMESH_ASSERT(edok != FALSE);
 
                        /* Validate loop cycle of all faces attached to o */
-                       for (i = 0, l = oe->l; i < radlen; i++, l = bmesh_radial_loop_next(l)) {
+                       for (i = 0, l = oe->l; i < radlen; i++, l = l->radial_next) {
                                BMESH_ASSERT(l->e == oe);
                                edok = bmesh_verts_in_edge(l->v, l->next->v, oe);
                                BMESH_ASSERT(edok != FALSE);
index 6ce0c92a239d4dc73a9cb462243192d05db69a4a..9694053e96737f43fa693383fe3066c99dd7af93 100644 (file)
@@ -291,11 +291,13 @@ void  *bmiter__loops_of_edge_step(BMIter *iter)
 {
        BMLoop *current = iter->nextloop;
 
-       if (iter->nextloop)
-               iter->nextloop = bmesh_radial_loop_next(iter->nextloop);
+       if (iter->nextloop) {
+               iter->nextloop = iter->nextloop->radial_next;
+       }
 
-       if (iter->nextloop == iter->firstloop)
+       if (iter->nextloop == iter->firstloop) {
                iter->nextloop = NULL;
+       }
 
        if (current) {
                return current;
@@ -314,7 +316,7 @@ void  bmiter__loops_of_loop_begin(BMIter *iter)
        init_iterator(iter);
 
        iter->firstloop = l;
-       iter->nextloop = bmesh_radial_loop_next(iter->firstloop);
+       iter->nextloop = iter->firstloop->radial_next;
        
        if (iter->nextloop == iter->firstloop)
                iter->nextloop = NULL;
@@ -324,9 +326,13 @@ void  *bmiter__loops_of_loop_step(BMIter *iter)
 {
        BMLoop *current = iter->nextloop;
        
-       if (iter->nextloop) iter->nextloop = bmesh_radial_loop_next(iter->nextloop);
+       if (iter->nextloop) {
+               iter->nextloop = iter->nextloop->radial_next;
+       }
 
-       if (iter->nextloop == iter->firstloop) iter->nextloop = NULL;
+       if (iter->nextloop == iter->firstloop) {
+               iter->nextloop = NULL;
+       }
 
        if (current) {
                return current;
@@ -353,7 +359,9 @@ void  *bmiter__face_of_edge_step(BMIter *iter)
 {
        BMLoop *current = iter->nextloop;
 
-       if (iter->nextloop) iter->nextloop = bmesh_radial_loop_next(iter->nextloop);
+       if (iter->nextloop) {
+               iter->nextloop = iter->nextloop->radial_next;
+       }
 
        if (iter->nextloop == iter->firstloop) iter->nextloop = NULL;
 
index 7338da927ac5f2e16a9c78f8a7eec3f63812abd3..e597145a54c330fd69bcd91c585fe3efccf14fd3 100644 (file)
@@ -204,13 +204,16 @@ int BM_vert_edge_count(BMVert *v)
 int BM_edge_face_count(BMEdge *e)
 {
        int count = 0;
-       BMLoop *l_iter = NULL;
 
        if (e->l) {
-               l_iter = e->l;
+               BMLoop *l_iter;
+               BMLoop *l_first;
+
+               l_iter = l_first = e->l;
+
                do {
                        count++;
-               } while ((l_iter = bmesh_radial_loop_next(l_iter)) != e->l);
+               } while ((l_iter = l_iter->radial_next) != l_first);
        }
 
        return count;
index 03f116a03baf34170b1c650a80a30516cf64b419..ad6a8a615e390f886d5bd57ad17cc56f9d88ffce 100644 (file)
@@ -131,7 +131,6 @@ int bmesh_edge_swapverts(BMEdge *e, BMVert *orig, BMVert *newv)
  * Functions relating to this cycle:
  * - #bmesh_radial_append
  * - #bmesh_radial_loop_remove
- * - #bmesh_radial_loop_next
  * - #bmesh_radial_face_find
  * - #bmesh_radial_facevert_count
  * - #bmesh_radial_faceloop_find_first
@@ -379,7 +378,7 @@ int bmesh_radial_validate(int radlen, BMLoop *l)
                }
                
                i++;
-       } while ((l_iter = bmesh_radial_loop_next(l_iter)) != l);
+       } while ((l_iter = l_iter->radial_next) != l);
 
        return TRUE;
 }
@@ -438,27 +437,22 @@ BMLoop *bmesh_radial_faceloop_find_first(BMLoop *l, BMVert *v)
                if (l_iter->v == v) {
                        return l_iter;
                }
-       } while ((l_iter = bmesh_radial_loop_next(l_iter)) != l);
+       } while ((l_iter = l_iter->radial_next) != l);
        return NULL;
 }
 
 BMLoop *bmesh_radial_faceloop_find_next(BMLoop *l, BMVert *v)
 {
        BMLoop *l_iter;
-       l_iter = bmesh_radial_loop_next(l);
+       l_iter = l->radial_next;
        do {
                if (l_iter->v == v) {
                        return l_iter;
                }
-       } while ((l_iter = bmesh_radial_loop_next(l_iter)) != l);
+       } while ((l_iter = l_iter->radial_next) != l);
        return l;
 }
 
-BMLoop *bmesh_radial_loop_next(BMLoop *l)
-{
-       return l->radial_next;
-}
-
 int bmesh_radial_length(BMLoop *l)
 {
        BMLoop *l_iter = l;
@@ -536,7 +530,7 @@ int bmesh_radial_facevert_count(BMLoop *l, BMVert *v)
                if (l_iter->v == v) {
                        count++;
                }
-       } while ((l_iter = bmesh_radial_loop_next(l_iter)) != l);
+       } while ((l_iter = l_iter->radial_next) != l);
 
        return count;
 }
index 863c2064e14d6cbb44e43867695a4f95d465061e..c3780a5dede58369cd4dd332a4640d9a7e479e5a 100644 (file)
@@ -56,7 +56,10 @@ BMEdge *bmesh_disk_faceedge_find_next(BMEdge *e, BMVert *v);
 /* RADIAL CYCLE MANAGMENT */
 void    bmesh_radial_append(BMEdge *e, BMLoop *l);
 void    bmesh_radial_loop_remove(BMLoop *l, BMEdge *e);
-BMLoop *bmesh_radial_loop_next(BMLoop *l);
+/* note:
+ *      bmesh_radial_loop_next(BMLoop *l) / prev.
+ * just use member access l->radial_next, l->radial_prev now */
+
 int     bmesh_radial_face_find(BMEdge *e, BMFace *f);
 int     bmesh_radial_facevert_count(BMLoop *l, BMVert *v);
 BMLoop *bmesh_radial_faceloop_find_first(BMLoop *l, BMVert *v);
index b267467a07e6dfe584827bb968baa06f66860b23..014fa87ca1c7d2f0daf20270ab349dfd19f1f608 100644 (file)
@@ -274,8 +274,8 @@ static void *islandboundWalker_step(BMWalker *walker)
        
        while (1) {
                l = BM_face_other_loop(e, f, v);
-               if (bmesh_radial_loop_next(l) != l) {
-                       l = bmesh_radial_loop_next(l);
+               if (l != l->radial_next) {
+                       l = l->radial_next;
                        f = l->f;
                        e = l->e;
                        if (walker->mask_face && !BMO_elem_flag_test(walker->bm, f, walker->mask_face)) {
@@ -479,7 +479,7 @@ static void *loopWalker_step(BMWalker *walker)
                        if (!l)
                                break;
 
-                       l2 = bmesh_radial_loop_next(l);
+                       l2 = l->radial_next;
 
                        if (l2 == l) {
                                break;
index d46d2e99c0b4cac389a7a221228839d8ff091e94..94a6c43e838049a72d3cd26eb08ba5ab4b29ab39 100644 (file)
@@ -53,7 +53,7 @@ static int UNUSED_FUNCTION(check_hole_in_region)(BMesh *bm, BMFace *f)
        for ( ; f2; f2 = BMW_step(&regwalker)) {
                l2 = BM_iter_new(&liter2, bm, BM_LOOPS_OF_FACE, f2);
                for ( ; l2; l2 = BM_iter_step(&liter2)) {
-                       l3 = bmesh_radial_loop_next(l2);
+                       l3 = l2->radial_next;
                        if ( BMO_elem_flag_test(bm, l3->f, FACE_MARK) !=
                             BMO_elem_flag_test(bm, l2->f, FACE_MARK))
                        {
index 11153215f26c5948786692bfd8cc7c978b9f62d8..31892cc0663ba14007434c14d0a9f13be7111cd0 100644 (file)
@@ -559,7 +559,7 @@ static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(opti
                /* find saved loop pointer */
                l = se->l;
                while (l->f != jf) {
-                       l = bmesh_radial_loop_next(l);
+                       l = l->radial_next;
                        BLI_assert(l != se->l);
                }
                l = l->prev;
@@ -605,7 +605,7 @@ static BMLoop *BME_bevel_edge(BMesh *bm, BMLoop *l, float value, int UNUSED(opti
                /* find saved loop pointer */
                l = se->l;
                while (l->f != jf) {
-                       l = bmesh_radial_loop_next(l);
+                       l = l->radial_next;
                        BLI_assert(l != se->l);
                }
        }