diff options
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_mods.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mods.c | 292 |
1 files changed, 147 insertions, 145 deletions
diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 9a99d5b96d1..afb3fc8112c 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -64,36 +64,36 @@ * \note dissolves vert, in more situations then BM_disk_dissolve * (e.g. if the vert is part of a wire edge, etc). */ -int BM_vert_dissolve(BMesh *bm, BMVert *v) +bool BM_vert_dissolve(BMesh *bm, BMVert *v) { const int len = BM_vert_edge_count(v); if (len == 1) { BM_vert_kill(bm, v); /* will kill edges too */ - return TRUE; + return true; } else if (!BM_vert_is_manifold(v)) { if (!v->e) { BM_vert_kill(bm, v); - return TRUE; + return true; } else if (!v->e->l) { if (len == 2) { - return (BM_vert_collapse_edge(bm, v->e, v, TRUE) != NULL); + return (BM_vert_collapse_edge(bm, v->e, v, true) != NULL); } else { /* used to kill the vertex here, but it may be connected to faces. * so better do nothing */ - return FALSE; + return false; } } else { - return FALSE; + return false; } } else if (len == 2 && BM_vert_face_count(v) == 1) { /* boundary vertex on a face */ - return (BM_vert_collapse_edge(bm, v->e, v, TRUE) != NULL); + return (BM_vert_collapse_edge(bm, v->e, v, true) != NULL); } else { return BM_disk_dissolve(bm, v); @@ -103,14 +103,14 @@ int BM_vert_dissolve(BMesh *bm, BMVert *v) /** * dissolves all faces around a vert, and removes it. */ -int BM_disk_dissolve(BMesh *bm, BMVert *v) +bool BM_disk_dissolve(BMesh *bm, BMVert *v) { BMFace *f, *f2; BMEdge *e, *keepedge = NULL, *baseedge = NULL; int len = 0; if (!BM_vert_is_manifold(v)) { - return FALSE; + return false; } if (v->e) { @@ -135,62 +135,62 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v) * increasing valence to four. this may be hackish. . */ BMLoop *loop = e->l; if (loop->v == v) loop = loop->next; - if (!BM_face_split(bm, loop->f, v, loop->v, NULL, NULL, FALSE)) - return FALSE; + if (!BM_face_split(bm, loop->f, v, loop->v, NULL, NULL, false)) + return false; if (!BM_disk_dissolve(bm, v)) { - return FALSE; + return false; } #else - if (UNLIKELY(!BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, TRUE))) { - return FALSE; + if (UNLIKELY(!BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, true))) { + return false; } - else if (UNLIKELY(!BM_vert_collapse_faces(bm, v->e, v, 1.0, FALSE, TRUE))) { - return FALSE; + else if (UNLIKELY(!BM_vert_collapse_faces(bm, v->e, v, 1.0, false, true))) { + return false; } #endif - return TRUE; + return true; } else if (keepedge == NULL && len == 2) { /* collapse the vertex */ - e = BM_vert_collapse_faces(bm, v->e, v, 1.0, TRUE, TRUE); + e = BM_vert_collapse_faces(bm, v->e, v, 1.0, true, true); if (!e) { - return FALSE; + return false; } /* handle two-valence */ f = e->l->f; f2 = e->l->radial_next->f; - if (f != f2 && !BM_faces_join_pair(bm, f, f2, e, TRUE)) { - return FALSE; + if (f != f2 && !BM_faces_join_pair(bm, f, f2, e, true)) { + return false; } - return TRUE; + return true; } if (keepedge) { - int done = FALSE; + bool done = false; while (!done) { - done = TRUE; + done = true; e = v->e; do { f = NULL; len = bmesh_radial_length(e->l); if (len == 2 && (e != baseedge) && (e != keepedge)) { - f = BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, TRUE); + f = BM_faces_join_pair(bm, e->l->f, e->l->radial_next->f, e, true); /* return if couldn't join faces in manifold * conditions */ /* !disabled for testing why bad things happen */ if (!f) { - return FALSE; + return false; } } if (f) { - done = FALSE; + done = false; break; } e = bmesh_disk_edge_next(e, v); @@ -199,10 +199,10 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v) /* collapse the vertex */ /* note, the baseedge can be a boundary of manifold, use this as join_faces arg */ - e = BM_vert_collapse_faces(bm, baseedge, v, 1.0, !BM_edge_is_boundary(baseedge), TRUE); + e = BM_vert_collapse_faces(bm, baseedge, v, 1.0, !BM_edge_is_boundary(baseedge), true); if (!e) { - return FALSE; + return false; } /* get remaining two faces */ @@ -211,13 +211,13 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v) if (f != f2) { /* join two remaining faces */ - if (!BM_faces_join_pair(bm, f, f2, e, TRUE)) { - return FALSE; + if (!BM_faces_join_pair(bm, f, f2, e, true)) { + return false; } } } - return TRUE; + return true; } /** @@ -235,7 +235,7 @@ int BM_disk_dissolve(BMesh *bm, BMVert *v) * * \return pointer to the combined face */ -BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e, const short do_del) +BMFace *BM_faces_join_pair(BMesh *bm, BMFace *f1, BMFace *f2, BMEdge *e, const bool do_del) { BMLoop *l1, *l2; BMEdge *jed = NULL; @@ -300,14 +300,14 @@ BMEdge *BM_verts_connect(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **r_f) BM_ITER_ELEM (f_iter, &fiter, v1, BM_FACES_OF_VERT) { BM_ITER_ELEM (v_iter, &viter, f_iter, BM_FACES_OF_VERT) { if (v_iter == v2) { - BMLoop *nl; + BMLoop *l_new; - f_iter = BM_face_split(bm, f_iter, v1, v2, &nl, NULL, FALSE); + f_iter = BM_face_split(bm, f_iter, v1, v2, &l_new, NULL, false); if (r_f) { *r_f = f_iter; } - return nl->e; + return l_new->e; } } } @@ -336,54 +336,54 @@ BMEdge *BM_verts_connect(BMesh *bm, BMVert *v1, BMVert *v2, BMFace **r_f) * other side). NULL if the split fails. */ BMFace *BM_face_split(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, BMLoop **r_l, - BMEdge *example, const short nodouble) + BMEdge *example, const bool no_double) { - const int has_mdisp = CustomData_has_layer(&bm->ldata, CD_MDISPS); - BMFace *nf, *of; + const bool has_mdisp = CustomData_has_layer(&bm->ldata, CD_MDISPS); + BMFace *f_new, *f_tmp; BLI_assert(v1 != v2); /* do we have a multires layer? */ if (has_mdisp) { - of = BM_face_copy(bm, f, FALSE, FALSE); + f_tmp = BM_face_copy(bm, f, false, false); } #ifdef USE_BMESH_HOLES - nf = bmesh_sfme(bm, f, v1, v2, r_l, NULL, example, nodouble); + f_new = bmesh_sfme(bm, f, v1, v2, r_l, NULL, example, no_double); #else - nf = bmesh_sfme(bm, f, v1, v2, r_l, example, nodouble); + f_new = bmesh_sfme(bm, f, v1, v2, r_l, example, no_double); #endif - if (nf) { - BM_elem_attrs_copy(bm, bm, f, nf); - copy_v3_v3(nf->no, f->no); + if (f_new) { + BM_elem_attrs_copy(bm, bm, f, f_new); + copy_v3_v3(f_new->no, f->no); /* handle multires update */ - if (has_mdisp && (nf != f)) { + if (has_mdisp && (f_new != f)) { BMLoop *l_iter; BMLoop *l_first; l_iter = l_first = BM_FACE_FIRST_LOOP(f); do { - BM_loop_interp_multires(bm, l_iter, of); + BM_loop_interp_multires(bm, l_iter, f_tmp); } while ((l_iter = l_iter->next) != l_first); - l_iter = l_first = BM_FACE_FIRST_LOOP(nf); + l_iter = l_first = BM_FACE_FIRST_LOOP(f_new); do { - BM_loop_interp_multires(bm, l_iter, of); + BM_loop_interp_multires(bm, l_iter, f_tmp); } while ((l_iter = l_iter->next) != l_first); - BM_face_kill(bm, of); + BM_face_kill(bm, f_tmp); #if 0 /* BM_face_multires_bounds_smooth doesn't flip displacement correct */ BM_face_multires_bounds_smooth(bm, f); - BM_face_multires_bounds_smooth(bm, nf); + BM_face_multires_bounds_smooth(bm, f_new); #endif } } - return nf; + return f_new; } /** @@ -406,62 +406,62 @@ BMFace *BM_face_split(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, BMLoop **r_l BMFace *BM_face_split_n(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, float cos[][3], int n, BMLoop **r_l, BMEdge *example) { - BMFace *nf, *of; + BMFace *f_new, *f_tmp; BMLoop *l_dummy; - BMEdge *e, *newe; - BMVert *newv; + BMEdge *e, *e_new; + BMVert *v_new; int i, j; BLI_assert(v1 != v2); - of = BM_face_copy(bm, f, TRUE, TRUE); + f_tmp = BM_face_copy(bm, f, true, true); if (!r_l) r_l = &l_dummy; #ifdef USE_BMESH_HOLES - nf = bmesh_sfme(bm, f, v1, v2, r_l, NULL, example, FALSE); + f_new = bmesh_sfme(bm, f, v1, v2, r_l, NULL, example, false); #else - nf = bmesh_sfme(bm, f, v1, v2, r_l, example, FALSE); + f_new = bmesh_sfme(bm, f, v1, v2, r_l, example, false); #endif - /* bmesh_sfme returns in r_l a Loop for nf going from v1 to v2. + /* bmesh_sfme returns in r_l a Loop for f_new going from v1 to v2. * The radial_next is for f and goes from v2 to v1 */ - if (nf) { - BM_elem_attrs_copy(bm, bm, f, nf); - copy_v3_v3(nf->no, f->no); + if (f_new) { + BM_elem_attrs_copy(bm, bm, f, f_new); + copy_v3_v3(f_new->no, f->no); e = (*r_l)->e; for (i = 0; i < n; i++) { - newv = bmesh_semv(bm, v2, e, &newe); - BLI_assert(newv != NULL); - /* bmesh_semv returns in newe the edge going from newv to tv */ - copy_v3_v3(newv->co, cos[i]); + v_new = bmesh_semv(bm, v2, e, &e_new); + BLI_assert(v_new != NULL); + /* bmesh_semv returns in e_new the edge going from v_new to tv */ + copy_v3_v3(v_new->co, cos[i]); - /* interpolate the loop data for the loops with (v == newv), using orig face */ + /* interpolate the loop data for the loops with (v == v_new), using orig face */ for (j = 0; j < 2; j++) { - BMEdge *e_iter = (j == 0) ? e : newe; + BMEdge *e_iter = (j == 0) ? e : e_new; BMLoop *l_iter = e_iter->l; do { - if (l_iter->v == newv) { + if (l_iter->v == v_new) { /* this interpolates both loop and vertex data */ - BM_loop_interp_from_face(bm, l_iter, of, TRUE, TRUE); + BM_loop_interp_from_face(bm, l_iter, f_tmp, true, true); } } while ((l_iter = l_iter->radial_next) != e_iter->l); } - e = newe; + e = e_new; } } - BM_face_verts_kill(bm, of); + BM_face_verts_kill(bm, f_tmp); - return nf; + return f_new; } /** * \brief Vert Collapse Faces * - * Collapses vertex \a kv that has only two manifold edges + * Collapses vertex \a v_kill that has only two manifold edges * onto a vertex it shares an edge with. * \a fac defines the amount of interpolation for Custom Data. * @@ -472,8 +472,8 @@ BMFace *BM_face_split_n(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, float cos[ * Except this takes a factor and merges custom data. * * \param bm The bmesh - * \param ke The edge to collapse - * \param kv The vertex to collapse into the edge + * \param e_kill The edge to collapse + * \param v_kill The vertex to collapse into the edge * \param fac The factor along the edge * \param join_faces When true the faces around the vertex will be joined * otherwise collapse the vertex by merging the 2 edges this vert touches into one. @@ -481,11 +481,11 @@ BMFace *BM_face_split_n(BMesh *bm, BMFace *f, BMVert *v1, BMVert *v2, float cos[ * * \returns The New Edge */ -BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, - const short join_faces, const short kill_degenerate_faces) +BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, float fac, + const bool join_faces, const bool kill_degenerate_faces) { - BMEdge *ne = NULL; - BMVert *tv = bmesh_edge_other_vert_get(ke, kv); + BMEdge *e_new = NULL; + BMVert *tv = bmesh_edge_other_vert_get(e_kill, v_kill); BMEdge *e2; BMVert *tv2; @@ -497,17 +497,17 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, float w[2]; /* Only intended to be called for 2-valence vertices */ - BLI_assert(bmesh_disk_count(kv) <= 2); + BLI_assert(bmesh_disk_count(v_kill) <= 2); /* first modify the face loop data */ w[0] = 1.0f - fac; w[1] = fac; - if (ke->l) { - l_iter = ke->l; + if (e_kill->l) { + l_iter = e_kill->l; do { - if (l_iter->v == tv && l_iter->next->v == kv) { + if (l_iter->v == tv && l_iter->next->v == v_kill) { tvloop = l_iter; kvloop = l_iter->next; @@ -515,30 +515,30 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, src[1] = tvloop->head.data; CustomData_bmesh_interp(&bm->ldata, src, w, NULL, 2, kvloop->head.data); } - } while ((l_iter = l_iter->radial_next) != ke->l); + } while ((l_iter = l_iter->radial_next) != e_kill->l); } /* now interpolate the vertex data */ - BM_data_interp_from_verts(bm, kv, tv, kv, fac); + BM_data_interp_from_verts(bm, v_kill, tv, v_kill, fac); - e2 = bmesh_disk_edge_next(ke, kv); - tv2 = BM_edge_other_vert(e2, kv); + e2 = bmesh_disk_edge_next(e_kill, v_kill); + tv2 = BM_edge_other_vert(e2, v_kill); if (join_faces) { BMFace **faces = NULL; BMFace *f; BLI_array_staticdeclare(faces, 8); - BM_ITER_ELEM (f, &iter, kv, BM_FACES_OF_VERT) { + BM_ITER_ELEM (f, &iter, v_kill, BM_FACES_OF_VERT) { BLI_array_append(faces, f); } if (BLI_array_count(faces) >= 2) { - BMFace *f2 = BM_faces_join(bm, faces, BLI_array_count(faces), TRUE); + BMFace *f2 = BM_faces_join(bm, faces, BLI_array_count(faces), true); if (f2) { - BMLoop *nl = NULL; - if (BM_face_split(bm, f2, tv, tv2, &nl, NULL, FALSE)) { - ne = nl->e; + BMLoop *l_new = NULL; + if (BM_face_split(bm, f2, tv, tv2, &l_new, NULL, false)) { + e_new = l_new->e; } } } @@ -549,16 +549,16 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, /* single face or no faces */ /* same as BM_vert_collapse_edge() however we already * have vars to perform this operation so don't call. */ - ne = bmesh_jekv(bm, ke, kv, TRUE); - /* ne = BM_edge_exists(tv, tv2); */ /* same as return above */ + e_new = bmesh_jekv(bm, e_kill, v_kill, true); + /* e_new = BM_edge_exists(tv, tv2); */ /* same as return above */ - if (ne && kill_degenerate_faces) { + if (e_new && kill_degenerate_faces) { BLI_array_declare(bad_faces); BMFace **bad_faces = NULL; BMIter fiter; BMFace *f; - BMVert *verts[2] = {ne->v1, ne->v2}; + BMVert *verts[2] = {e_new->v1, e_new->v2}; int i; for (i = 0; i < 2; i++) { @@ -577,7 +577,7 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, } } - return ne; + return e_new; } @@ -588,37 +588,37 @@ BMEdge *BM_vert_collapse_faces(BMesh *bm, BMEdge *ke, BMVert *kv, float fac, * * \return The New Edge */ -BMEdge *BM_vert_collapse_edge(BMesh *bm, BMEdge *ke, BMVert *kv, - const short kill_degenerate_faces) +BMEdge *BM_vert_collapse_edge(BMesh *bm, BMEdge *e_kill, BMVert *v_kill, + const bool kill_degenerate_faces) { /* nice example implementation but we want loops to have their customdata * accounted for */ #if 0 - BMEdge *ne = NULL; + BMEdge *e_new = NULL; /* Collapse between 2 edges */ /* in this case we want to keep all faces and not join them, * rather just get rid of the vertex - see bug [#28645] */ - BMVert *tv = bmesh_edge_other_vert_get(ke, kv); + BMVert *tv = bmesh_edge_other_vert_get(e_kill, v_kill); if (tv) { - BMEdge *e2 = bmesh_disk_edge_next(ke, kv); + BMEdge *e2 = bmesh_disk_edge_next(e_kill, v_kill); if (e2) { - BMVert *tv2 = BM_edge_other_vert(e2, kv); + BMVert *tv2 = BM_edge_other_vert(e2, v_kill); if (tv2) { /* only action, other calls here only get the edge to return */ - ne = bmesh_jekv(bm, ke, kv); + e_new = bmesh_jekv(bm, e_kill, v_kill); - /* ne = BM_edge_exists(tv, tv2); */ /* same as return above */ + /* e_new = BM_edge_exists(tv, tv2); */ /* same as return above */ } } } - return ne; + return e_new; #else /* with these args faces are never joined, same as above * but account for loop customdata */ - return BM_vert_collapse_faces(bm, ke, kv, 1.0f, FALSE, kill_degenerate_faces); + return BM_vert_collapse_faces(bm, e_kill, v_kill, 1.0f, false, kill_degenerate_faces); #endif } @@ -637,11 +637,11 @@ BMEdge *BM_vert_collapse_edge(BMesh *bm, BMEdge *ke, BMVert *kv, */ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float percent) { - BMVert *nv, *v2; + BMVert *v_new, *v2; BMFace **oldfaces = NULL; BMEdge *e_dummy; BLI_array_staticdeclare(oldfaces, 32); - const int do_mdisp = (e->l && CustomData_has_layer(&bm->ldata, CD_MDISPS)); + const bool do_mdisp = (e->l && CustomData_has_layer(&bm->ldata, CD_MDISPS)); /* we need this for handling multi-res */ if (!r_e) { @@ -662,27 +662,27 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float perce /* flag existing faces so we can differentiate oldfaces from new faces */ for (i = 0; i < BLI_array_count(oldfaces); i++) { BM_ELEM_API_FLAG_ENABLE(oldfaces[i], _FLAG_OVERLAP); - oldfaces[i] = BM_face_copy(bm, oldfaces[i], TRUE, TRUE); + oldfaces[i] = BM_face_copy(bm, oldfaces[i], true, true); BM_ELEM_API_FLAG_DISABLE(oldfaces[i], _FLAG_OVERLAP); } } v2 = bmesh_edge_other_vert_get(e, v); - nv = bmesh_semv(bm, v, e, r_e); + v_new = bmesh_semv(bm, v, e, r_e); - BLI_assert(nv != NULL); + BLI_assert(v_new != NULL); - sub_v3_v3v3(nv->co, v2->co, v->co); - madd_v3_v3v3fl(nv->co, v->co, nv->co, percent); + sub_v3_v3v3(v_new->co, v2->co, v->co); + madd_v3_v3v3fl(v_new->co, v->co, v_new->co, percent); if (r_e) { (*r_e)->head.hflag = e->head.hflag; BM_elem_attrs_copy(bm, bm, e, *r_e); } - /* v->nv->v2 */ - BM_data_interp_face_vert_edge(bm, v2, v, nv, e, percent); - BM_data_interp_from_verts(bm, v, v2, nv, percent); + /* v->v_new->v2 */ + BM_data_interp_face_vert_edge(bm, v2, v, v_new, e, percent); + BM_data_interp_from_verts(bm, v, v2, v_new, percent); if (do_mdisp) { int i, j; @@ -742,7 +742,7 @@ BMVert *BM_edge_split(BMesh *bm, BMEdge *e, BMVert *v, BMEdge **r_e, float perce BLI_array_free(oldfaces); } - return nv; + return v_new; } /** @@ -752,25 +752,27 @@ BMVert *BM_edge_split_n(BMesh *bm, BMEdge *e, int numcuts) { int i; float percent; - BMVert *nv = NULL; + BMVert *v_new = NULL; for (i = 0; i < numcuts; i++) { percent = 1.0f / (float)(numcuts + 1 - i); - nv = BM_edge_split(bm, e, e->v2, NULL, percent); + v_new = BM_edge_split(bm, e, e->v2, NULL, percent); } - return nv; + return v_new; } +#if 0 /** * Checks if a face is valid in the data structure */ -int BM_face_validate(BMFace *face, FILE *err) +bool BM_face_validate(BMFace *face, FILE *err) { BMIter iter; BLI_array_declare(verts); BMVert **verts = NULL; BMLoop *l; - int ret = 1, i, j; + int i, j; + bool ret = true; if (face->len == 2) { fprintf(err, "warning: found two-edged face. face ptr: %p\n", face); @@ -784,7 +786,7 @@ int BM_face_validate(BMFace *face, FILE *err) fprintf(err, "Found bmesh edge with identical verts!\n"); fprintf(err, " edge ptr: %p, vert: %p\n", l->e, l->e->v1); fflush(err); - ret = 0; + ret = false; } } @@ -798,7 +800,7 @@ int BM_face_validate(BMFace *face, FILE *err) fprintf(err, "Found duplicate verts in bmesh face!\n"); fprintf(err, " face ptr: %p, vert: %p\n", face, verts[i]); fflush(err); - ret = 0; + ret = false; } } } @@ -806,7 +808,7 @@ int BM_face_validate(BMFace *face, FILE *err) BLI_array_free(verts); return ret; } - +#endif /** * Calculate the 2 loops which _would_ make up the newly rotated Edge @@ -822,14 +824,14 @@ int BM_face_validate(BMFace *face, FILE *err) * * \note #BM_edge_rotate_check must have already run. */ -void BM_edge_calc_rotate(BMEdge *e, int ccw, +void BM_edge_calc_rotate(BMEdge *e, const bool ccw, BMLoop **r_l1, BMLoop **r_l2) { BMVert *v1, *v2; BMFace *fa, *fb; /* this should have already run */ - BLI_assert(BM_edge_rotate_check(e) == TRUE); + BLI_assert(BM_edge_rotate_check(e) == true); /* we know this will work */ BM_edge_face_pair(e, &fa, &fb); @@ -855,7 +857,7 @@ void BM_edge_calc_rotate(BMEdge *e, int ccw, * Quick check to see if we could rotate the edge, * use this to avoid calling exceptions on common cases. */ -int BM_edge_rotate_check(BMEdge *e) +bool BM_edge_rotate_check(BMEdge *e) { BMFace *fa, *fb; if (BM_edge_face_pair(e, &fa, &fb)) { @@ -868,7 +870,7 @@ int BM_edge_rotate_check(BMEdge *e) * (ie - the next edge doesn't share the same faces). * since we can't rotate usefully in this case. */ if (la->v == lb->v) { - return FALSE; + return false; } /* mirror of the check above but in the opposite direction */ @@ -876,13 +878,13 @@ int BM_edge_rotate_check(BMEdge *e) lb = BM_face_other_vert_loop(fb, e->v1, e->v2); if (la->v == lb->v) { - return FALSE; + return false; } - return TRUE; + return true; } else { - return FALSE; + return false; } } @@ -897,7 +899,7 @@ int BM_edge_rotate_check(BMEdge *e) * \param l1,l2 are the loops of the proposed verts to rotate too and should * be the result of calling #BM_edge_calc_rotate */ -int BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2) +bool BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2) { /* note: for these vars 'old' just means initial edge state. */ @@ -924,7 +926,7 @@ int BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2) BMVert *v1_alt, *v2_alt; /* this should have already run */ - BLI_assert(BM_edge_rotate_check(e) == TRUE); + BLI_assert(BM_edge_rotate_check(e) == true); BM_edge_ordered_verts(e, &v1_old, &v2_old); @@ -965,12 +967,12 @@ int BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2) cross_v3_v3v3(cross_old, ed_dir_old, ed_dir_v1_old); cross_v3_v3v3(cross_new, ed_dir_new, ed_dir_v1_new); if (dot_v3v3(cross_old, cross_new) < 0.0f) { /* does this flip? */ - return FALSE; + return false; } cross_v3_v3v3(cross_old, ed_dir_old, ed_dir_v2_old); cross_v3_v3v3(cross_new, ed_dir_new, ed_dir_v2_new); if (dot_v3v3(cross_old, cross_new) < 0.0f) { /* does this flip? */ - return FALSE; + return false; } negate_v3_v3(ed_dir_new_flip, ed_dir_new); @@ -979,14 +981,14 @@ int BM_edge_rotate_check_degenerate(BMEdge *e, BMLoop *l1, BMLoop *l2) if ((dot_v3v3(ed_dir_new, ed_dir_v1_new) > 0.999f) || (dot_v3v3(ed_dir_new_flip, ed_dir_v2_new) > 0.999f)) { - return FALSE; + return false; } - return TRUE; + return true; } -int BM_edge_rotate_check_beauty(BMEdge *e, - BMLoop *l1, BMLoop *l2) +bool BM_edge_rotate_check_beauty(BMEdge *e, + BMLoop *l1, BMLoop *l2) { /* Stupid check for now: * Could compare angles of surrounding edges @@ -1009,7 +1011,7 @@ int BM_edge_rotate_check_beauty(BMEdge *e, * * \see header definition for \a check_flag enum. */ -BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_flag) +BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const bool ccw, const short check_flag) { BMVert *v1, *v2; BMLoop *l1, *l2; @@ -1066,7 +1068,7 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_ f_hflag_prev_2 = l2->f->head.hflag; /* don't delete the edge, manually remove the egde after so we can copy its attributes */ - f = BM_faces_join_pair(bm, l1->f, l2->f, NULL, TRUE); + f = BM_faces_join_pair(bm, l1->f, l2->f, NULL, true); if (f == NULL) { return NULL; @@ -1075,7 +1077,7 @@ BMEdge *BM_edge_rotate(BMesh *bm, BMEdge *e, const short ccw, const short check_ /* note, this assumes joining the faces _didnt_ also remove the verts. * the #BM_edge_rotate_check will ensure this, but its possibly corrupt state or future edits * break this */ - if (!BM_face_split(bm, f, v1, v2, NULL, NULL, TRUE)) { + if (!BM_face_split(bm, f, v1, v2, NULL, NULL, true)) { return NULL; } else { |