Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/bmesh/intern')
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.c4
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c74
-rw-r--r--source/blender/bmesh/intern/bmesh_edgeloop.c6
-rw-r--r--source/blender/bmesh/intern/bmesh_inline.h4
-rw-r--r--source/blender/bmesh/intern/bmesh_interp.c54
-rw-r--r--source/blender/bmesh/intern/bmesh_iterators.c3
-rw-r--r--source/blender/bmesh/intern/bmesh_log.c27
-rw-r--r--source/blender/bmesh/intern/bmesh_marking.c46
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh.c46
-rw-r--r--source/blender/bmesh/intern/bmesh_mesh_conv.c122
-rw-r--r--source/blender/bmesh/intern/bmesh_operator_api_inline.h12
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c126
-rw-r--r--source/blender/bmesh/intern/bmesh_polygon.c3
-rw-r--r--source/blender/bmesh/intern/bmesh_query.c6
-rw-r--r--source/blender/bmesh/intern/bmesh_structure.c18
-rw-r--r--source/blender/bmesh/intern/bmesh_structure_inline.h12
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers_impl.c16
17 files changed, 396 insertions, 183 deletions
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
index fba71b20e7c..c24a5b21b6c 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -737,7 +737,9 @@ BMesh *BM_mesh_copy(BMesh *bm_old)
ftable[i] = f_new;
- if (f == bm_old->act_face) bm_new->act_face = f_new;
+ if (f == bm_old->act_face) {
+ bm_new->act_face = f_new;
+ }
}
bm_old->elem_index_dirty &= ~BM_FACE;
bm_new->elem_index_dirty &= ~BM_FACE;
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index eead30bcd24..58b83cd0586 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -152,8 +152,9 @@ BMEdge *BM_edge_create(
BLI_assert((e_example == NULL) || (e_example->head.htype == BM_EDGE));
BLI_assert(!(create_flag & 1));
- if ((create_flag & BM_CREATE_NO_DOUBLE) && (e = BM_edge_exists(v1, v2)))
+ if ((create_flag & BM_CREATE_NO_DOUBLE) && (e = BM_edge_exists(v1, v2))) {
return e;
+ }
e = BLI_mempool_alloc(bm->epool);
@@ -554,11 +555,13 @@ int bmesh_elem_check(void *element, const char htype)
IS_FACE_WRONG_LENGTH = (1 << 26),
} err = 0;
- if (!element)
+ if (!element) {
return IS_NULL;
+ }
- if (head->htype != htype)
+ if (head->htype != htype) {
return IS_WRONG_TYPE;
+ }
switch (htype) {
case BM_VERT:
@@ -748,8 +751,9 @@ static void bm_kill_only_vert(BMesh *bm, BMVert *v)
BM_select_history_remove(bm, v);
- if (v->head.data)
+ if (v->head.data) {
CustomData_bmesh_free_block(&bm->vdata, &v->head.data);
+ }
if (bm->vtoolflagpool) {
BLI_mempool_free(bm->vtoolflagpool, ((BMVert_OFlag *)v)->oflags);
@@ -769,8 +773,9 @@ static void bm_kill_only_edge(BMesh *bm, BMEdge *e)
BM_select_history_remove(bm, (BMElem *)e);
- if (e->head.data)
+ if (e->head.data) {
CustomData_bmesh_free_block(&bm->edata, &e->head.data);
+ }
if (bm->etoolflagpool) {
BLI_mempool_free(bm->etoolflagpool, ((BMEdge_OFlag *)e)->oflags);
@@ -784,8 +789,9 @@ static void bm_kill_only_edge(BMesh *bm, BMEdge *e)
*/
static void bm_kill_only_face(BMesh *bm, BMFace *f)
{
- if (bm->act_face == f)
+ if (bm->act_face == f) {
bm->act_face = NULL;
+ }
bm->totface--;
bm->elem_index_dirty |= BM_FACE;
@@ -793,8 +799,9 @@ static void bm_kill_only_face(BMesh *bm, BMFace *f)
BM_select_history_remove(bm, (BMElem *)f);
- if (f->head.data)
+ if (f->head.data) {
CustomData_bmesh_free_block(&bm->pdata, &f->head.data);
+ }
if (bm->ftoolflagpool) {
BLI_mempool_free(bm->ftoolflagpool, ((BMFace_OFlag *)f)->oflags);
@@ -810,8 +817,9 @@ static void bm_kill_only_loop(BMesh *bm, BMLoop *l)
{
bm->totloop--;
bm->elem_index_dirty |= BM_LOOP;
- if (l->head.data)
+ if (l->head.data) {
CustomData_bmesh_free_block(&bm->ldata, &l->head.data);
+ }
BLI_mempool_free(bm->lpool, l);
}
@@ -1128,8 +1136,9 @@ static int UNUSED_FUNCTION(bm_vert_systag_count_disk)(BMVert *v, const char api_
BMEdge *e = v->e;
int i = 0;
- if (!e)
+ if (!e) {
return 0;
+ }
do {
i += BM_ELEM_API_FLAG_TEST(e, api_flag) ? 1 : 0;
@@ -1146,8 +1155,9 @@ static bool bm_vert_is_manifold_flagged(BMVert *v, const char api_flag)
{
BMEdge *e = v->e;
- if (!e)
+ if (!e) {
return false;
+ }
do {
BMLoop *l = e->l;
@@ -1161,8 +1171,9 @@ static bool bm_vert_is_manifold_flagged(BMVert *v, const char api_flag)
}
do {
- if (!BM_ELEM_API_FLAG_TEST(l->f, api_flag))
+ if (!BM_ELEM_API_FLAG_TEST(l->f, api_flag)) {
return false;
+ }
} while ((l = l->radial_next) != e->l);
} while ((e = bmesh_disk_edge_next(e, v)) != v->e);
@@ -1209,8 +1220,9 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del)
return NULL;
}
- if (totface == 1)
+ if (totface == 1) {
return faces[0];
+ }
bm_elements_systag_enable(faces, totface, _FLAG_JF);
@@ -1291,8 +1303,9 @@ BMFace *BM_faces_join(BMesh *bm, BMFace **faces, int totface, const bool do_del)
BMLoop *l2 = l_iter->radial_next;
do {
- if (BM_ELEM_API_FLAG_TEST(l2->f, _FLAG_JF))
+ if (BM_ELEM_API_FLAG_TEST(l2->f, _FLAG_JF)) {
break;
+ }
l2 = l2->radial_next;
} while (l2 != l_iter);
@@ -1486,31 +1499,38 @@ BMFace *bmesh_kernel_split_face_make_edge(
l_iter = l_first = l_f1;
first_loop_f1 = 0;
do {
- if (l_iter == f->l_first)
+ if (l_iter == f->l_first) {
first_loop_f1 = 1;
+ }
} while ((l_iter = l_iter->next) != l_first);
if (first_loop_f1) {
/* original first loop was in f1, find a suitable first loop for f2
* which is as similar as possible to f1. the order matters for tools
* such as duplifaces. */
- if (f->l_first->prev == l_f1)
+ if (f->l_first->prev == l_f1) {
f2->l_first = l_f2->prev;
- else if (f->l_first->next == l_f1)
+ }
+ else if (f->l_first->next == l_f1) {
f2->l_first = l_f2->next;
- else
+ }
+ else {
f2->l_first = l_f2;
+ }
}
else {
/* original first loop was in f2, further do same as above */
f2->l_first = f->l_first;
- if (f->l_first->prev == l_f2)
+ if (f->l_first->prev == l_f2) {
f->l_first = l_f1->prev;
- else if (f->l_first->next == l_f2)
+ }
+ else if (f->l_first->next == l_f2) {
f->l_first = l_f1->next;
- else
+ }
+ else {
f->l_first = l_f1;
+ }
}
#endif
@@ -1539,7 +1559,9 @@ BMFace *bmesh_kernel_split_face_make_edge(
f->len = f1len;
- if (r_l) *r_l = l_f2;
+ if (r_l) {
+ *r_l = l_f2;
+ }
#ifdef USE_BMESH_HOLES
if (holes) {
@@ -1728,7 +1750,9 @@ BMVert *bmesh_kernel_split_edge_make_vert(BMesh *bm, BMVert *tv, BMEdge *e, BMEd
BM_CHECK_ELEMENT(e);
BM_CHECK_ELEMENT(tv);
- if (r_e) *r_e = e_new;
+ if (r_e) {
+ *r_e = e_new;
+ }
return v_new;
}
@@ -2123,16 +2147,18 @@ BMFace *bmesh_kernel_join_face_kill_edge(BMesh *bm, BMFace *f1, BMFace *f2, BMEd
l_f2->prev->next = l_f1->next;
/* if l_f1 was baseloop, make l_f1->next the base. */
- if (BM_FACE_FIRST_LOOP(f1) == l_f1)
+ if (BM_FACE_FIRST_LOOP(f1) == l_f1) {
BM_FACE_FIRST_LOOP(f1) = l_f1->next;
+ }
/* increase length of f1 */
f1->len += (f2->len - 2);
/* make sure each loop points to the proper face */
newlen = f1->len;
- for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f1); i < newlen; i++, l_iter = l_iter->next)
+ for (i = 0, l_iter = BM_FACE_FIRST_LOOP(f1); i < newlen; i++, l_iter = l_iter->next) {
l_iter->f = f1;
+ }
/* remove edge from the disk cycle of its two vertices */
bmesh_disk_edge_remove(l_f1->e, l_f1->e->v1);
diff --git a/source/blender/bmesh/intern/bmesh_edgeloop.c b/source/blender/bmesh/intern/bmesh_edgeloop.c
index 7bd86922df2..1f8661c3e04 100644
--- a/source/blender/bmesh/intern/bmesh_edgeloop.c
+++ b/source/blender/bmesh/intern/bmesh_edgeloop.c
@@ -471,8 +471,9 @@ void BM_mesh_edgeloops_calc_order(BMesh *UNUSED(bm), ListBase *eloops, const boo
const float *no = ((BMEdgeLoopStore *)eloops_ordered.last)->no;
float len_best_sq = FLT_MAX;
- if (use_normals)
+ if (use_normals) {
BLI_ASSERT_UNIT_V3(no);
+ }
for (el_store = eloops->first; el_store; el_store = el_store->next) {
float len_sq;
@@ -619,8 +620,9 @@ void BM_edgeloop_calc_center(BMesh *UNUSED(bm), BMEdgeLoopStore *el_store)
v_next = NODE_AS_CO(node_next);
} while (1);
- if (totw != 0.0f)
+ if (totw != 0.0f) {
mul_v3_fl(el_store->co, 1.0f / (float) totw);
+ }
}
diff --git a/source/blender/bmesh/intern/bmesh_inline.h b/source/blender/bmesh/intern/bmesh_inline.h
index 39657f1c32e..549fc90fe40 100644
--- a/source/blender/bmesh/intern/bmesh_inline.h
+++ b/source/blender/bmesh/intern/bmesh_inline.h
@@ -58,8 +58,8 @@ BLI_INLINE void _bm_elem_flag_disable(BMHeader *head, const char hflag)
BLI_INLINE void _bm_elem_flag_set(BMHeader *head, const char hflag, const int val)
{
- if (val) _bm_elem_flag_enable(head, hflag);
- else _bm_elem_flag_disable(head, hflag);
+ if (val) { _bm_elem_flag_enable(head, hflag); }
+ else { _bm_elem_flag_disable(head, hflag); }
}
BLI_INLINE void _bm_elem_flag_toggle(BMHeader *head, const char hflag)
diff --git a/source/blender/bmesh/intern/bmesh_interp.c b/source/blender/bmesh/intern/bmesh_interp.c
index 655772b49ac..11d6df430c3 100644
--- a/source/blender/bmesh/intern/bmesh_interp.c
+++ b/source/blender/bmesh/intern/bmesh_interp.c
@@ -177,8 +177,9 @@ void BM_face_interp_from_face_ex(
float co[2];
int i;
- if (f_src != f_dst)
+ if (f_src != f_dst) {
BM_elem_attrs_copy(bm, bm, f_src, f_dst);
+ }
/* interpolate */
i = 0;
@@ -213,7 +214,9 @@ void BM_face_interp_from_face(BMesh *bm, BMFace *f_dst, const BMFace *f_src, con
do {
mul_v2_m3v3(cos_2d[i], axis_mat, l_iter->v->co);
blocks_l[i] = l_iter->head.data;
- if (do_vertex) blocks_v[i] = l_iter->v->head.data;
+ if (do_vertex) {
+ blocks_v[i] = l_iter->v->head.data;
+ }
} while ((void)i++, (l_iter = l_iter->next) != l_first);
BM_face_interp_from_face_ex(bm, f_dst, f_src, do_vertex,
@@ -324,10 +327,12 @@ static bool mdisp_in_mdispquad(
float v1[3], v2[3], c[3], v3[3], v4[3], e1[3], e2[3];
float eps = FLT_EPSILON * 4000;
- if (is_zero_v3(l_src->v->no))
+ if (is_zero_v3(l_src->v->no)) {
BM_vert_normal_update_all(l_src->v);
- if (is_zero_v3(l_dst->v->no))
+ }
+ if (is_zero_v3(l_dst->v->no)) {
BM_vert_normal_update_all(l_dst->v);
+ }
compute_mdisp_quad(l_dst, l_dst_f_center, v1, v2, v3, v4, e1, e2);
@@ -341,8 +346,9 @@ static bool mdisp_in_mdispquad(
add_v3_v3(v1, c); add_v3_v3(v2, c);
add_v3_v3(v3, c); add_v3_v3(v4, c);
- if (!quad_co(v1, v2, v3, v4, p, l_src->v->no, r_uv))
+ if (!quad_co(v1, v2, v3, v4, p, l_src->v->no, r_uv)) {
return 0;
+ }
mul_v2_fl(r_uv, (float)(res - 1));
@@ -386,8 +392,9 @@ static void bm_loop_flip_disp(
if (fabsf(d) < 1e-4f) {
d = bm_loop_flip_equotion(mat, b, target_axis_x, target_axis_y, coord, 0, 2);
- if (fabsf(d) < 1e-4f)
+ if (fabsf(d) < 1e-4f) {
d = bm_loop_flip_equotion(mat, b, target_axis_x, target_axis_y, coord, 1, 2);
+ }
}
disp[0] = (b[0] * mat[1][1] - mat[0][1] * b[1]) / d;
@@ -472,8 +479,9 @@ void BM_loop_interp_multires_ex(
float axis_x[3], axis_y[3];
/* ignore 2-edged faces */
- if (UNLIKELY(l_dst->f->len < 3))
+ if (UNLIKELY(l_dst->f->len < 3)) {
return;
+ }
md_dst = BM_ELEM_CD_GET_VOID_P(l_dst, cd_loop_mdisp_offset);
compute_mdisp_quad(l_dst, f_dst_center, v1, v2, v3, v4, e1, e2);
@@ -564,8 +572,9 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f)
BMLoop *l;
BMIter liter;
- if (cd_loop_mdisp_offset == -1)
+ if (cd_loop_mdisp_offset == -1) {
return;
+ }
BM_ITER_ELEM (l, &liter, f, BM_LOOPS_OF_FACE) {
MDisps *mdp = BM_ELEM_CD_GET_VOID_P(l->prev, cd_loop_mdisp_offset);
@@ -621,13 +630,16 @@ void BM_face_multires_bounds_smooth(BMesh *bm, BMFace *f)
* </pre>
*/
- if (l->radial_next == l)
+ if (l->radial_next == l) {
continue;
+ }
- if (l->radial_next->v == l->v)
+ if (l->radial_next->v == l->v) {
mdl2 = BM_ELEM_CD_GET_VOID_P(l->radial_next, cd_loop_mdisp_offset);
- else
+ }
+ else {
mdl2 = BM_ELEM_CD_GET_VOID_P(l->radial_next->next, cd_loop_mdisp_offset);
+ }
sides = (int)sqrt(mdl1->totdisp);
for (y = 0; y < sides; y++) {
@@ -826,7 +838,9 @@ void BM_data_layer_add(BMesh *bm, CustomData *data, int type)
CustomData_add_layer(data, type, CD_DEFAULT, NULL, 0);
update_data_blocks(bm, &olddata, data);
- if (olddata.layers) MEM_freeN(olddata.layers);
+ if (olddata.layers) {
+ MEM_freeN(olddata.layers);
+ }
}
void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const char *name)
@@ -842,7 +856,9 @@ void BM_data_layer_add_named(BMesh *bm, CustomData *data, int type, const char *
CustomData_add_layer_named(data, type, CD_DEFAULT, NULL, 0, name);
update_data_blocks(bm, &olddata, data);
- if (olddata.layers) MEM_freeN(olddata.layers);
+ if (olddata.layers) {
+ MEM_freeN(olddata.layers);
+ }
}
void BM_data_layer_free(BMesh *bm, CustomData *data, int type)
@@ -862,7 +878,9 @@ void BM_data_layer_free(BMesh *bm, CustomData *data, int type)
UNUSED_VARS_NDEBUG(has_layer);
update_data_blocks(bm, &olddata, data);
- if (olddata.layers) MEM_freeN(olddata.layers);
+ if (olddata.layers) {
+ MEM_freeN(olddata.layers);
+ }
}
void BM_data_layer_free_n(BMesh *bm, CustomData *data, int type, int n)
@@ -882,7 +900,9 @@ void BM_data_layer_free_n(BMesh *bm, CustomData *data, int type, int n)
UNUSED_VARS_NDEBUG(has_layer);
update_data_blocks(bm, &olddata, data);
- if (olddata.layers) MEM_freeN(olddata.layers);
+ if (olddata.layers) {
+ MEM_freeN(olddata.layers);
+ }
}
void BM_data_layer_copy(BMesh *bm, CustomData *data, int type, int src_n, int dst_n)
@@ -940,7 +960,9 @@ float BM_elem_float_data_get(CustomData *cd, void *element, int type)
void BM_elem_float_data_set(CustomData *cd, void *element, int type, const float val)
{
float *f = CustomData_bmesh_get(cd, ((BMHeader *)element)->data, type);
- if (f) *f = val;
+ if (f) {
+ *f = val;
+ }
}
/** \name Loop interpolation functions: BM_vert_loop_groups_data_layer_***
diff --git a/source/blender/bmesh/intern/bmesh_iterators.c b/source/blender/bmesh/intern/bmesh_iterators.c
index ce275342557..2f9eeac83e9 100644
--- a/source/blender/bmesh/intern/bmesh_iterators.c
+++ b/source/blender/bmesh/intern/bmesh_iterators.c
@@ -584,8 +584,9 @@ void bmiter__loop_of_loop_begin(struct BMIter__loop_of_loop *iter)
iter->l_first = iter->ldata;
iter->l_next = iter->l_first->radial_next;
- if (iter->l_next == iter->l_first)
+ if (iter->l_next == iter->l_first) {
iter->l_next = NULL;
+ }
}
void *bmiter__loop_of_loop_step(struct BMIter__loop_of_loop *iter)
diff --git a/source/blender/bmesh/intern/bmesh_log.c b/source/blender/bmesh/intern/bmesh_log.c
index 77dd6aa76ec..3b2e43b89ad 100644
--- a/source/blender/bmesh/intern/bmesh_log.c
+++ b/source/blender/bmesh/intern/bmesh_log.c
@@ -523,10 +523,12 @@ BMLog *BM_log_from_existing_entries_create(BMesh *bm, BMLogEntry *entry)
{
BMLog *log = BM_log_create(bm);
- if (entry->prev)
+ if (entry->prev) {
log->current_entry = entry;
- else
+ }
+ else {
log->current_entry = NULL;
+ }
/* Let BMLog manage the entry list again */
log->entries.first = log->entries.last = entry;
@@ -563,19 +565,23 @@ void BM_log_free(BMLog *log)
{
BMLogEntry *entry;
- if (log->unused_ids)
+ if (log->unused_ids) {
range_tree_uint_free(log->unused_ids);
+ }
- if (log->id_to_elem)
+ if (log->id_to_elem) {
BLI_ghash_free(log->id_to_elem, NULL, NULL);
+ }
- if (log->elem_to_id)
+ if (log->elem_to_id) {
BLI_ghash_free(log->elem_to_id, NULL, NULL);
+ }
/* Clear the BMLog references within each entry, but do not free
* the entries themselves */
- for (entry = log->entries.first; entry; entry = entry->next)
+ for (entry = log->entries.first; entry; entry = entry->next) {
entry->log = NULL;
+ }
MEM_freeN(log);
}
@@ -691,10 +697,12 @@ void BM_log_entry_drop(BMLogEntry *entry)
if (!log) {
/* Unlink */
BLI_assert(!(entry->prev && entry->next));
- if (entry->prev)
+ if (entry->prev) {
entry->prev->next = NULL;
- else if (entry->next)
+ }
+ else if (entry->next) {
entry->next->prev = NULL;
+ }
bm_log_entry_free(entry);
MEM_freeN(entry);
@@ -740,8 +748,9 @@ void BM_log_entry_drop(BMLogEntry *entry)
BLI_assert(!"Cannot drop BMLogEntry from middle");
}
- if (log->current_entry == entry)
+ if (log->current_entry == entry) {
log->current_entry = entry->prev;
+ }
bm_log_entry_free(entry);
BLI_freelinkN(&log->entries, entry);
diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c
index 0c18625924d..53d9b4b1b56 100644
--- a/source/blender/bmesh/intern/bmesh_marking.c
+++ b/source/blender/bmesh/intern/bmesh_marking.c
@@ -60,7 +60,9 @@ static void recount_totsels(BMesh *bm)
int count = 0;
BM_ITER_MESH (ele, &iter, bm, iter_types[i]) {
- if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) count += 1;
+ if (BM_elem_flag_test(ele, BM_ELEM_SELECT)) {
+ count += 1;
+ }
}
*tots[i] = count;
}
@@ -667,20 +669,32 @@ static int bm_mesh_flag_count(
if (htype & BM_VERT) {
BM_ITER_MESH (ele, &iter, bm, BM_VERTS_OF_MESH) {
- if (respecthide && BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) continue;
- if (BM_elem_flag_test_bool(ele, hflag) == test_for_enabled) tot++;
+ if (respecthide && BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) {
+ continue;
+ }
+ if (BM_elem_flag_test_bool(ele, hflag) == test_for_enabled) {
+ tot++;
+ }
}
}
if (htype & BM_EDGE) {
BM_ITER_MESH (ele, &iter, bm, BM_EDGES_OF_MESH) {
- if (respecthide && BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) continue;
- if (BM_elem_flag_test_bool(ele, hflag) == test_for_enabled) tot++;
+ if (respecthide && BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) {
+ continue;
+ }
+ if (BM_elem_flag_test_bool(ele, hflag) == test_for_enabled) {
+ tot++;
+ }
}
}
if (htype & BM_FACE) {
BM_ITER_MESH (ele, &iter, bm, BM_FACES_OF_MESH) {
- if (respecthide && BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) continue;
- if (BM_elem_flag_test_bool(ele, hflag) == test_for_enabled) tot++;
+ if (respecthide && BM_elem_flag_test(ele, BM_ELEM_HIDDEN)) {
+ continue;
+ }
+ if (BM_elem_flag_test_bool(ele, hflag) == test_for_enabled) {
+ tot++;
+ }
}
}
@@ -876,9 +890,9 @@ void BM_editselection_plane(BMEditSelection *ese, float r_plane[3])
* we cant make a crossvec from a vec thats the same as the vec
* unlikely but possible, so make sure if the normal is (0, 0, 1)
* that vec isn't the same or in the same direction even. */
- if (eve->no[0] < 0.5f) vec[0] = 1.0f;
- else if (eve->no[1] < 0.5f) vec[1] = 1.0f;
- else vec[2] = 1.0f;
+ if (eve->no[0] < 0.5f) { vec[0] = 1.0f; }
+ else if (eve->no[1] < 0.5f) { vec[1] = 1.0f; }
+ else { vec[2] = 1.0f; }
cross_v3_v3v3(r_plane, eve->no, vec);
}
normalize_v3(r_plane);
@@ -1371,15 +1385,21 @@ void _bm_elem_hide_set(BMesh *bm, BMHeader *head, const bool hide)
* hiding an element */
switch (head->htype) {
case BM_VERT:
- if (hide) BM_vert_select_set(bm, (BMVert *)head, false);
+ if (hide) {
+ BM_vert_select_set(bm, (BMVert *)head, false);
+ }
BM_vert_hide_set((BMVert *)head, hide);
break;
case BM_EDGE:
- if (hide) BM_edge_select_set(bm, (BMEdge *)head, false);
+ if (hide) {
+ BM_edge_select_set(bm, (BMEdge *)head, false);
+ }
BM_edge_hide_set((BMEdge *)head, hide);
break;
case BM_FACE:
- if (hide) BM_face_select_set(bm, (BMFace *)head, false);
+ if (hide) {
+ BM_face_select_set(bm, (BMFace *)head, false);
+ }
BM_face_hide_set((BMFace *)head, hide);
break;
default:
diff --git a/source/blender/bmesh/intern/bmesh_mesh.c b/source/blender/bmesh/intern/bmesh_mesh.c
index c0c46a65479..460b7ce8dae 100644
--- a/source/blender/bmesh/intern/bmesh_mesh.c
+++ b/source/blender/bmesh/intern/bmesh_mesh.c
@@ -213,8 +213,9 @@ void BM_mesh_data_free(BMesh *bm)
if (is_ldata_free || is_pdata_free) {
BM_ITER_MESH (f, &iter, bm, BM_FACES_OF_MESH) {
- if (is_pdata_free)
+ if (is_pdata_free) {
CustomData_bmesh_free_block(&(bm->pdata), &(f->head.data));
+ }
if (is_ldata_free) {
BM_ITER_ELEM (l, &itersub, f, BM_LOOPS_OF_FACE) {
CustomData_bmesh_free_block(&(bm->ldata), &(l->head.data));
@@ -224,10 +225,10 @@ void BM_mesh_data_free(BMesh *bm)
}
/* Free custom data pools, This should probably go in CustomData_free? */
- if (bm->vdata.totlayer) BLI_mempool_destroy(bm->vdata.pool);
- if (bm->edata.totlayer) BLI_mempool_destroy(bm->edata.pool);
- if (bm->ldata.totlayer) BLI_mempool_destroy(bm->ldata.pool);
- if (bm->pdata.totlayer) BLI_mempool_destroy(bm->pdata.pool);
+ if (bm->vdata.totlayer) { BLI_mempool_destroy(bm->vdata.pool); }
+ if (bm->edata.totlayer) { BLI_mempool_destroy(bm->edata.pool); }
+ if (bm->ldata.totlayer) { BLI_mempool_destroy(bm->ldata.pool); }
+ if (bm->pdata.totlayer) { BLI_mempool_destroy(bm->pdata.pool); }
/* free custom data */
CustomData_free(&bm->vdata, 0);
@@ -241,9 +242,9 @@ void BM_mesh_data_free(BMesh *bm)
BLI_mempool_destroy(bm->lpool);
BLI_mempool_destroy(bm->fpool);
- if (bm->vtable) MEM_freeN(bm->vtable);
- if (bm->etable) MEM_freeN(bm->etable);
- if (bm->ftable) MEM_freeN(bm->ftable);
+ if (bm->vtable) { MEM_freeN(bm->vtable); }
+ if (bm->etable) { MEM_freeN(bm->etable); }
+ if (bm->ftable) { MEM_freeN(bm->ftable); }
/* destroy flag pool */
BM_mesh_elem_toolflags_clear(bm);
@@ -924,7 +925,9 @@ static void bm_mesh_loops_calc_normals(
}
else {
/* We still have to consume the stack! */
- while (BLI_SMALLSTACK_POP(clnors));
+ while (BLI_SMALLSTACK_POP(clnors)) {
+ /* pass */
+ }
}
BKE_lnor_space_custom_data_to_normal(lnor_space, *clnor_ref, lnor);
}
@@ -941,7 +944,9 @@ static void bm_mesh_loops_calc_normals(
}
else {
/* We still have to consume the stack! */
- while (BLI_SMALLSTACK_POP(normal));
+ while (BLI_SMALLSTACK_POP(normal)) {
+ /* pass */
+ }
}
}
@@ -1849,8 +1854,9 @@ void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
/* pass (re-use the array) */
}
else {
- if (bm->vtable)
+ if (bm->vtable) {
MEM_freeN(bm->vtable);
+ }
bm->vtable = MEM_mallocN(sizeof(void **) * bm->totvert, "bm->vtable");
bm->vtable_tot = bm->totvert;
}
@@ -1860,8 +1866,9 @@ void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
/* pass (re-use the array) */
}
else {
- if (bm->etable)
+ if (bm->etable) {
MEM_freeN(bm->etable);
+ }
bm->etable = MEM_mallocN(sizeof(void **) * bm->totedge, "bm->etable");
bm->etable_tot = bm->totedge;
}
@@ -1871,8 +1878,9 @@ void BM_mesh_elem_table_ensure(BMesh *bm, const char htype)
/* pass (re-use the array) */
}
else {
- if (bm->ftable)
+ if (bm->ftable) {
MEM_freeN(bm->ftable);
+ }
bm->ftable = MEM_mallocN(sizeof(void **) * bm->totface, "bm->ftable");
bm->ftable_tot = bm->totface;
}
@@ -2020,8 +2028,9 @@ void BM_mesh_remap(
BMFace *fa;
BMLoop *lo;
- if (!(vert_idx || edge_idx || face_idx))
+ if (!(vert_idx || edge_idx || face_idx)) {
return;
+ }
BM_mesh_elem_table_ensure(
bm,
@@ -2271,12 +2280,15 @@ void BM_mesh_remap(
}
}
- if (vptr_map)
+ if (vptr_map) {
BLI_ghash_free(vptr_map, NULL, NULL);
- if (eptr_map)
+ }
+ if (eptr_map) {
BLI_ghash_free(eptr_map, NULL, NULL);
- if (fptr_map)
+ }
+ if (fptr_map) {
BLI_ghash_free(fptr_map, NULL, NULL);
+ }
}
/**
diff --git a/source/blender/bmesh/intern/bmesh_mesh_conv.c b/source/blender/bmesh/intern/bmesh_mesh_conv.c
index 4dc6cc8b965..66cd3a0b30c 100644
--- a/source/blender/bmesh/intern/bmesh_mesh_conv.c
+++ b/source/blender/bmesh/intern/bmesh_mesh_conv.c
@@ -318,10 +318,14 @@ void BM_mesh_bm_from_me(
/* Copy Custom Data */
CustomData_to_bmesh_block(&me->vdata, &bm->vdata, i, &v->head.data, true);
- if (cd_vert_bweight_offset != -1) BM_ELEM_CD_SET_FLOAT(v, cd_vert_bweight_offset, (float)mvert->bweight / 255.0f);
+ if (cd_vert_bweight_offset != -1) {
+ BM_ELEM_CD_SET_FLOAT(v, cd_vert_bweight_offset, (float)mvert->bweight / 255.0f);
+ }
/* set shape key original index */
- if (cd_shape_keyindex_offset != -1) BM_ELEM_CD_SET_INT(v, cd_shape_keyindex_offset, i);
+ if (cd_shape_keyindex_offset != -1) {
+ BM_ELEM_CD_SET_INT(v, cd_shape_keyindex_offset, i);
+ }
/* set shapekey data */
if (tot_shape_keys) {
@@ -353,8 +357,12 @@ void BM_mesh_bm_from_me(
/* Copy Custom Data */
CustomData_to_bmesh_block(&me->edata, &bm->edata, i, &e->head.data, true);
- if (cd_edge_bweight_offset != -1) BM_ELEM_CD_SET_FLOAT(e, cd_edge_bweight_offset, (float)medge->bweight / 255.0f);
- if (cd_edge_crease_offset != -1) BM_ELEM_CD_SET_FLOAT(e, cd_edge_crease_offset, (float)medge->crease / 255.0f);
+ if (cd_edge_bweight_offset != -1) {
+ BM_ELEM_CD_SET_FLOAT(e, cd_edge_bweight_offset, (float)medge->bweight / 255.0f);
+ }
+ if (cd_edge_crease_offset != -1) {
+ BM_ELEM_CD_SET_FLOAT(e, cd_edge_crease_offset, (float)medge->crease / 255.0f);
+ }
}
if (is_new) {
@@ -397,7 +405,9 @@ void BM_mesh_bm_from_me(
}
f->mat_nr = mp->mat_nr;
- if (i == me->act_face) bm->act_face = f;
+ if (i == me->act_face) {
+ bm->act_face = f;
+ }
int j = mp->loopstart;
l_iter = l_first = BM_FACE_FIRST_LOOP(f);
@@ -567,20 +577,36 @@ void BM_mesh_bm_to_me(
ototvert = me->totvert;
/* new vertex block */
- if (bm->totvert == 0) mvert = NULL;
- else mvert = MEM_callocN(bm->totvert * sizeof(MVert), "loadeditbMesh vert");
+ if (bm->totvert == 0) {
+ mvert = NULL;
+ }
+ else {
+ mvert = MEM_callocN(bm->totvert * sizeof(MVert), "loadeditbMesh vert");
+ }
/* new edge block */
- if (bm->totedge == 0) medge = NULL;
- else medge = MEM_callocN(bm->totedge * sizeof(MEdge), "loadeditbMesh edge");
+ if (bm->totedge == 0) {
+ medge = NULL;
+ }
+ else {
+ medge = MEM_callocN(bm->totedge * sizeof(MEdge), "loadeditbMesh edge");
+ }
/* new ngon face block */
- if (bm->totface == 0) mpoly = NULL;
- else mpoly = MEM_callocN(bm->totface * sizeof(MPoly), "loadeditbMesh poly");
+ if (bm->totface == 0) {
+ mpoly = NULL;
+ }
+ else {
+ mpoly = MEM_callocN(bm->totface * sizeof(MPoly), "loadeditbMesh poly");
+ }
/* new loop block */
- if (bm->totloop == 0) mloop = NULL;
- else mloop = MEM_callocN(bm->totloop * sizeof(MLoop), "loadeditbMesh loop");
+ if (bm->totloop == 0) {
+ mloop = NULL;
+ }
+ else {
+ mloop = MEM_callocN(bm->totloop * sizeof(MLoop), "loadeditbMesh loop");
+ }
/* lets save the old verts just in case we are actually working on
* a key ... we now do processing of the keys at the end */
@@ -640,7 +666,9 @@ void BM_mesh_bm_to_me(
/* copy over customdat */
CustomData_from_bmesh_block(&bm->vdata, &me->vdata, v->head.data, i);
- if (cd_vert_bweight_offset != -1) mvert->bweight = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(v, cd_vert_bweight_offset);
+ if (cd_vert_bweight_offset != -1) {
+ mvert->bweight = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(v, cd_vert_bweight_offset);
+ }
i++;
mvert++;
@@ -664,8 +692,12 @@ void BM_mesh_bm_to_me(
bmesh_quick_edgedraw_flag(med, e);
- if (cd_edge_crease_offset != -1) med->crease = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(e, cd_edge_crease_offset);
- if (cd_edge_bweight_offset != -1) med->bweight = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(e, cd_edge_bweight_offset);
+ if (cd_edge_crease_offset != -1) {
+ med->crease = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(e, cd_edge_crease_offset);
+ }
+ if (cd_edge_bweight_offset != -1) {
+ med->bweight = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(e, cd_edge_bweight_offset);
+ }
i++;
med++;
@@ -697,7 +729,9 @@ void BM_mesh_bm_to_me(
BM_CHECK_ELEMENT(l_iter->v);
} while ((l_iter = l_iter->next) != l_first);
- if (f == bm->act_face) me->act_face = i;
+ if (f == bm->act_face) {
+ me->act_face = i;
+ }
/* copy over customdata */
CustomData_from_bmesh_block(&bm->pdata, &me->pdata, f->head.data, i);
@@ -723,15 +757,21 @@ void BM_mesh_bm_to_me(
if (ob->par1 < ototvert) {
eve = vertMap[ob->par1];
- if (eve) ob->par1 = BM_elem_index_get(eve);
+ if (eve) {
+ ob->par1 = BM_elem_index_get(eve);
+ }
}
if (ob->par2 < ototvert) {
eve = vertMap[ob->par2];
- if (eve) ob->par2 = BM_elem_index_get(eve);
+ if (eve) {
+ ob->par2 = BM_elem_index_get(eve);
+ }
}
if (ob->par3 < ototvert) {
eve = vertMap[ob->par3];
- if (eve) ob->par3 = BM_elem_index_get(eve);
+ if (eve) {
+ ob->par3 = BM_elem_index_get(eve);
+ }
}
}
@@ -763,7 +803,9 @@ void BM_mesh_bm_to_me(
}
}
- if (vertMap) MEM_freeN(vertMap);
+ if (vertMap) {
+ MEM_freeN(vertMap);
+ }
}
BKE_mesh_update_customdata_pointers(me, false);
@@ -809,12 +851,14 @@ void BM_mesh_bm_to_me(
* necessary */
j = 0;
for (i = 0; i < bm->vdata.totlayer; i++) {
- if (bm->vdata.layers[i].type != CD_SHAPEKEY)
+ if (bm->vdata.layers[i].type != CD_SHAPEKEY) {
continue;
+ }
for (currkey = me->key->block.first; currkey; currkey = currkey->next) {
- if (currkey->uid == bm->vdata.layers[i].uid)
+ if (currkey->uid == bm->vdata.layers[i].uid) {
break;
+ }
}
if (!currkey) {
@@ -930,10 +974,14 @@ void BM_mesh_bm_to_me(
currkey->data = newkey;
}
- if (ofs) MEM_freeN(ofs);
+ if (ofs) {
+ MEM_freeN(ofs);
+ }
}
- if (oldverts) MEM_freeN(oldverts);
+ if (oldverts) {
+ MEM_freeN(oldverts);
+ }
/* topology could be changed, ensure mdisps are ok */
multires_topology_changed(me);
@@ -1025,9 +1073,13 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *
mv->flag = BM_vert_flag_to_mflag(eve);
- if (cd_vert_bweight_offset != -1) mv->bweight = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(eve, cd_vert_bweight_offset);
+ if (cd_vert_bweight_offset != -1) {
+ mv->bweight = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(eve, cd_vert_bweight_offset);
+ }
- if (add_orig) *index++ = i;
+ if (add_orig) {
+ *index++ = i;
+ }
CustomData_from_bmesh_block(&bm->vdata, &me->vdata, eve->head.data, i);
}
@@ -1052,11 +1104,17 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *
}
}
- if (cd_edge_crease_offset != -1) med->crease = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(eed, cd_edge_crease_offset);
- if (cd_edge_bweight_offset != -1) med->bweight = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(eed, cd_edge_bweight_offset);
+ if (cd_edge_crease_offset != -1) {
+ med->crease = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(eed, cd_edge_crease_offset);
+ }
+ if (cd_edge_bweight_offset != -1) {
+ med->bweight = BM_ELEM_CD_GET_FLOAT_AS_UCHAR(eed, cd_edge_bweight_offset);
+ }
CustomData_from_bmesh_block(&bm->edata, &me->edata, eed->head.data, i);
- if (add_orig) *index++ = i;
+ if (add_orig) {
+ *index++ = i;
+ }
}
bm->elem_index_dirty &= ~BM_EDGE;
@@ -1088,7 +1146,9 @@ void BM_mesh_bm_to_me_for_eval(BMesh *bm, Mesh *me, const CustomData_MeshMasks *
CustomData_from_bmesh_block(&bm->pdata, &me->pdata, efa->head.data, i);
- if (add_orig) *index++ = i;
+ if (add_orig) {
+ *index++ = i;
+ }
}
bm->elem_index_dirty &= ~(BM_FACE | BM_LOOP);
diff --git a/source/blender/bmesh/intern/bmesh_operator_api_inline.h b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
index 030b9480e4f..78e75cf3d30 100644
--- a/source/blender/bmesh/intern/bmesh_operator_api_inline.h
+++ b/source/blender/bmesh/intern/bmesh_operator_api_inline.h
@@ -64,8 +64,8 @@ ATTR_NONNULL(1, 2)
BLI_INLINE void _bmo_elem_flag_set(BMesh *bm, BMFlagLayer *oflags, const short oflag, int val)
{
BLI_assert(bm->use_toolflags);
- if (val) oflags[bm->toolflag_index].f |= oflag;
- else oflags[bm->toolflag_index].f &= (short)~oflag;
+ if (val) { oflags[bm->toolflag_index].f |= oflag; }
+ else { oflags[bm->toolflag_index].f &= (short)~oflag; }
}
ATTR_NONNULL(1, 2)
@@ -204,7 +204,9 @@ BLI_INLINE void *BMO_slot_map_ptr_get(BMOpSlot *slot, const void *element)
{
void **val = BMO_slot_map_data_get(slot, element);
BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_INTERNAL);
- if (val) return *val;
+ if (val) {
+ return *val;
+ }
return NULL;
}
@@ -214,7 +216,9 @@ BLI_INLINE void *BMO_slot_map_elem_get(BMOpSlot *slot, const void *element)
{
void **val = (void **) BMO_slot_map_data_get(slot, element);
BLI_assert(slot->slot_subtype.map == BMO_OP_SLOT_SUBTYPE_MAP_ELEM);
- if (val) return *val;
+ if (val) {
+ return *val;
+ }
return NULL;
}
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index 2ce03cf5a7d..5586db26664 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -96,10 +96,12 @@ void BMO_push(BMesh *bm, BMOperator *UNUSED(op))
BLI_assert(bm->totflags > 0);
/* add flag layer, if appropriate */
- if (bm->toolflag_index > 0)
+ if (bm->toolflag_index > 0) {
bmo_flag_layer_alloc(bm);
- else
+ }
+ else {
bmo_flag_layer_clear(bm);
+ }
}
/**
@@ -111,8 +113,9 @@ void BMO_push(BMesh *bm, BMOperator *UNUSED(op))
*/
void BMO_pop(BMesh *bm)
{
- if (bm->toolflag_index > 0)
+ if (bm->toolflag_index > 0) {
bmo_flag_layer_free(bm);
+ }
bm->toolflag_index--;
}
@@ -212,12 +215,14 @@ void BMO_op_exec(BMesh *bm, BMOperator *op)
BMO_push(bm, op);
- if (bm->toolflag_index == 1)
+ if (bm->toolflag_index == 1) {
bmesh_edit_begin(bm, op->type_flag);
+ }
op->exec(bm, op);
- if (bm->toolflag_index == 1)
+ if (bm->toolflag_index == 1) {
bmesh_edit_end(bm, op->type_flag);
+ }
BMO_pop(bm);
}
@@ -287,8 +292,9 @@ void _bmo_slot_copy(
BMOpSlot *slot_src = BMO_slot_get(slot_args_src, slot_name_src);
BMOpSlot *slot_dst = BMO_slot_get(slot_args_dst, slot_name_dst);
- if (slot_src == slot_dst)
+ if (slot_src == slot_dst) {
return;
+ }
BLI_assert(slot_src->slot_type == slot_dst->slot_type);
if (slot_src->slot_type != slot_dst->slot_type) {
@@ -368,8 +374,9 @@ void BMO_slot_float_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_n
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_FLT);
- if (!(slot->slot_type == BMO_OP_SLOT_FLT))
+ if (!(slot->slot_type == BMO_OP_SLOT_FLT)) {
return;
+ }
slot->data.f = f;
}
@@ -378,8 +385,9 @@ void BMO_slot_int_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_nam
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_INT);
- if (!(slot->slot_type == BMO_OP_SLOT_INT))
+ if (!(slot->slot_type == BMO_OP_SLOT_INT)) {
return;
+ }
slot->data.i = i;
}
@@ -388,8 +396,9 @@ void BMO_slot_bool_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_na
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_BOOL);
- if (!(slot->slot_type == BMO_OP_SLOT_BOOL))
+ if (!(slot->slot_type == BMO_OP_SLOT_BOOL)) {
return;
+ }
slot->data.i = i;
}
@@ -399,8 +408,9 @@ void BMO_slot_mat_set(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS], cons
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAT);
- if (!(slot->slot_type == BMO_OP_SLOT_MAT))
+ if (!(slot->slot_type == BMO_OP_SLOT_MAT)) {
return;
+ }
slot->len = 4;
slot->data.p = BLI_memarena_alloc(op->arena, sizeof(float) * 4 * 4);
@@ -422,8 +432,9 @@ void BMO_slot_mat4_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_na
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAT);
- if (!(slot->slot_type == BMO_OP_SLOT_MAT))
+ if (!(slot->slot_type == BMO_OP_SLOT_MAT)) {
return;
+ }
if (slot->data.p) {
copy_m4_m4(r_mat, BMO_SLOT_AS_MATRIX(slot));
@@ -437,8 +448,9 @@ void BMO_slot_mat3_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_na
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_MAT);
- if (!(slot->slot_type == BMO_OP_SLOT_MAT))
+ if (!(slot->slot_type == BMO_OP_SLOT_MAT)) {
return;
+ }
if (slot->data.p) {
copy_m3_m4(r_mat, BMO_SLOT_AS_MATRIX(slot));
@@ -452,8 +464,9 @@ void BMO_slot_ptr_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_nam
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_PTR);
- if (!(slot->slot_type == BMO_OP_SLOT_PTR))
+ if (!(slot->slot_type == BMO_OP_SLOT_PTR)) {
return;
+ }
slot->data.p = p;
}
@@ -462,8 +475,9 @@ void BMO_slot_vec_set(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_nam
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_VEC);
- if (!(slot->slot_type == BMO_OP_SLOT_VEC))
+ if (!(slot->slot_type == BMO_OP_SLOT_VEC)) {
return;
+ }
copy_v3_v3(slot->data.vec, vec);
}
@@ -473,8 +487,9 @@ float BMO_slot_float_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_FLT);
- if (!(slot->slot_type == BMO_OP_SLOT_FLT))
+ if (!(slot->slot_type == BMO_OP_SLOT_FLT)) {
return 0.0f;
+ }
return slot->data.f;
}
@@ -483,8 +498,9 @@ int BMO_slot_int_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_name
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_INT);
- if (!(slot->slot_type == BMO_OP_SLOT_INT))
+ if (!(slot->slot_type == BMO_OP_SLOT_INT)) {
return 0;
+ }
return slot->data.i;
}
@@ -493,8 +509,9 @@ bool BMO_slot_bool_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_na
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_BOOL);
- if (!(slot->slot_type == BMO_OP_SLOT_BOOL))
+ if (!(slot->slot_type == BMO_OP_SLOT_BOOL)) {
return 0;
+ }
return slot->data.i;
}
@@ -518,8 +535,9 @@ void *BMO_slot_ptr_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_na
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_PTR);
- if (!(slot->slot_type == BMO_OP_SLOT_PTR))
+ if (!(slot->slot_type == BMO_OP_SLOT_PTR)) {
return NULL;
+ }
return slot->data.p;
}
@@ -528,8 +546,9 @@ void BMO_slot_vec_get(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot_nam
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
BLI_assert(slot->slot_type == BMO_OP_SLOT_VEC);
- if (!(slot->slot_type == BMO_OP_SLOT_VEC))
+ if (!(slot->slot_type == BMO_OP_SLOT_VEC)) {
return;
+ }
copy_v3_v3(r_vec, slot->data.vec);
}
@@ -660,8 +679,9 @@ int BMO_slot_buffer_count(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char *slot
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
/* check if its actually a buffer */
- if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF)
+ if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF) {
return 0;
+ }
return slot->len;
}
@@ -755,8 +775,9 @@ void *BMO_slot_buffer_alloc(BMOperator *op, BMOpSlot slot_args[BMO_OP_MAX_SLOTS]
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
/* check if its actually a buffer */
- if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF)
+ if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF) {
return NULL;
+ }
slot->len = len;
if (len) {
@@ -784,9 +805,9 @@ void BMO_slot_buffer_from_all(
BLI_assert(output->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
BLI_assert(((output->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype);
- if (htype & BM_VERT) totelement += bm->totvert;
- if (htype & BM_EDGE) totelement += bm->totedge;
- if (htype & BM_FACE) totelement += bm->totface;
+ if (htype & BM_VERT) { totelement += bm->totvert; }
+ if (htype & BM_EDGE) { totelement += bm->totedge; }
+ if (htype & BM_FACE) { totelement += bm->totface; }
if (totelement) {
BMIter iter;
@@ -838,10 +859,12 @@ static void bmo_slot_buffer_from_hflag(
BLI_assert(((output->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype);
BLI_assert((output->slot_subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE) == 0);
- if (test_for_enabled)
+ if (test_for_enabled) {
totelement = BM_mesh_elem_hflag_count_enabled(bm, htype, hflag, respecthide);
- else
+ }
+ else {
totelement = BM_mesh_elem_hflag_count_disabled(bm, htype, hflag, respecthide);
+ }
if (totelement) {
BMIter iter;
@@ -999,10 +1022,12 @@ static void bmo_slot_buffer_from_flag(
BLI_assert(((slot->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype);
BLI_assert((slot->slot_subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE) == 0);
- if (test_for_enabled)
+ if (test_for_enabled) {
totelement = BMO_mesh_enabled_flag_count(bm, htype, oflag);
- else
+ }
+ else {
totelement = BMO_mesh_disabled_flag_count(bm, htype, oflag);
+ }
if (totelement) {
BMIter iter;
@@ -1085,8 +1110,9 @@ void BMO_slot_buffer_hflag_enable(
BLI_assert((slot->slot_subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE) == 0);
for (i = 0; i < slot->len; i++, data++) {
- if (!(htype & (*data)->head.htype))
+ if (!(htype & (*data)->head.htype)) {
continue;
+ }
if (do_flush_select) {
BM_elem_select_set(bm, *data, true);
@@ -1121,8 +1147,9 @@ void BMO_slot_buffer_hflag_disable(
BLI_assert(((slot->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype);
for (i = 0; i < slot->len; i++, data++) {
- if (!(htype & (*data)->head.htype))
+ if (!(htype & (*data)->head.htype)) {
continue;
+ }
if (do_flush_select) {
BM_elem_select_set(bm, *data, false);
@@ -1154,8 +1181,9 @@ void BMO_slot_buffer_flag_enable(
BLI_assert(((slot->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype);
for (i = 0; i < slot->len; i++) {
- if (!(htype & data[i]->htype))
+ if (!(htype & data[i]->htype)) {
continue;
+ }
BMO_elem_flag_enable(bm, (BMElemF *)data[i], oflag);
}
@@ -1179,8 +1207,9 @@ void BMO_slot_buffer_flag_disable(
BLI_assert(((slot->slot_subtype.elem & BM_ALL_NOLOOP) & htype) == htype);
for (i = 0; i < slot->len; i++) {
- if (!(htype & data[i]->htype))
+ if (!(htype & data[i]->htype)) {
continue;
+ }
BMO_elem_flag_disable(bm, (BMElemF *)data[i], oflag);
}
@@ -1363,8 +1392,9 @@ void *BMO_slot_buffer_get_first(BMOpSlot slot_args[BMO_OP_MAX_SLOTS], const char
{
BMOpSlot *slot = BMO_slot_get(slot_args, slot_name);
- if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF)
+ if (slot->slot_type != BMO_OP_SLOT_ELEMENT_BUF) {
return NULL;
+ }
return slot->data.buf ? *slot->data.buf : NULL;
}
@@ -1496,7 +1526,9 @@ typedef struct BMOpError {
void BMO_error_clear(BMesh *bm)
{
- while (BMO_error_pop(bm, NULL, NULL));
+ while (BMO_error_pop(bm, NULL, NULL)) {
+ /* pass */
+ }
}
void BMO_error_raise(BMesh *bm, BMOperator *owner, int errcode, const char *msg)
@@ -1526,8 +1558,12 @@ int BMO_error_get(BMesh *bm, const char **msg, BMOperator **op)
return 0;
}
- if (msg) *msg = err->msg;
- if (op) *op = err->op;
+ if (msg) {
+ *msg = err->msg;
+ }
+ if (op) {
+ *op = err->op;
+ }
return err->errorcode;
}
@@ -1590,8 +1626,9 @@ int BMO_opcode_from_opname(const char *opname)
static int BMO_opcode_from_opname_check(const char *opname)
{
int i = BMO_opcode_from_opname(opname);
- if (i == -1)
+ if (i == -1) {
fprintf(stderr, "%s: could not find bmesh slot for name %s! (bmesh internal error)\n", __func__, opname);
+ }
return i;
}
@@ -1702,8 +1739,9 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
fmt += i;
/* ignore trailing whitespace */
- if (!fmt[i])
+ if (!fmt[i]) {
break;
+ }
/* find end of slot name, only "slot=%f", can be used */
i = strcspn(fmt, "=");
@@ -1734,9 +1772,9 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
const char c = NEXT_CHAR(fmt);
fmt++;
- if (c == '3') size = 3;
- else if (c == '4') size = 4;
- else GOTO_ERROR("matrix size was not 3 or 4");
+ if (c == '3') { size = 3; }
+ else if (c == '4') { size = 4; }
+ else { GOTO_ERROR("matrix size was not 3 or 4"); }
BMO_slot_mat_set(op, op->slots_in, slot_name, va_arg(vlist, void *), size);
state = true;
@@ -1816,9 +1854,9 @@ bool BMO_op_vinitf(BMesh *bm, BMOperator *op, const int flag, const char *_fmt,
while (1) {
char htype_set;
const char c = NEXT_CHAR(fmt);
- if (c == 'f') htype_set = BM_FACE;
- else if (c == 'e') htype_set = BM_EDGE;
- else if (c == 'v') htype_set = BM_VERT;
+ if (c == 'f') { htype_set = BM_FACE; }
+ else if (c == 'e') { htype_set = BM_EDGE; }
+ else if (c == 'v') { htype_set = BM_VERT; }
else {
break;
}
diff --git a/source/blender/bmesh/intern/bmesh_polygon.c b/source/blender/bmesh/intern/bmesh_polygon.c
index 03dc9997587..4cc3cf3e4c1 100644
--- a/source/blender/bmesh/intern/bmesh_polygon.c
+++ b/source/blender/bmesh/intern/bmesh_polygon.c
@@ -635,8 +635,9 @@ void BM_face_calc_center_median_weighted(const BMFace *f, float r_cent[3])
w_prev = w_curr;
} while ((l_iter = l_iter->next) != l_first);
- if (totw != 0.0f)
+ if (totw != 0.0f) {
mul_v3_fl(r_cent, 1.0f / (float) totw);
+ }
}
/**
diff --git a/source/blender/bmesh/intern/bmesh_query.c b/source/blender/bmesh/intern/bmesh_query.c
index 7a0d1c7ec5a..4b34e1fe07d 100644
--- a/source/blender/bmesh/intern/bmesh_query.c
+++ b/source/blender/bmesh/intern/bmesh_query.c
@@ -1179,8 +1179,9 @@ int BM_face_share_face_count(BMFace *f1, BMFace *f2)
BM_ITER_ELEM (e, &iter1, f1, BM_EDGES_OF_FACE) {
BM_ITER_ELEM (f, &iter2, e, BM_FACES_OF_EDGE) {
- if (f != f1 && f != f2 && BM_face_share_edge_check(f, f2))
+ if (f != f1 && f != f2 && BM_face_share_edge_check(f, f2)) {
count++;
+ }
}
}
@@ -1198,8 +1199,9 @@ bool BM_face_share_face_check(BMFace *f1, BMFace *f2)
BM_ITER_ELEM (e, &iter1, f1, BM_EDGES_OF_FACE) {
BM_ITER_ELEM (f, &iter2, e, BM_FACES_OF_EDGE) {
- if (f != f1 && f != f2 && BM_face_share_edge_check(f, f2))
+ if (f != f1 && f != f2 && BM_face_share_edge_check(f, f2)) {
return true;
+ }
}
}
diff --git a/source/blender/bmesh/intern/bmesh_structure.c b/source/blender/bmesh/intern/bmesh_structure.c
index e4bad715b29..a90d0d245d0 100644
--- a/source/blender/bmesh/intern/bmesh_structure.c
+++ b/source/blender/bmesh/intern/bmesh_structure.c
@@ -172,8 +172,9 @@ void bmesh_disk_edge_append(BMEdge *e, BMVert *v)
dl1->prev = dl2->prev;
dl2->prev = e;
- if (dl3)
+ if (dl3) {
dl3->next = e;
+ }
}
}
@@ -192,8 +193,9 @@ void bmesh_disk_edge_remove(BMEdge *e, BMVert *v)
dl2->prev = dl1->prev;
}
- if (v->e == e)
+ if (v->e == e) {
v->e = (e != dl1->next) ? dl1->next : NULL;
+ }
dl1->next = dl1->prev = NULL;
}
@@ -387,8 +389,9 @@ bool bmesh_radial_validate(int radlen, BMLoop *l)
BMLoop *l_iter = l;
int i = 0;
- if (bmesh_radial_length(l) != radlen)
+ if (bmesh_radial_length(l) != radlen) {
return false;
+ }
do {
if (UNLIKELY(!l_iter)) {
@@ -396,10 +399,12 @@ bool bmesh_radial_validate(int radlen, BMLoop *l)
return false;
}
- if (l_iter->e != l->e)
+ if (l_iter->e != l->e) {
return false;
- if (l_iter->v != l->e->v1 && l_iter->v != l->e->v2)
+ }
+ if (l_iter->v != l->e->v1 && l_iter->v != l->e->v2) {
return false;
+ }
if (UNLIKELY(i > BM_LOOP_RADIAL_MAX)) {
BMESH_ASSERT(0);
@@ -526,8 +531,9 @@ int bmesh_radial_length(const BMLoop *l)
const BMLoop *l_iter = l;
int i = 0;
- if (!l)
+ if (!l) {
return 0;
+ }
do {
if (UNLIKELY(!l_iter)) {
diff --git a/source/blender/bmesh/intern/bmesh_structure_inline.h b/source/blender/bmesh/intern/bmesh_structure_inline.h
index 31c1e6500c9..0998d9bd907 100644
--- a/source/blender/bmesh/intern/bmesh_structure_inline.h
+++ b/source/blender/bmesh/intern/bmesh_structure_inline.h
@@ -40,20 +40,24 @@ BLI_INLINE BMDiskLink *bmesh_disk_edge_link_from_vert(const BMEdge *e, const BMV
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_INLINE BMEdge *bmesh_disk_edge_next_safe(const BMEdge *e, const BMVert *v)
{
- if (v == e->v1)
+ if (v == e->v1) {
return e->v1_disk_link.next;
- if (v == e->v2)
+ }
+ if (v == e->v2) {
return e->v2_disk_link.next;
+ }
return NULL;
}
ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
BLI_INLINE BMEdge *bmesh_disk_edge_prev_safe(const BMEdge *e, const BMVert *v)
{
- if (v == e->v1)
+ if (v == e->v1) {
return e->v1_disk_link.prev;
- if (v == e->v2)
+ }
+ if (v == e->v2) {
return e->v2_disk_link.prev;
+ }
return NULL;
}
diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c
index 67e3a86fbe3..0ac9b958c11 100644
--- a/source/blender/bmesh/intern/bmesh_walkers_impl.c
+++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c
@@ -1170,8 +1170,9 @@ static void bmw_FaceLoopWalker_begin(BMWalker *walker, void *data)
/* BMesh *bm = walker->bm; */ /* UNUSED */
/* int fcount = BM_edge_face_count(e); */ /* UNUSED */
- if (!bmw_FaceLoopWalker_edge_begins_loop(walker, e))
+ if (!bmw_FaceLoopWalker_edge_begins_loop(walker, e)) {
return;
+ }
lwalk = BMW_state_add(walker);
lwalk->l = e->l;
@@ -1334,8 +1335,9 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker)
lwalk = &owalk;
l = lwalk->l;
- if (!l)
+ if (!l) {
return lwalk->wireedge;
+ }
e = l->e;
if (!EDGE_CHECK(e)) {
@@ -1368,7 +1370,6 @@ static void *bmw_EdgeringWalker_step(BMWalker *walker)
/* only walk to manifold edge */
if ((l->f->len % 2 == 0) && EDGE_CHECK(l->e) &&
!BLI_gset_haskey(walker->visit_set, l->e))
-
#else
l = l->radial_next;
@@ -1407,8 +1408,9 @@ static void bmw_EdgeboundaryWalker_begin(BMWalker *walker, void *data)
BLI_assert(BM_edge_is_boundary(e));
- if (BLI_gset_haskey(walker->visit_set, e))
+ if (BLI_gset_haskey(walker->visit_set, e)) {
return;
+ }
lwalk = BMW_state_add(walker);
lwalk->e = e;
@@ -1483,8 +1485,9 @@ static void bmw_UVEdgeWalker_begin(BMWalker *walker, void *data)
BMwUVEdgeWalker *lwalk;
BMLoop *l = data;
- if (BLI_gset_haskey(walker->visit_set, l))
+ if (BLI_gset_haskey(walker->visit_set, l)) {
return;
+ }
lwalk = BMW_state_add(walker);
lwalk->l = l;
@@ -1548,8 +1551,9 @@ static void *bmw_UVEdgeWalker_step(BMWalker *walker)
l_other = (l_radial->v != l_pivot->v) ? l_radial->next : l_radial;
data_other = BM_ELEM_CD_GET_VOID_P(l_other, offset);
- if (!CustomData_data_equals(type, data_pivot, data_other))
+ if (!CustomData_data_equals(type, data_pivot, data_other)) {
continue;
+ }
lwalk = BMW_state_add(walker);
BLI_gset_insert(walker->visit_set, l_radial);