Code Cleanup: remove bmesh_radial_loop_next() function,

just access l->radial_next
This commit is contained in:
Campbell Barton
2012-03-01 17:13:02 +00:00
parent c1e8d77842
commit 1f473a78b8
8 changed files with 40 additions and 32 deletions

View 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);

View 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;

View 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;

View 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;
}

View 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);

View 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;

View 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))
{

View 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);
}
}