diff options
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_core.c | 188 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_edgeloop.c | 8 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_interp.c | 11 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_iterators.c | 14 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_log.c | 4 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_marking.c | 6 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mesh.c | 20 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_mods.c | 28 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_operators.c | 6 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_polygon.c | 8 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_polygon_edgenet.c | 8 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_query.c | 126 | ||||
-rw-r--r-- | source/blender/bmesh/intern/bmesh_walkers_impl.c | 49 |
13 files changed, 189 insertions, 287 deletions
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c index 8f55c14c681..35fb698eac1 100644 --- a/source/blender/bmesh/intern/bmesh_core.c +++ b/source/blender/bmesh/intern/bmesh_core.c @@ -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); - } + if (check_edge_double) { + e_splice = BM_edge_exists(v_target, v_old); + } - bmesh_disk_vert_replace(e_old, v_target, v_kill); + 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); + /* 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); + /* deal with radial cycle of e_kill */ + radlen = bmesh_radial_length(e_kill->l); #endif - if (e_kill->l) { + 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; - } + /* 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; - } + 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); - } + /* 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; + } + l_kill_next = l_kill->radial_next; - bm_kill_only_loop(bm, l_kill); + 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. */ + } 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); + /* 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 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; - } + /* 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); + /* 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_disk_validate(valence2, v_target->e, v_target); + edok = bmesh_loop_validate(l->f); 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); - } + 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 (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); - } + 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); + BM_CHECK_ELEMENT(v_old); + BM_CHECK_ELEMENT(v_target); + BM_CHECK_ELEMENT(e_old); - return 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); - } + v_new = BM_vert_create(bm, v->co, v, BM_CREATE_NOP); + if (copy_select) { + BM_elem_select_copy(bm, v_new, v); + } - if (r_vout) { - BLI_SMALLSTACK_PUSH(verts_new, v_new); - } - verts_num += 1; + 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 diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.c b/source/blender/bmesh/intern/bmesh_edgeloop.c index e4312877fc6..ec97ea51047 100644 --- a/source/blender/bmesh/intern/bmesh_edgeloop.c +++ b/source/blender/bmesh/intern/bmesh_edgeloop.c @@ -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) diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c index 82502227a9a..e8298f4dffc 100644 --- a/source/blender/bmesh/intern/bmesh_interp.c +++ b/source/blender/bmesh/intern/bmesh_interp.c @@ -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); } diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c index c4dd53b0497..b68bae9ee04 100644 --- a/source/blender/bmesh/intern/bmesh_iterators.c +++ b/source/blender/bmesh/intern/bmesh_iterators.c @@ -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, diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c index 6c0585a7759..69d73f3d647 100644 --- a/source/blender/bmesh/intern/bmesh_log.c +++ b/source/blender/bmesh/intern/bmesh_log.c @@ -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 diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index 177599656b6..5b8fe1f492e 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -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) diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c index fe7c9dba08e..ffe84f93679 100644 --- a/source/blender/bmesh/intern/bmesh_mesh.c +++ b/source/blender/bmesh/intern/bmesh_mesh.c @@ -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); } /** diff --git a/source/blender/bmesh/intern/bmesh_mods.c b/source/blender/bmesh/intern/bmesh_mods.c index 7b5df536192..5d2745f8a96 100644 --- a/source/blender/bmesh/intern/bmesh_mods.c +++ b/source/blender/bmesh/intern/bmesh_mods.c @@ -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; } /** diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c index 6454079a5dc..19e42b33c80 100644 --- a/source/blender/bmesh/intern/bmesh_operators.c +++ b/source/blender/bmesh/intern/bmesh_operators.c @@ -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; } diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c index a40c293f1aa..0b93db6a91e 100644 --- a/source/blender/bmesh/intern/bmesh_polygon.c +++ b/source/blender/bmesh/intern/bmesh_polygon.c @@ -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) diff --git a/source/blender/bmesh/intern/bmesh_polygon_edgenet.c b/source/blender/bmesh/intern/bmesh_polygon_edgenet.c index a738b2139c4..39395cb9222 100644 --- a/source/blender/bmesh/intern/bmesh_polygon_edgenet.c +++ b/source/blender/bmesh/intern/bmesh_polygon_edgenet.c @@ -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 */ diff --git a/source/blender/bmesh/intern/bmesh_query.c b/source/blender/bmesh/intern/bmesh_query.c index e000b253000..fe67abf6aa5 100644 --- a/source/blender/bmesh/intern/bmesh_query.c +++ b/source/blender/bmesh/intern/bmesh_query.c @@ -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; } /** diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c index f317c59b8d1..88ddac425ee 100644 --- a/source/blender/bmesh/intern/bmesh_walkers_impl.c +++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c @@ -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) |