Cleanup: BMesh, Clang-Tidy else-after-return fixes
This addresses warnings from Clang-Tidy's `readability-else-after-return` rule in the `source/blender/bmesh` module. No functional changes.
This commit is contained in:
parent
f3b8792b96
commit
20869065b8
|
@ -1826,117 +1826,116 @@ BMEdge *bmesh_kernel_join_edge_kill_vert(BMesh *bm,
|
|||
if (BM_verts_in_edge(v_kill, v_target, e_old)) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
BMEdge *e_splice;
|
||||
BLI_SMALLSTACK_DECLARE(faces_degenerate, BMFace *);
|
||||
BMLoop *l_kill_next;
|
||||
|
||||
BMEdge *e_splice;
|
||||
BLI_SMALLSTACK_DECLARE(faces_degenerate, BMFace *);
|
||||
BMLoop *l_kill_next;
|
||||
|
||||
#ifndef NDEBUG
|
||||
/* For verification later, count valence of 'v_old' and 'v_target' */
|
||||
valence1 = bmesh_disk_count(v_old);
|
||||
valence2 = bmesh_disk_count(v_target);
|
||||
/* For verification later, count valence of 'v_old' and 'v_target' */
|
||||
valence1 = bmesh_disk_count(v_old);
|
||||
valence2 = bmesh_disk_count(v_target);
|
||||
#endif
|
||||
|
||||
if (check_edge_double) {
|
||||
e_splice = BM_edge_exists(v_target, v_old);
|
||||
}
|
||||
|
||||
bmesh_disk_vert_replace(e_old, v_target, v_kill);
|
||||
|
||||
/* remove e_kill from 'v_target's disk cycle */
|
||||
bmesh_disk_edge_remove(e_kill, v_target);
|
||||
|
||||
#ifndef NDEBUG
|
||||
/* deal with radial cycle of e_kill */
|
||||
radlen = bmesh_radial_length(e_kill->l);
|
||||
#endif
|
||||
if (e_kill->l) {
|
||||
|
||||
/* fix the neighboring loops of all loops in e_kill's radial cycle */
|
||||
l_kill = e_kill->l;
|
||||
do {
|
||||
/* relink loops and fix vertex pointer */
|
||||
if (l_kill->next->v == v_kill) {
|
||||
l_kill->next->v = v_target;
|
||||
}
|
||||
|
||||
l_kill->next->prev = l_kill->prev;
|
||||
l_kill->prev->next = l_kill->next;
|
||||
if (BM_FACE_FIRST_LOOP(l_kill->f) == l_kill) {
|
||||
BM_FACE_FIRST_LOOP(l_kill->f) = l_kill->next;
|
||||
}
|
||||
|
||||
/* fix len attribute of face */
|
||||
l_kill->f->len--;
|
||||
if (kill_degenerate_faces) {
|
||||
if (l_kill->f->len < 3) {
|
||||
BLI_SMALLSTACK_PUSH(faces_degenerate, l_kill->f);
|
||||
}
|
||||
}
|
||||
l_kill_next = l_kill->radial_next;
|
||||
|
||||
bm_kill_only_loop(bm, l_kill);
|
||||
|
||||
} while ((l_kill = l_kill_next) != e_kill->l);
|
||||
/* `e_kill->l` is invalid but the edge is freed next. */
|
||||
#ifndef NDEBUG
|
||||
/* Validate radial cycle of e_old */
|
||||
edok = bmesh_radial_validate(radlen, e_old->l);
|
||||
BMESH_ASSERT(edok != false);
|
||||
#endif
|
||||
}
|
||||
/* deallocate edge */
|
||||
bm_kill_only_edge(bm, e_kill);
|
||||
|
||||
/* deallocate vertex */
|
||||
if (do_del) {
|
||||
bm_kill_only_vert(bm, v_kill);
|
||||
}
|
||||
else {
|
||||
v_kill->e = NULL;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
/* Validate disk cycle lengths of 'v_old', 'v_target' are unchanged */
|
||||
edok = bmesh_disk_validate(valence1, v_old->e, v_old);
|
||||
BMESH_ASSERT(edok != false);
|
||||
edok = bmesh_disk_validate(valence2, v_target->e, v_target);
|
||||
BMESH_ASSERT(edok != false);
|
||||
|
||||
/* Validate loop cycle of all faces attached to 'e_old' */
|
||||
for (i = 0, l = e_old->l; i < radlen; i++, l = l->radial_next) {
|
||||
BMESH_ASSERT(l->e == e_old);
|
||||
edok = BM_verts_in_edge(l->v, l->next->v, e_old);
|
||||
BMESH_ASSERT(edok != false);
|
||||
edok = bmesh_loop_validate(l->f);
|
||||
BMESH_ASSERT(edok != false);
|
||||
|
||||
BM_CHECK_ELEMENT(l);
|
||||
BM_CHECK_ELEMENT(l->v);
|
||||
BM_CHECK_ELEMENT(l->e);
|
||||
BM_CHECK_ELEMENT(l->f);
|
||||
}
|
||||
#endif
|
||||
if (check_edge_double) {
|
||||
if (e_splice) {
|
||||
/* removes e_splice */
|
||||
BM_edge_splice(bm, e_old, e_splice);
|
||||
}
|
||||
}
|
||||
|
||||
if (kill_degenerate_faces) {
|
||||
BMFace *f_kill;
|
||||
while ((f_kill = BLI_SMALLSTACK_POP(faces_degenerate))) {
|
||||
BM_face_kill(bm, f_kill);
|
||||
}
|
||||
}
|
||||
|
||||
BM_CHECK_ELEMENT(v_old);
|
||||
BM_CHECK_ELEMENT(v_target);
|
||||
BM_CHECK_ELEMENT(e_old);
|
||||
|
||||
return e_old;
|
||||
if (check_edge_double) {
|
||||
e_splice = BM_edge_exists(v_target, v_old);
|
||||
}
|
||||
|
||||
bmesh_disk_vert_replace(e_old, v_target, v_kill);
|
||||
|
||||
/* remove e_kill from 'v_target's disk cycle */
|
||||
bmesh_disk_edge_remove(e_kill, v_target);
|
||||
|
||||
#ifndef NDEBUG
|
||||
/* deal with radial cycle of e_kill */
|
||||
radlen = bmesh_radial_length(e_kill->l);
|
||||
#endif
|
||||
if (e_kill->l) {
|
||||
|
||||
/* fix the neighboring loops of all loops in e_kill's radial cycle */
|
||||
l_kill = e_kill->l;
|
||||
do {
|
||||
/* relink loops and fix vertex pointer */
|
||||
if (l_kill->next->v == v_kill) {
|
||||
l_kill->next->v = v_target;
|
||||
}
|
||||
|
||||
l_kill->next->prev = l_kill->prev;
|
||||
l_kill->prev->next = l_kill->next;
|
||||
if (BM_FACE_FIRST_LOOP(l_kill->f) == l_kill) {
|
||||
BM_FACE_FIRST_LOOP(l_kill->f) = l_kill->next;
|
||||
}
|
||||
|
||||
/* fix len attribute of face */
|
||||
l_kill->f->len--;
|
||||
if (kill_degenerate_faces) {
|
||||
if (l_kill->f->len < 3) {
|
||||
BLI_SMALLSTACK_PUSH(faces_degenerate, l_kill->f);
|
||||
}
|
||||
}
|
||||
l_kill_next = l_kill->radial_next;
|
||||
|
||||
bm_kill_only_loop(bm, l_kill);
|
||||
|
||||
} while ((l_kill = l_kill_next) != e_kill->l);
|
||||
/* `e_kill->l` is invalid but the edge is freed next. */
|
||||
#ifndef NDEBUG
|
||||
/* Validate radial cycle of e_old */
|
||||
edok = bmesh_radial_validate(radlen, e_old->l);
|
||||
BMESH_ASSERT(edok != false);
|
||||
#endif
|
||||
}
|
||||
/* deallocate edge */
|
||||
bm_kill_only_edge(bm, e_kill);
|
||||
|
||||
/* deallocate vertex */
|
||||
if (do_del) {
|
||||
bm_kill_only_vert(bm, v_kill);
|
||||
}
|
||||
else {
|
||||
v_kill->e = NULL;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
/* Validate disk cycle lengths of 'v_old', 'v_target' are unchanged */
|
||||
edok = bmesh_disk_validate(valence1, v_old->e, v_old);
|
||||
BMESH_ASSERT(edok != false);
|
||||
edok = bmesh_disk_validate(valence2, v_target->e, v_target);
|
||||
BMESH_ASSERT(edok != false);
|
||||
|
||||
/* Validate loop cycle of all faces attached to 'e_old' */
|
||||
for (i = 0, l = e_old->l; i < radlen; i++, l = l->radial_next) {
|
||||
BMESH_ASSERT(l->e == e_old);
|
||||
edok = BM_verts_in_edge(l->v, l->next->v, e_old);
|
||||
BMESH_ASSERT(edok != false);
|
||||
edok = bmesh_loop_validate(l->f);
|
||||
BMESH_ASSERT(edok != false);
|
||||
|
||||
BM_CHECK_ELEMENT(l);
|
||||
BM_CHECK_ELEMENT(l->v);
|
||||
BM_CHECK_ELEMENT(l->e);
|
||||
BM_CHECK_ELEMENT(l->f);
|
||||
}
|
||||
#endif
|
||||
if (check_edge_double) {
|
||||
if (e_splice) {
|
||||
/* removes e_splice */
|
||||
BM_edge_splice(bm, e_old, e_splice);
|
||||
}
|
||||
}
|
||||
|
||||
if (kill_degenerate_faces) {
|
||||
BMFace *f_kill;
|
||||
while ((f_kill = BLI_SMALLSTACK_POP(faces_degenerate))) {
|
||||
BM_face_kill(bm, f_kill);
|
||||
}
|
||||
}
|
||||
|
||||
BM_CHECK_ELEMENT(v_old);
|
||||
BM_CHECK_ELEMENT(v_target);
|
||||
BM_CHECK_ELEMENT(e_old);
|
||||
|
||||
return e_old;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -2373,23 +2372,22 @@ void bmesh_kernel_vert_separate(
|
|||
* if 'edges' were alloc'd it'd be freed here. */
|
||||
break;
|
||||
}
|
||||
else {
|
||||
BMVert *v_new;
|
||||
|
||||
v_new = BM_vert_create(bm, v->co, v, BM_CREATE_NOP);
|
||||
if (copy_select) {
|
||||
BM_elem_select_copy(bm, v_new, v);
|
||||
}
|
||||
BMVert *v_new;
|
||||
|
||||
while ((e = BLI_SMALLSTACK_POP(edges))) {
|
||||
bmesh_edge_vert_swap(e, v_new, v);
|
||||
}
|
||||
|
||||
if (r_vout) {
|
||||
BLI_SMALLSTACK_PUSH(verts_new, v_new);
|
||||
}
|
||||
verts_num += 1;
|
||||
v_new = BM_vert_create(bm, v->co, v, BM_CREATE_NOP);
|
||||
if (copy_select) {
|
||||
BM_elem_select_copy(bm, v_new, v);
|
||||
}
|
||||
|
||||
while ((e = BLI_SMALLSTACK_POP(edges))) {
|
||||
bmesh_edge_vert_swap(e, v_new, v);
|
||||
}
|
||||
|
||||
if (r_vout) {
|
||||
BLI_SMALLSTACK_PUSH(verts_new, v_new);
|
||||
}
|
||||
verts_num += 1;
|
||||
}
|
||||
|
||||
#undef EDGE_VISIT
|
||||
|
|
|
@ -651,9 +651,7 @@ bool BM_edgeloop_calc_normal(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store)
|
|||
el_store->no[2] = 1.0f; /* other axis set to 0.0 */
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -693,9 +691,7 @@ bool BM_edgeloop_calc_normal_aligned(BMesh *UNUSED(bm),
|
|||
el_store->no[2] = 1.0f; /* other axis set to 0.0 */
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void BM_edgeloop_flip(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store)
|
||||
|
|
|
@ -160,13 +160,12 @@ void BM_data_interp_face_vert_edge(BMesh *bm,
|
|||
if (!l_v1 || !l_v2) {
|
||||
return;
|
||||
}
|
||||
else {
|
||||
const void *src[2];
|
||||
src[0] = l_v1->head.data;
|
||||
src[1] = l_v2->head.data;
|
||||
|
||||
CustomData_bmesh_interp(&bm->ldata, src, w, NULL, 2, l_v->head.data);
|
||||
}
|
||||
const void *src[2];
|
||||
src[0] = l_v1->head.data;
|
||||
src[1] = l_v2->head.data;
|
||||
|
||||
CustomData_bmesh_interp(&bm->ldata, src, w, NULL, 2, l_v->head.data);
|
||||
} while ((l_iter = l_iter->radial_next) != e->l);
|
||||
}
|
||||
|
||||
|
|
|
@ -206,10 +206,9 @@ void *BM_iter_as_arrayN(BMesh *bm,
|
|||
}
|
||||
return array;
|
||||
}
|
||||
else {
|
||||
*r_len = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*r_len = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *BMO_iter_as_arrayN(BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
|
||||
|
@ -244,10 +243,9 @@ void *BMO_iter_as_arrayN(BMOpSlot slot_args[BMO_OP_MAX_SLOTS],
|
|||
*r_len = i;
|
||||
return array;
|
||||
}
|
||||
else {
|
||||
*r_len = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
*r_len = 0;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int BM_iter_mesh_bitmap_from_filter(const char itype,
|
||||
|
|
|
@ -183,9 +183,7 @@ static float vert_mask_get(BMVert *v, const int cd_vert_mask_offset)
|
|||
if (cd_vert_mask_offset != -1) {
|
||||
return BM_ELEM_CD_GET_FLOAT(v, cd_vert_mask_offset);
|
||||
}
|
||||
else {
|
||||
return 0.0f;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
/* Set a vertex's paint-mask value
|
||||
|
|
|
@ -743,7 +743,7 @@ BMFace *BM_mesh_active_face_get(BMesh *bm, const bool is_sloppy, const bool is_s
|
|||
if (bm->act_face && (!is_selected || BM_elem_flag_test(bm->act_face, BM_ELEM_SELECT))) {
|
||||
return bm->act_face;
|
||||
}
|
||||
else if (is_sloppy) {
|
||||
if (is_sloppy) {
|
||||
BMIter iter;
|
||||
BMFace *f = NULL;
|
||||
BMEditSelection *ese;
|
||||
|
@ -953,9 +953,7 @@ bool _bm_select_history_remove(BMesh *bm, BMHeader *ele)
|
|||
BLI_freelinkN(&bm->selected, ese);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void _bm_select_history_store_notest(BMesh *bm, BMHeader *ele)
|
||||
|
|
|
@ -650,7 +650,7 @@ bool BM_loop_check_cyclic_smooth_fan(BMLoop *l_curr)
|
|||
return false;
|
||||
}
|
||||
/* Smooth loop/edge... */
|
||||
else if (BM_elem_flag_test(lfan_pivot_next, BM_ELEM_TAG)) {
|
||||
if (BM_elem_flag_test(lfan_pivot_next, BM_ELEM_TAG)) {
|
||||
if (lfan_pivot_next == l_curr) {
|
||||
/* We walked around a whole cyclic smooth fan
|
||||
* without finding any already-processed loop,
|
||||
|
@ -660,10 +660,8 @@ bool BM_loop_check_cyclic_smooth_fan(BMLoop *l_curr)
|
|||
/* ... already checked in some previous looping, we can abort. */
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
/* ... we can skip it in future, and keep checking the smooth fan. */
|
||||
BM_elem_flag_enable(lfan_pivot_next, BM_ELEM_TAG);
|
||||
}
|
||||
/* ... we can skip it in future, and keep checking the smooth fan. */
|
||||
BM_elem_flag_enable(lfan_pivot_next, BM_ELEM_TAG);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2389,9 +2387,7 @@ BMVert *BM_vert_at_index_find_or_table(BMesh *bm, const int index)
|
|||
if ((bm->elem_table_dirty & BM_VERT) == 0) {
|
||||
return (index < bm->totvert) ? bm->vtable[index] : NULL;
|
||||
}
|
||||
else {
|
||||
return BM_vert_at_index_find(bm, index);
|
||||
}
|
||||
return BM_vert_at_index_find(bm, index);
|
||||
}
|
||||
|
||||
BMEdge *BM_edge_at_index_find_or_table(BMesh *bm, const int index)
|
||||
|
@ -2399,9 +2395,7 @@ BMEdge *BM_edge_at_index_find_or_table(BMesh *bm, const int index)
|
|||
if ((bm->elem_table_dirty & BM_EDGE) == 0) {
|
||||
return (index < bm->totedge) ? bm->etable[index] : NULL;
|
||||
}
|
||||
else {
|
||||
return BM_edge_at_index_find(bm, index);
|
||||
}
|
||||
return BM_edge_at_index_find(bm, index);
|
||||
}
|
||||
|
||||
BMFace *BM_face_at_index_find_or_table(BMesh *bm, const int index)
|
||||
|
@ -2409,9 +2403,7 @@ BMFace *BM_face_at_index_find_or_table(BMesh *bm, const int index)
|
|||
if ((bm->elem_table_dirty & BM_FACE) == 0) {
|
||||
return (index < bm->totface) ? bm->ftable[index] : NULL;
|
||||
}
|
||||
else {
|
||||
return BM_face_at_index_find(bm, index);
|
||||
}
|
||||
return BM_face_at_index_find(bm, index);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -65,32 +65,26 @@ bool BM_vert_dissolve(BMesh *bm, BMVert *v)
|
|||
BM_vert_kill(bm, v); /* will kill edges too */
|
||||
return true;
|
||||
}
|
||||
else if (!BM_vert_is_manifold(v)) {
|
||||
if (!BM_vert_is_manifold(v)) {
|
||||
if (!v->e) {
|
||||
BM_vert_kill(bm, v);
|
||||
return true;
|
||||
}
|
||||
else if (!v->e->l) {
|
||||
if (!v->e->l) {
|
||||
if (len == 2) {
|
||||
return (BM_vert_collapse_edge(bm, v->e, v, true, true) != NULL);
|
||||
}
|
||||
else {
|
||||
/* used to kill the vertex here, but it may be connected to faces.
|
||||
* so better do nothing */
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* used to kill the vertex here, but it may be connected to faces.
|
||||
* so better do nothing */
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else if (len == 2 && BM_vert_face_count_is_equal(v, 1)) {
|
||||
if (len == 2 && BM_vert_face_count_is_equal(v, 1)) {
|
||||
/* boundary vertex on a face */
|
||||
return (BM_vert_collapse_edge(bm, v->e, v, true, true) != NULL);
|
||||
}
|
||||
else {
|
||||
return BM_disk_dissolve(bm, v);
|
||||
}
|
||||
return BM_disk_dissolve(bm, v);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -139,13 +133,13 @@ bool BM_disk_dissolve(BMesh *bm, BMVert *v)
|
|||
if (UNLIKELY(!BM_faces_join_pair(bm, e->l, e->l->radial_next, true))) {
|
||||
return false;
|
||||
}
|
||||
else if (UNLIKELY(!BM_vert_collapse_faces(bm, v->e, v, 1.0, true, false, true))) {
|
||||
if (UNLIKELY(!BM_vert_collapse_faces(bm, v->e, v, 1.0, true, false, true))) {
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
else if (keepedge == NULL && len == 2) {
|
||||
if (keepedge == NULL && len == 2) {
|
||||
/* collapse the vertex */
|
||||
e = BM_vert_collapse_faces(bm, v->e, v, 1.0, true, true, true);
|
||||
|
||||
|
@ -855,9 +849,7 @@ bool BM_edge_rotate_check(BMEdge *e)
|
|||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1501,7 +1501,7 @@ void *BMO_iter_step(BMOIter *iter)
|
|||
|
||||
return ele;
|
||||
}
|
||||
else if (slot->slot_type == BMO_OP_SLOT_MAPPING) {
|
||||
if (slot->slot_type == BMO_OP_SLOT_MAPPING) {
|
||||
void *ret;
|
||||
|
||||
if (BLI_ghashIterator_done(&iter->giter) == false) {
|
||||
|
@ -1517,9 +1517,7 @@ void *BMO_iter_step(BMOIter *iter)
|
|||
|
||||
return ret;
|
||||
}
|
||||
else {
|
||||
BLI_assert(0);
|
||||
}
|
||||
BLI_assert(0);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -743,9 +743,7 @@ bool BM_vert_calc_normal_ex(const BMVert *v, const char hflag, float r_no[3])
|
|||
normalize_v3(r_no);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool BM_vert_calc_normal(const BMVert *v, float r_no[3])
|
||||
|
@ -773,9 +771,7 @@ bool BM_vert_calc_normal(const BMVert *v, float r_no[3])
|
|||
normalize_v3(r_no);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void BM_vert_normal_update_all(BMVert *v)
|
||||
|
|
|
@ -449,9 +449,7 @@ static bool bm_face_split_edgenet_find_loop(BMVert *v_init,
|
|||
*r_face_verts_len = i;
|
||||
return (i > 2) ? true : false;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1217,9 +1215,7 @@ static bool bm_vert_partial_connect_check_overlap(const int *remap,
|
|||
if (UNLIKELY((remap[v_a_index] == v_b_index) || (remap[v_b_index] == v_a_index))) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#endif /* USE_PARTIAL_CONNECT */
|
||||
|
|
|
@ -104,20 +104,16 @@ BMLoop *BM_face_other_vert_loop(BMFace *f, BMVert *v_prev, BMVert *v)
|
|||
if (l_iter->prev->v == v_prev) {
|
||||
return l_iter->next;
|
||||
}
|
||||
else if (l_iter->next->v == v_prev) {
|
||||
if (l_iter->next->v == v_prev) {
|
||||
return l_iter->prev;
|
||||
}
|
||||
else {
|
||||
/* invalid args */
|
||||
BLI_assert(0);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* invalid args */
|
||||
BLI_assert(0);
|
||||
return NULL;
|
||||
}
|
||||
/* invalid args */
|
||||
BLI_assert(0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,23 +143,17 @@ BMLoop *BM_loop_other_vert_loop(BMLoop *l, BMVert *v)
|
|||
if (l->prev->v == v_prev) {
|
||||
return l->next;
|
||||
}
|
||||
else {
|
||||
BLI_assert(l->next->v == v_prev);
|
||||
BLI_assert(l->next->v == v_prev);
|
||||
|
||||
return l->prev;
|
||||
}
|
||||
return l->prev;
|
||||
}
|
||||
else {
|
||||
BLI_assert(l->v == v_prev);
|
||||
BLI_assert(l->v == v_prev);
|
||||
|
||||
if (l->prev->v == v) {
|
||||
return l->prev->prev;
|
||||
}
|
||||
else {
|
||||
BLI_assert(l->next->v == v);
|
||||
return l->next->next;
|
||||
}
|
||||
if (l->prev->v == v) {
|
||||
return l->prev->prev;
|
||||
}
|
||||
BLI_assert(l->next->v == v);
|
||||
return l->next->next;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -302,9 +292,7 @@ static float bm_face_calc_split_dot(BMLoop *l_a, BMLoop *l_b)
|
|||
(BM_face_calc_normal_subset(l_b, l_a, no[1]) != 0.0f)) {
|
||||
return dot_v3v3(no[0], no[1]);
|
||||
}
|
||||
else {
|
||||
return -1.0f;
|
||||
}
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -634,9 +622,7 @@ BMLoop *BM_vert_step_fan_loop(BMLoop *l, BMEdge **e_step)
|
|||
if (BM_edge_is_manifold(e_next)) {
|
||||
return BM_edge_other_loop((*e_step = e_next), l);
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -722,11 +708,10 @@ bool BM_edge_face_pair(BMEdge *e, BMFace **r_fa, BMFace **r_fb)
|
|||
*r_fb = lb->f;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
*r_fa = NULL;
|
||||
*r_fb = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
*r_fa = NULL;
|
||||
*r_fb = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -744,11 +729,10 @@ bool BM_edge_loop_pair(BMEdge *e, BMLoop **r_la, BMLoop **r_lb)
|
|||
*r_lb = lb;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
*r_la = NULL;
|
||||
*r_lb = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
*r_la = NULL;
|
||||
*r_lb = NULL;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -916,9 +900,7 @@ bool BM_vert_is_wire(const BMVert *v)
|
|||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1167,9 +1149,7 @@ bool BM_vert_is_boundary(const BMVert *v)
|
|||
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1359,12 +1339,10 @@ BMVert *BM_edge_share_vert(BMEdge *e1, BMEdge *e2)
|
|||
if (BM_vert_in_edge(e2, e1->v1)) {
|
||||
return e1->v1;
|
||||
}
|
||||
else if (BM_vert_in_edge(e2, e1->v2)) {
|
||||
if (BM_vert_in_edge(e2, e1->v2)) {
|
||||
return e1->v2;
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1381,9 +1359,7 @@ BMLoop *BM_edge_vert_share_loop(BMLoop *l, BMVert *v)
|
|||
if (l->v == v) {
|
||||
return l;
|
||||
}
|
||||
else {
|
||||
return l->next;
|
||||
}
|
||||
return l->next;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1561,10 +1537,8 @@ float BM_loop_calc_face_normal_safe_ex(const BMLoop *l, const float epsilon_sq,
|
|||
cross_v3_v3v3(r_normal, v1, v2);
|
||||
return normalize_v3(r_normal);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(r_normal, l->f->no);
|
||||
return 0.0f;
|
||||
}
|
||||
copy_v3_v3(r_normal, l->f->no);
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1596,10 +1570,8 @@ float BM_loop_calc_face_normal_safe_vcos_ex(const BMLoop *l,
|
|||
cross_v3_v3v3(r_normal, v1, v2);
|
||||
return normalize_v3(r_normal);
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(r_normal, normal_fallback);
|
||||
return 0.0f;
|
||||
}
|
||||
copy_v3_v3(r_normal, normal_fallback);
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1721,9 +1693,7 @@ float BM_edge_calc_face_angle_ex(const BMEdge *e, const float fallback)
|
|||
const BMLoop *l2 = e->l->radial_next;
|
||||
return angle_normalized_v3v3(l1->f->no, l2->f->no);
|
||||
}
|
||||
else {
|
||||
return fallback;
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
float BM_edge_calc_face_angle(const BMEdge *e)
|
||||
{
|
||||
|
@ -1757,9 +1727,7 @@ float BM_edge_calc_face_angle_with_imat3_ex(const BMEdge *e,
|
|||
|
||||
return angle_normalized_v3v3(no1, no2);
|
||||
}
|
||||
else {
|
||||
return fallback;
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
float BM_edge_calc_face_angle_with_imat3(const BMEdge *e, const float imat3[3][3])
|
||||
{
|
||||
|
@ -1782,9 +1750,7 @@ float BM_edge_calc_face_angle_signed_ex(const BMEdge *e, const float fallback)
|
|||
const float angle = angle_normalized_v3v3(l1->f->no, l2->f->no);
|
||||
return BM_edge_is_convex(e) ? angle : -angle;
|
||||
}
|
||||
else {
|
||||
return fallback;
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
float BM_edge_calc_face_angle_signed(const BMEdge *e)
|
||||
{
|
||||
|
@ -1839,9 +1805,7 @@ float BM_vert_calc_edge_angle_ex(const BMVert *v, const float fallback)
|
|||
|
||||
return (float)M_PI - angle_v3v3v3(v1->co, v->co, v2->co);
|
||||
}
|
||||
else {
|
||||
return fallback;
|
||||
}
|
||||
return fallback;
|
||||
}
|
||||
|
||||
float BM_vert_calc_edge_angle(const BMVert *v)
|
||||
|
@ -1869,9 +1833,7 @@ float BM_vert_calc_shell_factor(const BMVert *v)
|
|||
if (accum_angle != 0.0f) {
|
||||
return accum_shell / accum_angle;
|
||||
}
|
||||
else {
|
||||
return 1.0f;
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
/* alternate version of #BM_vert_calc_shell_factor which only
|
||||
* uses 'hflag' faces, but falls back to all if none found. */
|
||||
|
@ -1896,16 +1858,12 @@ float BM_vert_calc_shell_factor_ex(const BMVert *v, const float no[3], const cha
|
|||
if (accum_angle != 0.0f) {
|
||||
return accum_shell / accum_angle;
|
||||
}
|
||||
else {
|
||||
/* other main difference from BM_vert_calc_shell_factor! */
|
||||
if (tot != 0 && tot_sel == 0) {
|
||||
/* none selected, so use all */
|
||||
return BM_vert_calc_shell_factor(v);
|
||||
}
|
||||
else {
|
||||
return 1.0f;
|
||||
}
|
||||
/* other main difference from BM_vert_calc_shell_factor! */
|
||||
if (tot != 0 && tot_sel == 0) {
|
||||
/* none selected, so use all */
|
||||
return BM_vert_calc_shell_factor(v);
|
||||
}
|
||||
return 1.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1929,9 +1887,7 @@ float BM_vert_calc_median_tagged_edge_length(const BMVert *v)
|
|||
if (tot) {
|
||||
return length / (float)tot;
|
||||
}
|
||||
else {
|
||||
return 0.0f;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -45,12 +45,10 @@ static bool bmw_mask_check_vert(BMWalker *walker, BMVert *v)
|
|||
if ((walker->flag & BMW_FLAG_TEST_HIDDEN) && BM_elem_flag_test(v, BM_ELEM_HIDDEN)) {
|
||||
return false;
|
||||
}
|
||||
else if (walker->mask_vert && !BMO_vert_flag_test(walker->bm, v, walker->mask_vert)) {
|
||||
if (walker->mask_vert && !BMO_vert_flag_test(walker->bm, v, walker->mask_vert)) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool bmw_mask_check_edge(BMWalker *walker, BMEdge *e)
|
||||
|
@ -58,12 +56,10 @@ static bool bmw_mask_check_edge(BMWalker *walker, BMEdge *e)
|
|||
if ((walker->flag & BMW_FLAG_TEST_HIDDEN) && BM_elem_flag_test(e, BM_ELEM_HIDDEN)) {
|
||||
return false;
|
||||
}
|
||||
else if (walker->mask_edge && !BMO_edge_flag_test(walker->bm, e, walker->mask_edge)) {
|
||||
if (walker->mask_edge && !BMO_edge_flag_test(walker->bm, e, walker->mask_edge)) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool bmw_mask_check_face(BMWalker *walker, BMFace *f)
|
||||
|
@ -71,12 +67,10 @@ static bool bmw_mask_check_face(BMWalker *walker, BMFace *f)
|
|||
if ((walker->flag & BMW_FLAG_TEST_HIDDEN) && BM_elem_flag_test(f, BM_ELEM_HIDDEN)) {
|
||||
return false;
|
||||
}
|
||||
else if (walker->mask_face && !BMO_face_flag_test(walker->bm, f, walker->mask_face)) {
|
||||
if (walker->mask_face && !BMO_face_flag_test(walker->bm, f, walker->mask_face)) {
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -94,13 +88,9 @@ static bool bmw_edge_is_wire(const BMWalker *walker, const BMEdge *e)
|
|||
if (BM_edge_is_wire(e)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return BM_edge_is_all_face_flag_test(e, BM_ELEM_HIDDEN, false);
|
||||
}
|
||||
}
|
||||
else {
|
||||
return BM_edge_is_wire(e);
|
||||
return BM_edge_is_all_face_flag_test(e, BM_ELEM_HIDDEN, false);
|
||||
}
|
||||
return BM_edge_is_wire(e);
|
||||
}
|
||||
/** \} */
|
||||
|
||||
|
@ -501,16 +491,15 @@ static void *bmw_LoopShellWireWalker_step(BMWalker *walker)
|
|||
|
||||
return l;
|
||||
}
|
||||
else {
|
||||
BMEdge *e = (BMEdge *)swalk->curelem;
|
||||
|
||||
BLI_assert(e->head.htype == BM_EDGE);
|
||||
BMEdge *e = (BMEdge *)swalk->curelem;
|
||||
|
||||
bmw_LoopShellWireWalker_visitVert(walker, e->v1, e);
|
||||
bmw_LoopShellWireWalker_visitVert(walker, e->v2, e);
|
||||
BLI_assert(e->head.htype == BM_EDGE);
|
||||
|
||||
return e;
|
||||
}
|
||||
bmw_LoopShellWireWalker_visitVert(walker, e->v1, e);
|
||||
bmw_LoopShellWireWalker_visitVert(walker, e->v2, e);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
/** \} */
|
||||
|
@ -718,7 +707,7 @@ static void *bmw_IslandboundWalker_step(BMWalker *walker)
|
|||
if (l == owalk.curloop) {
|
||||
return NULL;
|
||||
}
|
||||
else if (BLI_gset_haskey(walker->visit_set, l)) {
|
||||
if (BLI_gset_haskey(walker->visit_set, l)) {
|
||||
return owalk.curloop;
|
||||
}
|
||||
|
||||
|
@ -1246,9 +1235,7 @@ static void bmw_EdgeringWalker_begin(BMWalker *walker, void *data)
|
|||
lwalk->wireedge = e;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
lwalk->wireedge = NULL;
|
||||
}
|
||||
lwalk->wireedge = NULL;
|
||||
|
||||
BLI_gset_insert(walker->visit_set, lwalk->l->e);
|
||||
|
||||
|
@ -1285,9 +1272,7 @@ static void *bmw_EdgeringWalker_yield(BMWalker *walker)
|
|||
if (lwalk->l) {
|
||||
return lwalk->l->e;
|
||||
}
|
||||
else {
|
||||
return lwalk->wireedge;
|
||||
}
|
||||
return lwalk->wireedge;
|
||||
}
|
||||
|
||||
static void *bmw_EdgeringWalker_step(BMWalker *walker)
|
||||
|
|
|
@ -61,23 +61,20 @@ static int bm_edge_length_cmp(const void *a_, const void *b_)
|
|||
if (e_a_concave < e_b_concave) {
|
||||
return -1;
|
||||
}
|
||||
else if (e_a_concave > e_b_concave) {
|
||||
if (e_a_concave > e_b_concave) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
/* otherwise shortest edges last */
|
||||
const float e_a_len = BM_edge_calc_length_squared(e_a);
|
||||
const float e_b_len = BM_edge_calc_length_squared(e_b);
|
||||
if (e_a_len < e_b_len) {
|
||||
return 1;
|
||||
}
|
||||
else if (e_a_len > e_b_len) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* otherwise shortest edges last */
|
||||
const float e_a_len = BM_edge_calc_length_squared(e_a);
|
||||
const float e_b_len = BM_edge_calc_length_squared(e_b);
|
||||
if (e_a_len < e_b_len) {
|
||||
return 1;
|
||||
}
|
||||
if (e_a_len > e_b_len) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool bm_face_split_by_concave(BMesh *bm,
|
||||
|
|
|
@ -155,16 +155,14 @@ static int min_dist_dir_test(MinDistDir *mddir, const float dist_dir[3], const f
|
|||
if (mddir->dist_min[0] == FLT_MAX) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if (dot_v3v3(dist_dir, mddir->dir) > 0.0f) {
|
||||
if (dist_sq < mddir->dist_min[0]) {
|
||||
return 0;
|
||||
}
|
||||
if (dot_v3v3(dist_dir, mddir->dir) > 0.0f) {
|
||||
if (dist_sq < mddir->dist_min[0]) {
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
if (dist_sq < mddir->dist_min[1]) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (dist_sq < mddir->dist_min[1]) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -191,9 +189,7 @@ static int state_isect_co_pair(const PathContext *pc, const float co_a[3], const
|
|||
if ((test_a && test_b) && (test_a != test_b)) {
|
||||
return 1; /* on either side */
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int state_isect_co_exact(const PathContext *pc, const float co[3])
|
||||
|
|
|
@ -194,10 +194,8 @@ void bmo_edgenet_prepare_exec(BMesh *bm, BMOperator *op)
|
|||
BLI_array_free(edges2);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
edges1 = edges2;
|
||||
edges2 = NULL;
|
||||
}
|
||||
edges1 = edges2;
|
||||
edges2 = NULL;
|
||||
}
|
||||
|
||||
if (edges2 && BLI_array_len(edges2) > 2 &&
|
||||
|
|
|
@ -506,9 +506,7 @@ static BMLoop *bm_edge_is_mixed_face_tag(BMLoop *l)
|
|||
|
||||
return ((tot_tag == 1) && (tot_untag >= 1)) ? l_tag : NULL;
|
||||
}
|
||||
else {
|
||||
return NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static float bm_edge_info_average_length(BMVert *v, SplitEdgeInfo *edge_info)
|
||||
|
@ -530,9 +528,7 @@ static float bm_edge_info_average_length(BMVert *v, SplitEdgeInfo *edge_info)
|
|||
if (tot != 0) {
|
||||
return len / (float)tot;
|
||||
}
|
||||
else {
|
||||
return -1.0f;
|
||||
}
|
||||
return -1.0f;
|
||||
}
|
||||
|
||||
/**.
|
||||
|
@ -663,9 +659,7 @@ static float bm_edge_info_average_length_with_fallback(
|
|||
if (length != -1.0f) {
|
||||
return length;
|
||||
}
|
||||
else {
|
||||
return bm_edge_info_average_length_fallback(v, edge_info, bm, vert_lengths_p);
|
||||
}
|
||||
return bm_edge_info_average_length_fallback(v, edge_info, bm, vert_lengths_p);
|
||||
}
|
||||
|
||||
void bmo_inset_region_exec(BMesh *bm, BMOperator *op)
|
||||
|
|
|
@ -1276,7 +1276,7 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
|
|||
|
||||
continue;
|
||||
}
|
||||
else if (!pat) {
|
||||
if (!pat) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -907,9 +907,7 @@ static void bm_edgering_pair_order(BMesh *bm,
|
|||
if (BM_elem_flag_test(v_other, BM_ELEM_TAG)) {
|
||||
break;
|
||||
}
|
||||
else {
|
||||
v_other = NULL;
|
||||
}
|
||||
v_other = NULL;
|
||||
}
|
||||
}
|
||||
BLI_assert(v_other != NULL);
|
||||
|
|
|
@ -534,7 +534,7 @@ static EdgeHalf *find_other_end_edge_half(BevelParams *bp, EdgeHalf *e, BevVert
|
|||
BLI_assert(eother != NULL);
|
||||
return eother;
|
||||
}
|
||||
else if (r_bvother) {
|
||||
if (r_bvother) {
|
||||
*r_bvother = NULL;
|
||||
}
|
||||
return NULL;
|
||||
|
@ -1095,13 +1095,11 @@ static bool is_outside_edge(EdgeHalf *e, const float co[3], BMVert **ret_closer_
|
|||
*ret_closer_v = e->e->v1;
|
||||
return true;
|
||||
}
|
||||
else if (lambda >= (1.0f + BEVEL_EPSILON_BIG) * lenu) {
|
||||
if (lambda >= (1.0f + BEVEL_EPSILON_BIG) * lenu) {
|
||||
*ret_closer_v = e->e->v2;
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Return whether the angle is less than, equal to, or larger than 180 degrees. */
|
||||
|
@ -1132,12 +1130,10 @@ static int edges_angle_kind(EdgeHalf *e1, EdgeHalf *e2, BMVert *v)
|
|||
if (fabsf(dot) < BEVEL_EPSILON_BIG) {
|
||||
return ANGLE_STRAIGHT;
|
||||
}
|
||||
else if (dot < 0.0f) {
|
||||
if (dot < 0.0f) {
|
||||
return ANGLE_LARGER;
|
||||
}
|
||||
else {
|
||||
return ANGLE_SMALLER;
|
||||
}
|
||||
return ANGLE_SMALLER;
|
||||
}
|
||||
|
||||
/* co should be approximately on the plane between e1 and e2, which share common vert v and common
|
||||
|
@ -1845,9 +1841,7 @@ static double superellipse_co(double x, float r, bool rbig)
|
|||
if (rbig) {
|
||||
return pow((1.0 - pow(x, r)), (1.0 / r));
|
||||
}
|
||||
else {
|
||||
return 1.0 - pow((1.0 - pow(1.0 - x, r)), (1.0 / r));
|
||||
}
|
||||
return 1.0 - pow((1.0 - pow(1.0 - x, r)), (1.0 / r));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3291,16 +3285,13 @@ static EdgeHalf *next_edgehalf_bev(BevelParams *bp,
|
|||
if ((next_edge != NULL) && compare_ff(best_dot, second_best_dot, BEVEL_SMALL_ANG_DOT)) {
|
||||
return NULL;
|
||||
}
|
||||
else {
|
||||
return next_edge;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* Case 2: The next EdgeHalf is the other side of the BMEdge.
|
||||
* It's part of the same BMEdge, so we know the other EdgeHalf is also beveled. */
|
||||
next_edge = find_other_end_edge_half(bp, start_edge, r_bv);
|
||||
return next_edge;
|
||||
}
|
||||
|
||||
/* Case 2: The next EdgeHalf is the other side of the BMEdge.
|
||||
* It's part of the same BMEdge, so we know the other EdgeHalf is also beveled. */
|
||||
next_edge = find_other_end_edge_half(bp, start_edge, r_bv);
|
||||
return next_edge;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3740,9 +3731,8 @@ static bool is_canon(VMesh *vm, int i, int j, int k)
|
|||
if (vm->seg % 2 == 1) { /* Odd. */
|
||||
return (j <= ns2 && k <= ns2);
|
||||
}
|
||||
else { /* Even. */
|
||||
return ((j < ns2 && k <= ns2) || (j == ns2 && k == ns2 && i == 0));
|
||||
}
|
||||
/* Even. */
|
||||
return ((j < ns2 && k <= ns2) || (j == ns2 && k == ns2 && i == 0));
|
||||
}
|
||||
|
||||
/* Copy the vertex data to all of vm verts from canonical ones. */
|
||||
|
@ -3806,7 +3796,7 @@ static float sabin_gamma(int n)
|
|||
if (n < 3) {
|
||||
return 0.0f;
|
||||
}
|
||||
else if (n == 3) {
|
||||
if (n == 3) {
|
||||
ans = 0.065247584f;
|
||||
}
|
||||
else if (n == 4) {
|
||||
|
@ -4260,7 +4250,7 @@ static VMesh *make_cube_corner_adj_vmesh(BevelParams *bp)
|
|||
if (r == PRO_SQUARE_R) {
|
||||
return make_cube_corner_square(mem_arena, nseg);
|
||||
}
|
||||
else if (r == PRO_SQUARE_IN_R) {
|
||||
if (r == PRO_SQUARE_IN_R) {
|
||||
return make_cube_corner_square_in(mem_arena, nseg);
|
||||
}
|
||||
}
|
||||
|
@ -4628,9 +4618,7 @@ static BMEdge *find_closer_edge(float *co, BMEdge *e1, BMEdge *e2)
|
|||
if (dsq1 < dsq2) {
|
||||
return e1;
|
||||
}
|
||||
else {
|
||||
return e2;
|
||||
}
|
||||
return e2;
|
||||
}
|
||||
|
||||
/* Snap co to the closest edge of face f. Return the edge in *r_snap_e,
|
||||
|
@ -5769,9 +5757,7 @@ static float edge_face_angle(EdgeHalf *e)
|
|||
/* Angle between faces is supplement of angle between face normals. */
|
||||
return (float)M_PI - angle_normalized_v3v3(e->fprev->no, e->fnext->no);
|
||||
}
|
||||
else {
|
||||
return 0.0f;
|
||||
}
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
/* Take care, this flag isn't cleared before use, it just so happens that its not set. */
|
||||
|
|
|
@ -57,12 +57,10 @@ static short plane_point_test_v3(const float plane[4],
|
|||
if (f <= -eps) {
|
||||
return -1;
|
||||
}
|
||||
else if (f >= eps) {
|
||||
if (f >= eps) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
@ -135,12 +133,10 @@ static int bm_vert_sortval_cb(const void *v_a_v, const void *v_b_v)
|
|||
if (val_a > val_b) {
|
||||
return 1;
|
||||
}
|
||||
else if (val_a < val_b) {
|
||||
if (val_a < val_b) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bm_face_bisect_verts(
|
||||
|
|
|
@ -148,11 +148,10 @@ static void bm_decim_calc_target_co_db(BMEdge *e, double optimize_co[3], const Q
|
|||
/* all is good */
|
||||
return;
|
||||
}
|
||||
else {
|
||||
optimize_co[0] = 0.5 * ((double)e->v1->co[0] + (double)e->v2->co[0]);
|
||||
optimize_co[1] = 0.5 * ((double)e->v1->co[1] + (double)e->v2->co[1]);
|
||||
optimize_co[2] = 0.5 * ((double)e->v1->co[2] + (double)e->v2->co[2]);
|
||||
}
|
||||
|
||||
optimize_co[0] = 0.5 * ((double)e->v1->co[0] + (double)e->v2->co[0]);
|
||||
optimize_co[1] = 0.5 * ((double)e->v1->co[1] + (double)e->v2->co[1]);
|
||||
optimize_co[2] = 0.5 * ((double)e->v1->co[2] + (double)e->v2->co[2]);
|
||||
}
|
||||
|
||||
static void bm_decim_calc_target_co_fl(BMEdge *e, float optimize_co[3], const Quadric *vquadrics)
|
||||
|
@ -1059,7 +1058,7 @@ static bool bm_edge_collapse(BMesh *bm,
|
|||
|
||||
return true;
|
||||
}
|
||||
else if (BM_edge_is_boundary(e_clear)) {
|
||||
if (BM_edge_is_boundary(e_clear)) {
|
||||
/* same as above but only one triangle */
|
||||
BMLoop *l_a;
|
||||
BMEdge *e_a_other[2];
|
||||
|
@ -1115,9 +1114,7 @@ static bool bm_edge_collapse(BMesh *bm,
|
|||
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1273,11 +1270,9 @@ static bool bm_decim_edge_collapse(BMesh *bm,
|
|||
return true;
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
/* add back with a high cost */
|
||||
bm_decim_invalid_edge_cost_single(e, eheap, eheap_table);
|
||||
return false;
|
||||
}
|
||||
/* add back with a high cost */
|
||||
bm_decim_invalid_edge_cost_single(e, eheap, eheap_table);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Main Decimate Function
|
||||
|
|
|
@ -278,9 +278,7 @@ static bool bm_vert_collapse_is_degenerate(BMVert *v)
|
|||
}
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif /* USE_DEGENERATE_CHECK */
|
||||
|
||||
|
|
|
@ -143,9 +143,7 @@ static bool bm_edgenet_path_check_overlap(BMVert *v1, BMVert *v2, VertNetInfo *v
|
|||
|
||||
return BM_face_exists_overlap_subset(vert_arr, (int)v_ls_tot);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -331,11 +329,10 @@ static LinkNode *bm_edgenet_path_calc(BMEdge *e,
|
|||
*r_path_cost = path_cost_accum;
|
||||
return path;
|
||||
}
|
||||
else {
|
||||
/* check if a change was made */
|
||||
if (v_ls_next_old != v_ls_next) {
|
||||
found = true;
|
||||
}
|
||||
|
||||
/* check if a change was made */
|
||||
if (v_ls_next_old != v_ls_next) {
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
BLI_assert(v_ls_prev == NULL);
|
||||
|
@ -379,49 +376,49 @@ static LinkNode *bm_edgenet_path_calc_best(BMEdge *e,
|
|||
if (path == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
else if (path_cost < 1) {
|
||||
if (path_cost < 1) {
|
||||
/* any face that takes 1 iteration to find we consider valid */
|
||||
return path;
|
||||
}
|
||||
else {
|
||||
/* Check every edge to see if any can give a better path.
|
||||
* This avoids very strange/long paths from being created. */
|
||||
|
||||
const uint path_len = *r_path_len;
|
||||
uint i, i_prev;
|
||||
BMVert **vert_arr = BLI_array_alloca(vert_arr, path_len);
|
||||
LinkNode *v_lnk;
|
||||
/* Check every edge to see if any can give a better path.
|
||||
* This avoids very strange/long paths from being created. */
|
||||
|
||||
for (v_lnk = path, i = 0; v_lnk; v_lnk = v_lnk->next, i++) {
|
||||
vert_arr[i] = v_lnk->link;
|
||||
}
|
||||
const uint path_len = *r_path_len;
|
||||
uint i, i_prev;
|
||||
BMVert **vert_arr = BLI_array_alloca(vert_arr, path_len);
|
||||
LinkNode *v_lnk;
|
||||
|
||||
i_prev = path_len - 1;
|
||||
for (i = 0; i < path_len; i++) {
|
||||
BMEdge *e_other = BM_edge_exists(vert_arr[i], vert_arr[i_prev]);
|
||||
if (e_other != e) {
|
||||
LinkNode *path_test;
|
||||
uint path_len_test;
|
||||
uint path_cost_test;
|
||||
|
||||
path_test = bm_edgenet_path_calc(
|
||||
e_other, *pass_nr, path_cost, &path_len_test, &path_cost_test, vnet_info, path_pool);
|
||||
(*pass_nr)++;
|
||||
|
||||
if (path_test) {
|
||||
BLI_assert(path_cost_test < path_cost);
|
||||
|
||||
BLI_linklist_free_pool(path, NULL, path_pool);
|
||||
path = path_test;
|
||||
*r_path_len = path_len_test;
|
||||
*r_path_cost = path_cost_test;
|
||||
path_cost = path_cost_test;
|
||||
}
|
||||
}
|
||||
|
||||
i_prev = i;
|
||||
}
|
||||
for (v_lnk = path, i = 0; v_lnk; v_lnk = v_lnk->next, i++) {
|
||||
vert_arr[i] = v_lnk->link;
|
||||
}
|
||||
|
||||
i_prev = path_len - 1;
|
||||
for (i = 0; i < path_len; i++) {
|
||||
BMEdge *e_other = BM_edge_exists(vert_arr[i], vert_arr[i_prev]);
|
||||
if (e_other != e) {
|
||||
LinkNode *path_test;
|
||||
uint path_len_test;
|
||||
uint path_cost_test;
|
||||
|
||||
path_test = bm_edgenet_path_calc(
|
||||
e_other, *pass_nr, path_cost, &path_len_test, &path_cost_test, vnet_info, path_pool);
|
||||
(*pass_nr)++;
|
||||
|
||||
if (path_test) {
|
||||
BLI_assert(path_cost_test < path_cost);
|
||||
|
||||
BLI_linklist_free_pool(path, NULL, path_pool);
|
||||
path = path_test;
|
||||
*r_path_len = path_len_test;
|
||||
*r_path_cost = path_cost_test;
|
||||
path_cost = path_cost_test;
|
||||
}
|
||||
}
|
||||
|
||||
i_prev = i;
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
|
|
|
@ -99,9 +99,7 @@ static BMEdge *bm_vert_other_edge(BMVert *v, BMEdge *e)
|
|||
if (v->e != e) {
|
||||
return v->e;
|
||||
}
|
||||
else {
|
||||
return BM_DISK_EDGE_NEXT(v->e, v);
|
||||
}
|
||||
return BM_DISK_EDGE_NEXT(v->e, v);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -1341,10 +1339,8 @@ bool BM_mesh_intersect(BMesh *bm,
|
|||
splice_pair[1] = v_next;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
e_next = bm_vert_other_edge(v_next, e_step);
|
||||
}
|
||||
|
||||
e_next = bm_vert_other_edge(v_next, e_step);
|
||||
e_step = e_next;
|
||||
v_step = v_next;
|
||||
BM_elem_flag_enable(e_step, BM_ELEM_TAG);
|
||||
|
|
|
@ -127,12 +127,10 @@ static bool bm_vert_pair_share_splittable_face_cb(BMFace *UNUSED(f),
|
|||
if (IN_RANGE(lambda_b, range_min, range_max)) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
copy_v3_v3(co, l_b->prev->v->co);
|
||||
sub_v3_v3v3(dir, l_b->next->v->co, co);
|
||||
if (isect_ray_ray_v3(v_a_co, v_a_b_dir, co, dir, NULL, &lambda_b)) {
|
||||
return IN_RANGE(lambda_b, range_min, range_max);
|
||||
}
|
||||
copy_v3_v3(co, l_b->prev->v->co);
|
||||
sub_v3_v3v3(dir, l_b->next->v->co, co);
|
||||
if (isect_ray_ray_v3(v_a_co, v_a_b_dir, co, dir, NULL, &lambda_b)) {
|
||||
return IN_RANGE(lambda_b, range_min, range_max);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
@ -476,9 +474,7 @@ static int sort_cmp_by_lambda_cb(const void *index1_v, const void *index2_v, voi
|
|||
if (pair_flat[index1].lambda > pair_flat[index2].lambda) {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* -------------------------------------------------------------------- */
|
||||
|
|
|
@ -91,9 +91,9 @@ static bool bm_vert_region_test_chain(BMVert *v, int *const depths[2], const int
|
|||
if (bm_vert_region_test(v, depths, pass)) {
|
||||
return true;
|
||||
}
|
||||
else if (BM_vert_is_edge_pair_manifold(v) && bm_vert_pair_ends(v, v_end_pair) &&
|
||||
bm_vert_region_test(v_end_pair[0], depths, pass) &&
|
||||
bm_vert_region_test(v_end_pair[1], depths, pass)) {
|
||||
if (BM_vert_is_edge_pair_manifold(v) && bm_vert_pair_ends(v, v_end_pair) &&
|
||||
bm_vert_region_test(v_end_pair[0], depths, pass) &&
|
||||
bm_vert_region_test(v_end_pair[1], depths, pass)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -139,9 +139,7 @@ BLI_INLINE bool bm_uuidwalk_face_test(UUIDWalk *uuidwalk, BMFace *f)
|
|||
if (uuidwalk->use_face_isolate) {
|
||||
return BM_elem_flag_test_bool(f, BM_ELEM_TAG);
|
||||
}
|
||||
else {
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
BLI_INLINE bool bm_uuidwalk_vert_lookup(UUIDWalk *uuidwalk, BMVert *v, UUID_Int *r_uuid)
|
||||
|
@ -152,9 +150,7 @@ BLI_INLINE bool bm_uuidwalk_vert_lookup(UUIDWalk *uuidwalk, BMVert *v, UUID_Int
|
|||
*r_uuid = (UUID_Int)(*ret);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
BLI_INLINE bool bm_uuidwalk_face_lookup(UUIDWalk *uuidwalk, BMFace *f, UUID_Int *r_uuid)
|
||||
|
@ -165,9 +161,7 @@ BLI_INLINE bool bm_uuidwalk_face_lookup(UUIDWalk *uuidwalk, BMFace *f, UUID_Int
|
|||
*r_uuid = (UUID_Int)(*ret);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static uint ghashutil_bmelem_indexhash(const void *key)
|
||||
|
@ -566,12 +560,10 @@ static int bm_face_len_cmp(const void *v1, const void *v2)
|
|||
if (f1->len > f2->len) {
|
||||
return 1;
|
||||
}
|
||||
else if (f1->len < f2->len) {
|
||||
if (f1->len < f2->len) {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static uint bm_uuidwalk_init_from_edge(UUIDWalk *uuidwalk, BMEdge *e)
|
||||
|
@ -937,10 +929,8 @@ static bool bm_edge_is_region_boundary(BMEdge *e)
|
|||
} while ((l_iter = l_iter->radial_next) != e->l);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
/* boundary */
|
||||
return true;
|
||||
}
|
||||
/* boundary */
|
||||
return true;
|
||||
}
|
||||
|
||||
static void bm_face_region_pivot_edge_use_best(GHash *gh,
|
||||
|
|
|
@ -142,13 +142,13 @@ static bool bm_loop_is_radial_boundary(BMLoop *l_first)
|
|||
if (l == l_first) {
|
||||
return true; /* a real boundary */
|
||||
}
|
||||
else {
|
||||
do {
|
||||
if (BM_elem_flag_test(l->f, BM_ELEM_TAG)) {
|
||||
return false;
|
||||
}
|
||||
} while ((l = l->radial_next) != l_first);
|
||||
}
|
||||
|
||||
do {
|
||||
if (BM_elem_flag_test(l->f, BM_ELEM_TAG)) {
|
||||
return false;
|
||||
}
|
||||
} while ((l = l->radial_next) != l_first);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue