diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-03-27 09:14:36 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-03-27 09:14:36 +0300 |
commit | 8d7005d7152459eb66fa33ae14eba94a0169adbb (patch) | |
tree | 78a117f4c1256dda7ce1af72f3e5b04ecbb0c4cd /source/blender/bmesh/operators | |
parent | e26b67fa1e13b45c395878dfc667af0b4cc458cf (diff) |
Cleanup: style, use braces for bmesh
Diffstat (limited to 'source/blender/bmesh/operators')
18 files changed, 163 insertions, 83 deletions
diff --git a/source/blender/bmesh/operators/bmo_bridge.c b/source/blender/bmesh/operators/bmo_bridge.c index 896c28dd743..84b5f44a43f 100644 --- a/source/blender/bmesh/operators/bmo_bridge.c +++ b/source/blender/bmesh/operators/bmo_bridge.c @@ -384,10 +384,10 @@ static void bridge_loop_pair( l_b = l_b_next = BM_iter_at_index(bm, BM_LOOPS_OF_VERT, v_b, 0); } - if (l_a && l_a_next == NULL) l_a_next = l_a; - if (l_a_next && l_a == NULL) l_a = l_a_next; - if (l_b && l_b_next == NULL) l_b_next = l_b; - if (l_b_next && l_b == NULL) l_b = l_b_next; + if (l_a && l_a_next == NULL) { l_a_next = l_a; } + if (l_a_next && l_a == NULL) { l_a = l_a_next; } + if (l_b && l_b_next == NULL) { l_b_next = l_b; } + if (l_b_next && l_b == NULL) { l_b = l_b_next; } f_example = l_a ? l_a->f : (l_b ? l_b->f : NULL); if (v_b != v_b_next) { diff --git a/source/blender/bmesh/operators/bmo_connect_concave.c b/source/blender/bmesh/operators/bmo_connect_concave.c index 7e3278853ce..98527482f52 100644 --- a/source/blender/bmesh/operators/bmo_connect_concave.c +++ b/source/blender/bmesh/operators/bmo_connect_concave.c @@ -56,15 +56,15 @@ static int bm_edge_length_cmp(const void *a_, const void *b_) /* merge edges between concave edges last since these * are most likely to remain and be the main dividers */ - if (e_a_concave < e_b_concave) return -1; - else if (e_a_concave > e_b_concave) return 1; + if (e_a_concave < e_b_concave) { return -1; } + else 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; + if (e_a_len < e_b_len) { return 1; } + else if (e_a_len > e_b_len) { return -1; } + else { return 0; } } } diff --git a/source/blender/bmesh/operators/bmo_create.c b/source/blender/bmesh/operators/bmo_create.c index ff4b671784d..001c3004ec9 100644 --- a/source/blender/bmesh/operators/bmo_create.c +++ b/source/blender/bmesh/operators/bmo_create.c @@ -108,13 +108,13 @@ void bmo_contextual_create_exec(BMesh *bm, BMOperator *op) const int tot_edges = BMO_iter_elem_count_flag(bm, BM_EDGES_OF_VERT, v, ELE_NEW, true); if (tot_edges == 0) { /* only accept 1 free vert */ - if (v_free == NULL) v_free = v; - else ok = false; /* only ever want one of these */ + if (v_free == NULL) { v_free = v; } + else { ok = false; } /* only ever want one of these */ } else if (tot_edges == 1) { - if (v_a == NULL) v_a = v; - else if (v_b == NULL) v_b = v; - else ok = false; /* only ever want 2 of these */ + if (v_a == NULL) { v_a = v; } + else if (v_b == NULL) { v_b = v; } + else { ok = false; } /* only ever want 2 of these */ } else if (tot_edges == 2) { /* do nothing, regular case */ diff --git a/source/blender/bmesh/operators/bmo_dissolve.c b/source/blender/bmesh/operators/bmo_dissolve.c index 0c249f84cb2..d04fe2b7146 100644 --- a/source/blender/bmesh/operators/bmo_dissolve.c +++ b/source/blender/bmesh/operators/bmo_dissolve.c @@ -203,8 +203,9 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) goto cleanup; } - while (faces[tot]) + while (faces[tot]) { tot++; + } f_new = BM_faces_join(bm, faces, tot, true); @@ -254,7 +255,9 @@ void bmo_dissolve_faces_exec(BMesh *bm, BMOperator *op) cleanup: /* free/cleanup */ for (i = 0; i < BLI_array_len(regions); i++) { - if (regions[i]) MEM_freeN(regions[i]); + if (regions[i]) { + MEM_freeN(regions[i]); + } } BLI_array_free(regions); diff --git a/source/blender/bmesh/operators/bmo_dupe.c b/source/blender/bmesh/operators/bmo_dupe.c index b2961c5cb6b..5c7c78eb654 100644 --- a/source/blender/bmesh/operators/bmo_dupe.c +++ b/source/blender/bmesh/operators/bmo_dupe.c @@ -333,8 +333,9 @@ void bmo_duplicate_exec(BMesh *bm, BMOperator *op) BMOperator *dupeop = op; BMesh *bm_dst = BMO_slot_ptr_get(op->slots_in, "dest"); - if (!bm_dst) + if (!bm_dst) { bm_dst = bm; + } /* flag input */ BMO_slot_buffer_flag_enable(bm, dupeop->slots_in, "geom", BM_ALL_NOLOOP, DUPE_INPUT); diff --git a/source/blender/bmesh/operators/bmo_edgenet.c b/source/blender/bmesh/operators/bmo_edgenet.c index b974c2aeb79..4334c7bcdcc 100644 --- a/source/blender/bmesh/operators/bmo_edgenet.c +++ b/source/blender/bmesh/operators/bmo_edgenet.c @@ -44,8 +44,9 @@ void bmo_edgenet_fill_exec(BMesh *bm, BMOperator *op) const bool use_smooth = BMO_slot_bool_get(op->slots_in, "use_smooth"); // const int sides = BMO_slot_int_get(op->slots_in, "sides"); - if (!bm->totvert || !bm->totedge) + if (!bm->totvert || !bm->totedge) { return; + } BM_mesh_elem_hflag_disable_all(bm, BM_EDGE, BM_ELEM_TAG, false); BMO_slot_buffer_hflag_enable(bm, op->slots_in, "edges", BM_EDGE, BM_ELEM_TAG, false); diff --git a/source/blender/bmesh/operators/bmo_extrude.c b/source/blender/bmesh/operators/bmo_extrude.c index d4c49ae2347..eaf059c7e03 100644 --- a/source/blender/bmesh/operators/bmo_extrude.c +++ b/source/blender/bmesh/operators/bmo_extrude.c @@ -258,8 +258,9 @@ void bmo_extrude_vert_indiv_exec(BMesh *bm, BMOperator *op) dupev = BM_vert_create(bm, v->co, v, BM_CREATE_NOP); BMO_vert_flag_enable(bm, dupev, EXT_KEEP); - if (has_vskin) + if (has_vskin) { bm_extrude_disable_skin_root(bm, v); + } if (select_history_map) { BMEditSelection *ese; @@ -464,10 +465,12 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) BM_edge_kill(bm, e); /* kill standalone vertices from this edge - see [#32341] */ - if (!v1->e) + if (!v1->e) { BM_vert_kill(bm, v1); - if (!v2->e) + } + if (!v2->e) { BM_vert_kill(bm, v2); + } continue; } @@ -563,7 +566,9 @@ void bmo_extrude_face_region_exec(BMesh *bm, BMOperator *op) } /* cleanup */ - if (delorig) BMO_op_finish(bm, &delop); + if (delorig) { + BMO_op_finish(bm, &delop); + } BMO_op_finish(bm, &dupeop); } diff --git a/source/blender/bmesh/operators/bmo_fill_grid.c b/source/blender/bmesh/operators/bmo_fill_grid.c index ff9ad5135dd..09c174586f8 100644 --- a/source/blender/bmesh/operators/bmo_fill_grid.c +++ b/source/blender/bmesh/operators/bmo_fill_grid.c @@ -89,7 +89,9 @@ static void quad_verts_to_barycentric_tri( normalize_v3(no); } - if (is_flip) negate_v3(no); + if (is_flip) { + negate_v3(no); + } mul_v3_fl(no, len_v3v3(tri[0], tri[1])); mid_v3_v3v3(tri[2], tri[0], tri[1]); diff --git a/source/blender/bmesh/operators/bmo_hull.c b/source/blender/bmesh/operators/bmo_hull.c index 1979cddfa17..664c4b3f615 100644 --- a/source/blender/bmesh/operators/bmo_hull.c +++ b/source/blender/bmesh/operators/bmo_hull.c @@ -74,8 +74,9 @@ static void hull_add_triangle( t->v[2] = v3; /* Mark triangles vertices as not interior */ - for (i = 0; i < 3; i++) + for (i = 0; i < 3; i++) { BMO_vert_flag_disable(bm, t->v[i], HULL_FLAG_INTERIOR_ELE); + } BLI_gset_insert(hull_triangles, t); normal_tri_v3(t->no, v1->co, v2->co, v3->co); @@ -126,8 +127,9 @@ static void hull_output_triangles(BMesh *bm, GSet *hull_triangles) else { /* Look for an adjacent face that existed before the hull */ for (i = 0; i < 3; i++) { - if (!example) + if (!example) { example = hull_find_example_face(bm, edges[i]); + } } /* Create new hull face */ @@ -178,8 +180,9 @@ static LinkData *final_edges_find_link(ListBase *adj, BMVert *v) LinkData *link; for (link = adj->first; link; link = link->next) { - if (link->data == v) + if (link->data == v) { return link; + } } return NULL; @@ -192,12 +195,14 @@ static int hull_final_edges_lookup( ListBase *adj; /* Use lower vertex pointer for hash key */ - if (v1 > v2) + if (v1 > v2) { SWAP(BMVert *, v1, v2); + } adj = BLI_ghash_lookup(final_edges->edges, v1); - if (!adj) + if (!adj) { return false; + } return !!final_edges_find_link(adj, v2); } @@ -224,8 +229,9 @@ static HullFinalEdges *hull_final_edges(GSet *hull_triangles) ListBase *adj; /* Use lower vertex pointer for hash key */ - if (v1 > v2) + if (v1 > v2) { SWAP(BMVert *, v1, v2); + } adj = BLI_ghash_lookup(final_edges->edges, v1); if (!adj) { @@ -304,8 +310,9 @@ static void hull_mark_interior_elements( /* Check for interior edges too */ BMO_ITER (e, &oiter, op->slots_in, "input", BM_EDGE) { - if (!hull_final_edges_lookup(final_edges, e->v1, e->v2)) + if (!hull_final_edges_lookup(final_edges, e->v1, e->v2)) { BMO_edge_flag_enable(bm, e, HULL_FLAG_INTERIOR_ELE); + } } /* Mark all input faces as interior, some may be unmarked in @@ -409,8 +416,9 @@ static void hull_tag_holes(BMesh *bm, BMOperator *op) } } - if (hole && any_faces) + if (hole && any_faces) { BMO_edge_flag_enable(bm, e, HULL_FLAG_HOLE); + } } } @@ -476,8 +484,9 @@ static BMVert **hull_verts_from_bullet( if (original_index >= 0 && original_index < num_input_verts) { hull_verts[i] = input_verts[original_index]; } - else + else { BLI_assert(!"Unexpected new vertex in hull output"); + } } return hull_verts; @@ -552,8 +561,9 @@ static bool hull_num_input_verts_is_ok(BMOperator *op) BMO_ITER (v, &oiter, op->slots_in, "input", BM_VERT) { partial_num_verts++; - if (partial_num_verts >= 3) + if (partial_num_verts >= 3) { break; + } } return (partial_num_verts >= 3); diff --git a/source/blender/bmesh/operators/bmo_inset.c b/source/blender/bmesh/operators/bmo_inset.c index 72fce49f41f..3534d798b02 100644 --- a/source/blender/bmesh/operators/bmo_inset.c +++ b/source/blender/bmesh/operators/bmo_inset.c @@ -174,8 +174,9 @@ static void bm_loop_customdata_merge( for (layer_n = 0; layer_n < bm->ldata.totlayer; layer_n++) { const int type = bm->ldata.layers[layer_n].type; const int offset = bm->ldata.layers[layer_n].offset; - if (!CustomData_layer_has_math(&bm->ldata, layer_n)) + if (!CustomData_layer_has_math(&bm->ldata, layer_n)) { continue; + } /* check we begin with merged data */ if ((CustomData_data_equals( diff --git a/source/blender/bmesh/operators/bmo_join_triangles.c b/source/blender/bmesh/operators/bmo_join_triangles.c index 7ff7cbbe1ac..19d01cb2e08 100644 --- a/source/blender/bmesh/operators/bmo_join_triangles.c +++ b/source/blender/bmesh/operators/bmo_join_triangles.c @@ -339,8 +339,9 @@ void bmo_join_triangles_exec(BMesh *bm, BMOperator *op) const BMVert *verts[4]; float error; - if (!BMO_edge_flag_test(bm, e, EDGE_MARK)) + if (!BMO_edge_flag_test(bm, e, EDGE_MARK)) { continue; + } bm_edge_to_quad_verts(e, verts); diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c index e3bf4b00968..2ef96d1df03 100644 --- a/source/blender/bmesh/operators/bmo_mirror.c +++ b/source/blender/bmesh/operators/bmo_mirror.c @@ -93,10 +93,12 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op) BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { for (i = 0; i < totlayer; i++) { luv = CustomData_bmesh_get_n(&bm->ldata, l->head.data, CD_MLOOPUV, i); - if (mirror_u) + if (mirror_u) { luv->uv[0] = 1.0f - luv->uv[0]; - if (mirror_v) + } + if (mirror_v) { luv->uv[1] = 1.0f - luv->uv[1]; + } } } } @@ -109,6 +111,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op) BMO_slot_buffer_from_enabled_flag(bm, op, op->slots_out, "geom.out", BM_ALL_NOLOOP, ELE_NEW); - if (vmap) + if (vmap) { MEM_freeN(vmap); + } } diff --git a/source/blender/bmesh/operators/bmo_primitive.c b/source/blender/bmesh/operators/bmo_primitive.c index 12962dd281c..ae9adfbcbba 100644 --- a/source/blender/bmesh/operators/bmo_primitive.c +++ b/source/blender/bmesh/operators/bmo_primitive.c @@ -840,8 +840,9 @@ void BM_mesh_calc_uvs_grid( BLI_assert(cd_loop_uv_offset != -1); BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { - if (!BMO_face_flag_test(bm, f, oflag)) + if (!BMO_face_flag_test(bm, f, oflag)) { continue; + } BM_ITER_ELEM_INDEX (l, &liter, f, BM_LOOPS_OF_FACE, loop_index) { MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); @@ -938,8 +939,9 @@ void bmo_create_uvsphere_exec(BMesh *bm, BMOperator *op) prevop = bmop; } - if (a) + if (a) { BMO_op_finish(bm, &bmop); + } { float len, len2, vec2[3]; @@ -1166,8 +1168,9 @@ void BM_mesh_calc_uvs_sphere( BLI_assert(cd_loop_uv_offset != -1); /* caller is responsible for giving us UVs */ BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { - if (!BMO_face_flag_test(bm, f, oflag)) + if (!BMO_face_flag_test(bm, f, oflag)) { continue; + } bm_mesh_calc_uvs_sphere_face(f, cd_loop_uv_offset); } @@ -1178,8 +1181,9 @@ void BM_mesh_calc_uvs_sphere( float minx = 1.0f; BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { - if (!BMO_face_flag_test(bm, f, oflag)) + if (!BMO_face_flag_test(bm, f, oflag)) { continue; + } BM_ITER_ELEM_INDEX (l, &iter2, f, BM_LOOPS_OF_FACE, loop_index) { MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); if (luv->uv[0] < minx) { @@ -1189,8 +1193,9 @@ void BM_mesh_calc_uvs_sphere( } BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) { - if (!BMO_face_flag_test(bm, f, oflag)) + if (!BMO_face_flag_test(bm, f, oflag)) { continue; + } BM_ITER_ELEM_INDEX (l, &iter2, f, BM_LOOPS_OF_FACE, loop_index) { MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); luv->uv[0] -= minx; @@ -1291,8 +1296,9 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) float vec[3], mat[4][4], phi, phid; int a; - if (!segs) + if (!segs) { return; + } BMO_slot_mat4_get(op->slots_in, "matrix", mat); @@ -1317,8 +1323,9 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) BMO_vert_flag_enable(bm, v1, VERT_MARK); - if (lastv1) + if (lastv1) { BM_edge_create(bm, v1, lastv1, NULL, BM_CREATE_NOP); + } if (a && cap_ends) { BMFace *f; @@ -1327,14 +1334,16 @@ void bmo_create_circle_exec(BMesh *bm, BMOperator *op) BMO_face_flag_enable(bm, f, FACE_NEW); } - if (!firstv1) + if (!firstv1) { firstv1 = v1; + } lastv1 = v1; } - if (!a) + if (!a) { return; + } BM_edge_create(bm, firstv1, lastv1, NULL, 0); @@ -1382,8 +1391,9 @@ void BM_mesh_calc_uvs_circle( invert_m4_m4(inv_mat, mat); BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { - if (!BMO_face_flag_test(bm, f, oflag)) + if (!BMO_face_flag_test(bm, f, oflag)) { continue; + } BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) { MLoopUV *luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); @@ -1416,8 +1426,9 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op) const bool calc_uvs = (cd_loop_uv_offset != -1) && BMO_slot_bool_get(op->slots_in, "calc_uvs"); int a; - if (!segs) + if (!segs) { return; + } BMO_slot_mat4_get(op->slots_in, "matrix", mat); @@ -1487,8 +1498,9 @@ void bmo_create_cone_exec(BMesh *bm, BMOperator *op) lastv2 = v2; } - if (!a) + if (!a) { return; + } if (cap_ends) { f = BM_face_create_quad_tri(bm, cent1, v1, firstv1, NULL, NULL, BM_CREATE_NOP); @@ -1574,8 +1586,9 @@ void BM_mesh_calc_uvs_cone( y = 1.0f - uv_height; BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) { - if (!BMO_face_flag_test(bm, f, oflag)) + if (!BMO_face_flag_test(bm, f, oflag)) { continue; + } if (f->len == 4 && radius_top && radius_bottom) { /* side face - so unwrap it in a rectangle */ @@ -1647,7 +1660,9 @@ void bmo_create_cube_exec(BMesh *bm, BMOperator *op) BMO_slot_mat4_get(op->slots_in, "matrix", mat); - if (!off) off = 0.5f; + if (!off) { + off = 0.5f; + } int i = 0; for (int x = -1; x < 2; x += 2) { diff --git a/source/blender/bmesh/operators/bmo_removedoubles.c b/source/blender/bmesh/operators/bmo_removedoubles.c index eba8c37f1e0..e59bad0d682 100644 --- a/source/blender/bmesh/operators/bmo_removedoubles.c +++ b/source/blender/bmesh/operators/bmo_removedoubles.c @@ -230,10 +230,12 @@ void bmo_weld_verts_exec(BMesh *bm, BMOperator *op) const bool is_del_v2 = BMO_vert_flag_test_bool(bm, (v2 = e->v2), ELE_DEL); if (is_del_v1 || is_del_v2) { - if (is_del_v1) + if (is_del_v1) { v1 = BMO_slot_map_elem_get(slot_targetmap, v1); - if (is_del_v2) + } + if (is_del_v2) { v2 = BMO_slot_map_elem_get(slot_targetmap, v2); + } if (v1 == v2) { BMO_edge_flag_enable(bm, e, EDGE_COL); @@ -337,8 +339,9 @@ void bmo_pointmerge_facedata_exec(BMesh *bm, BMOperator *op) vert_snap = BMO_slot_buffer_get_single(BMO_slot_get(op->slots_in, "vert_snap")); tot = BM_vert_face_count(vert_snap); - if (!tot) + if (!tot) { return; + } fac = 1.0f / tot; BM_ITER_ELEM (l, &iter, vert_snap, BM_LOOPS_OF_VERT) { @@ -388,8 +391,9 @@ void bmo_average_vert_facedata_exec(BMesh *bm, BMOperator *op) const int type = bm->ldata.layers[i].type; const int offset = bm->ldata.layers[i].offset; - if (!CustomData_layer_has_math(&bm->ldata, i)) + if (!CustomData_layer_has_math(&bm->ldata, i)) { continue; + } CustomData_data_initminmax(type, &min, &max); @@ -474,8 +478,9 @@ void bmo_collapse_exec(BMesh *bm, BMOperator *op) zero_v3(center); - if (!BMO_edge_flag_test(bm, e, EDGE_MARK)) + if (!BMO_edge_flag_test(bm, e, EDGE_MARK)) { continue; + } BLI_assert(BLI_stack_is_empty(edge_stack)); @@ -598,8 +603,9 @@ void bmo_collapse_uvs_exec(BMesh *bm, BMOperator *op) #endif for (i = 0; i < bm->ldata.totlayer; i++) { - if (CustomData_layer_has_math(&bm->ldata, i)) + if (CustomData_layer_has_math(&bm->ldata, i)) { bmo_collapsecon_do_layer(bm, i, oflag); + } } #ifndef NDEBUG diff --git a/source/blender/bmesh/operators/bmo_smooth_laplacian.c b/source/blender/bmesh/operators/bmo_smooth_laplacian.c index acdb49e94e1..bf376a757ef 100644 --- a/source/blender/bmesh/operators/bmo_smooth_laplacian.c +++ b/source/blender/bmesh/operators/bmo_smooth_laplacian.c @@ -229,13 +229,17 @@ static void init_laplacian_matrix(LaplacianSystem *sys) sys->zerola[idv1] = 1; sys->zerola[idv2] = 1; sys->zerola[idv3] = 1; - if (has_4_vert) sys->zerola[idv4] = 1; + if (has_4_vert) { + sys->zerola[idv4] = 1; + } } sys->ring_areas[idv1] += areaf; sys->ring_areas[idv2] += areaf; sys->ring_areas[idv3] += areaf; - if (has_4_vert) sys->ring_areas[idv4] += areaf; + if (has_4_vert) { + sys->ring_areas[idv4] += areaf; + } if (has_4_vert) { @@ -478,9 +482,13 @@ void bmo_smooth_laplacian_vert_exec(BMesh *bm, BMOperator *op) BMVert *v; LaplacianSystem *sys; - if (bm->totface == 0) return; + if (bm->totface == 0) { + return; + } sys = init_laplacian_system(bm->totedge, bm->totface, bm->totvert); - if (!sys) return; + if (!sys) { + return; + } sys->bm = bm; sys->op = op; diff --git a/source/blender/bmesh/operators/bmo_subdivide.c b/source/blender/bmesh/operators/bmo_subdivide.c index 360b1fea4d2..6b7f81aabb6 100644 --- a/source/blender/bmesh/operators/bmo_subdivide.c +++ b/source/blender/bmesh/operators/bmo_subdivide.c @@ -151,7 +151,9 @@ static BMEdge *connect_smallest_face(BMesh *bm, BMVert *v_a, BMVert *v_b, BMFace f_new = BM_face_split(bm, f, l_a, l_b, &l_new, NULL, false); - if (r_f_new) *r_f_new = f_new; + if (r_f_new) { + *r_f_new = f_new; + } return l_new ? l_new->e : NULL; } @@ -448,8 +450,12 @@ static void bm_subdivide_multicut( BMO_edge_flag_enable(bm, e_new, SUBD_SPLIT | ELE_SPLIT); BM_CHECK_ELEMENT(v); - if (v->e) BM_CHECK_ELEMENT(v->e); - if (v->e && v->e->l) BM_CHECK_ELEMENT(v->e->l->f); + if (v->e) { + BM_CHECK_ELEMENT(v->e); + } + if (v->e && v->e->l) { + BM_CHECK_ELEMENT(v->e->l->f); + } } alter_co(v1, &e_tmp, params, 0, &v1_tmp, &v2_tmp); @@ -689,8 +695,9 @@ static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts b = numcuts + 1 + numcuts + 1 + (numcuts - i - 1); e = connect_smallest_face(bm, verts[a], verts[b], &f_new); - if (!e) + if (!e) { continue; + } BMO_edge_flag_enable(bm, e, ELE_INNER); BMO_face_flag_enable(bm, f_new, ELE_INNER); @@ -715,8 +722,9 @@ static void quad_4edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts a = i * s + j; b = (i - 1) * s + j; e = connect_smallest_face(bm, lines[a], lines[b], &f_new); - if (!e) + if (!e) { continue; + } BMO_edge_flag_enable(bm, e, ELE_INNER); BMO_face_flag_enable(bm, f_new, ELE_INNER); @@ -794,7 +802,9 @@ static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts, a = numcuts * 2 + 2 + i; b = numcuts + numcuts - i; e = connect_smallest_face(bm, verts[a], verts[b], &f_new); - if (!e) goto cleanup; + if (!e) { + goto cleanup; + } BMO_edge_flag_enable(bm, e, ELE_INNER); BMO_face_flag_enable(bm, f_new, ELE_INNER); @@ -843,7 +853,9 @@ static void tri_3edge_subdivide(BMesh *bm, BMFace *UNUSED(face), BMVert **verts, cleanup: for (i = 1; i < numcuts + 2; i++) { - if (lines[i]) MEM_freeN(lines[i]); + if (lines[i]) { + MEM_freeN(lines[i]); + } } MEM_freeN(lines); @@ -1001,8 +1013,9 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) bool matched = false; /* skip non-quads if requested */ - if (use_only_quads && face->len != 4) + if (use_only_quads && face->len != 4) { continue; + } /* figure out which pattern to use */ @@ -1018,8 +1031,8 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) verts[i] = l_new->v; if (BMO_edge_flag_test(bm, edges[i], SUBD_SPLIT)) { - if (!e1) e1 = edges[i]; - else e2 = edges[i]; + if (!e1) { e1 = edges[i]; } + else { e2 = edges[i]; } totesel++; } @@ -1278,8 +1291,12 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op) BM_data_layer_free_n(bm, &bm->vdata, CD_SHAPEKEY, params.shape_info.tmpkey); BLI_stack_free(facedata); - if (edges) BLI_array_free(edges); - if (verts) BLI_array_free(verts); + if (edges) { + BLI_array_free(edges); + } + if (verts) { + BLI_array_free(verts); + } BLI_array_free(loops_split); BLI_array_free(loops); diff --git a/source/blender/bmesh/operators/bmo_subdivide_edgering.c b/source/blender/bmesh/operators/bmo_subdivide_edgering.c index 04a5cf316be..8c5ee4ede3d 100644 --- a/source/blender/bmesh/operators/bmo_subdivide_edgering.c +++ b/source/blender/bmesh/operators/bmo_subdivide_edgering.c @@ -249,8 +249,9 @@ static GSet *bm_edgering_pair_calc(BMesh *bm, ListBase *eloops_rim) pair_test.first = el_store; pair_test.second = el_store_other; - if (pair_test.first > pair_test.second) + if (pair_test.first > pair_test.second) { SWAP(const void *, pair_test.first, pair_test.second); + } void **pair_key_p; if (!BLI_gset_ensure_p_ex(eloop_pair_gs, &pair_test, &pair_key_p)) { @@ -693,8 +694,8 @@ static void bm_edgering_pair_interpolate( /* create the triangle and transform */ for (j = 0; j < 3; j++) { zero_v3(tri_tmp[j]); - if (j == 1) tri_tmp[j][0] = shape_size; - else if (j == 2) tri_tmp[j][1] = shape_size; + if (j == 1) { tri_tmp[j][0] = shape_size; } + else if (j == 2) { tri_tmp[j][1] = shape_size; } mul_qt_v3(quat_array[i], tri_tmp[j]); add_v3_v3(tri_tmp[j], coord_array_main[i]); } diff --git a/source/blender/bmesh/operators/bmo_utils.c b/source/blender/bmesh/operators/bmo_utils.c index 3e99d5fb814..2439b5fe2b2 100644 --- a/source/blender/bmesh/operators/bmo_utils.c +++ b/source/blender/bmesh/operators/bmo_utils.c @@ -399,24 +399,30 @@ void bmo_smooth_vert_exec(BMesh *UNUSED(bm), BMOperator *op) mul_v3_fl(co, 1.0f / (float)j); interp_v3_v3v3(co, v->co, co, fac); - if (clipx && fabsf(v->co[0]) <= clip_dist) + if (clipx && fabsf(v->co[0]) <= clip_dist) { co[0] = 0.0f; - if (clipy && fabsf(v->co[1]) <= clip_dist) + } + if (clipy && fabsf(v->co[1]) <= clip_dist) { co[1] = 0.0f; - if (clipz && fabsf(v->co[2]) <= clip_dist) + } + if (clipz && fabsf(v->co[2]) <= clip_dist) { co[2] = 0.0f; + } i++; } i = 0; BMO_ITER (v, &siter, op->slots_in, "verts", BM_VERT) { - if (xaxis) + if (xaxis) { v->co[0] = cos[i][0]; - if (yaxis) + } + if (yaxis) { v->co[1] = cos[i][1]; - if (zaxis) + } + if (zaxis) { v->co[2] = cos[i][2]; + } i++; } |