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:
authorCampbell Barton <ideasman42@gmail.com>2020-11-06 04:30:59 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-11-06 04:32:54 +0300
commitaa3a4973a30ff668a62447e18ac41f6c916b4a8b (patch)
tree1b24cc55995ba8b3d72aaabd9400a3e1e030d540 /source/blender/bmesh
parent7cb20d841da16d0bffb63154403267500e9941f5 (diff)
Cleanup: use ELEM macro
Diffstat (limited to 'source/blender/bmesh')
-rw-r--r--source/blender/bmesh/intern/bmesh_construct.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_operators.c6
-rw-r--r--source/blender/bmesh/intern/bmesh_structure.c2
-rw-r--r--source/blender/bmesh/intern/bmesh_walkers_impl.c2
-rw-r--r--source/blender/bmesh/tools/bmesh_bevel.c16
-rw-r--r--source/blender/bmesh/tools/bmesh_edgenet.c2
6 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/bmesh/intern/bmesh_construct.c b/source/blender/bmesh/intern/bmesh_construct.c
index ca5693aa5ba..8631c224ce0 100644
--- a/source/blender/bmesh/intern/bmesh_construct.c
+++ b/source/blender/bmesh/intern/bmesh_construct.c
@@ -335,7 +335,7 @@ BMFace *BM_face_create_ngon_verts(BMesh *bm,
/* we want to use the reverse winding to the existing order */
BM_edge_ordered_verts(edge_arr[i], &test_v2, &test_v1);
winding[(vert_arr[i_prev] == test_v2)]++;
- BLI_assert(vert_arr[i_prev] == test_v2 || vert_arr[i_prev] == test_v1);
+ BLI_assert(ELEM(vert_arr[i_prev], test_v2, test_v1));
}
}
diff --git a/source/blender/bmesh/intern/bmesh_operators.c b/source/blender/bmesh/intern/bmesh_operators.c
index c5e030c436a..c2421939aa8 100644
--- a/source/blender/bmesh/intern/bmesh_operators.c
+++ b/source/blender/bmesh/intern/bmesh_operators.c
@@ -963,7 +963,7 @@ void BMO_slot_buffer_from_single(BMOperator *op, BMOpSlot *slot, BMHeader *ele)
BMO_ASSERT_SLOT_IN_OP(slot, op);
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
BLI_assert(slot->slot_subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE);
- BLI_assert(slot->len == 0 || slot->len == 1);
+ BLI_assert(ELEM(slot->len, 0, 1));
BLI_assert(slot->slot_subtype.elem & ele->htype);
@@ -979,7 +979,7 @@ void BMO_slot_buffer_from_array(BMOperator *op,
{
BMO_ASSERT_SLOT_IN_OP(slot, op);
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
- BLI_assert(slot->len == 0 || slot->len == ele_buffer_len);
+ BLI_assert(ELEM(slot->len, 0, ele_buffer_len));
if (slot->data.buf == NULL) {
slot->data.buf = BLI_memarena_alloc(op->arena, sizeof(*slot->data.buf) * ele_buffer_len);
@@ -993,7 +993,7 @@ void *BMO_slot_buffer_get_single(BMOpSlot *slot)
{
BLI_assert(slot->slot_type == BMO_OP_SLOT_ELEMENT_BUF);
BLI_assert(slot->slot_subtype.elem & BMO_OP_SLOT_SUBTYPE_ELEM_IS_SINGLE);
- BLI_assert(slot->len == 0 || slot->len == 1);
+ BLI_assert(ELEM(slot->len, 0, 1));
return slot->len ? (BMHeader *)slot->data.buf[0] : NULL;
}
diff --git a/source/blender/bmesh/intern/bmesh_structure.c b/source/blender/bmesh/intern/bmesh_structure.c
index d9f68f8aa62..ef4a9c9de1c 100644
--- a/source/blender/bmesh/intern/bmesh_structure.c
+++ b/source/blender/bmesh/intern/bmesh_structure.c
@@ -402,7 +402,7 @@ bool bmesh_radial_validate(int radlen, BMLoop *l)
if (l_iter->e != l->e) {
return false;
}
- if (l_iter->v != l->e->v1 && l_iter->v != l->e->v2) {
+ if (!ELEM(l_iter->v, l->e->v1, l->e->v2)) {
return false;
}
diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c
index 8132230334b..7d56e560275 100644
--- a/source/blender/bmesh/intern/bmesh_walkers_impl.c
+++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c
@@ -983,7 +983,7 @@ static void *bmw_EdgeLoopWalker_step(BMWalker *walker)
/* Typical loopiong over edges in the middle of a mesh */
/* However, why use 2 here at all?
* I guess for internal ngon loops it can be useful. Antony R. */
- if (vert_edge_tot == 4 || vert_edge_tot == 2) {
+ if (ELEM(vert_edge_tot, 4, 2)) {
int i_opposite = vert_edge_tot / 2;
int i = 0;
do {
diff --git a/source/blender/bmesh/tools/bmesh_bevel.c b/source/blender/bmesh/tools/bmesh_bevel.c
index 4a4a87be6e0..915ddc8dcad 100644
--- a/source/blender/bmesh/tools/bmesh_bevel.c
+++ b/source/blender/bmesh/tools/bmesh_bevel.c
@@ -1399,7 +1399,7 @@ static void offset_meet(BevelParams *bp,
normalize_v3(norm_perp2);
float off1a[3], off1b[3], off2a[3], off2b[3];
- if (bp->offset_type == BEVEL_AMT_PERCENT || bp->offset_type == BEVEL_AMT_ABSOLUTE) {
+ if (ELEM(bp->offset_type, BEVEL_AMT_PERCENT, BEVEL_AMT_ABSOLUTE)) {
offset_meet_lines_percent_or_absolute(bp, e1, e2, v, off1a, off1b, off2a, off2b);
}
else {
@@ -1556,7 +1556,7 @@ static bool offset_on_edge_between(BevelParams *bp,
float meet1[3], meet2[3];
bool ok1 = offset_meet_edge(e1, emid, v, meet1, &ang1);
bool ok2 = offset_meet_edge(emid, e2, v, meet2, &ang2);
- if (bp->offset_type == BEVEL_AMT_PERCENT || bp->offset_type == BEVEL_AMT_ABSOLUTE) {
+ if (ELEM(bp->offset_type, BEVEL_AMT_PERCENT, BEVEL_AMT_ABSOLUTE)) {
BMVert *v2 = BM_edge_other_vert(emid->e, v);
if (bp->offset_type == BEVEL_AMT_PERCENT) {
interp_v3_v3v3(meetco, v->co, v2->co, bp->offset / 100.0f);
@@ -2158,7 +2158,7 @@ static void snap_to_superellipsoid(float co[3], const float super_r, bool midlin
float x = a;
float y = b;
float z = c;
- if (r == PRO_SQUARE_R || r == PRO_SQUARE_IN_R) {
+ if (ELEM(r, PRO_SQUARE_R, PRO_SQUARE_IN_R)) {
/* Will only be called for 2d profile. */
BLI_assert(fabsf(z) < BEVEL_EPSILON);
z = 0.0f;
@@ -2441,7 +2441,7 @@ static void bevel_harden_normals(BevelParams *bp, BMesh *bm)
BMFace *f;
BM_ITER_MESH (f, &fiter, bm, BM_FACES_OF_MESH) {
FKind fkind = get_face_kind(bp, f);
- if (fkind == F_ORIG || fkind == F_RECON) {
+ if (ELEM(fkind, F_ORIG, F_RECON)) {
continue;
}
BMIter liter;
@@ -4619,7 +4619,7 @@ static VMesh *pipe_adj_vmesh(BevelParams *bp, BevVert *bv, BoundVert *vpipe)
if (bp->profile_type == BEVEL_PROFILE_CUSTOM) {
/* Find both profile vertices that correspond to this point. */
float *profile_point_pipe1, *profile_point_pipe2, f;
- if (i == ipipe1 || i == ipipe2) {
+ if (ELEM(i, ipipe1, ipipe2)) {
if (n_bndv == 3 && i == ipipe1) {
/* This part of the vmesh is the triangular corner between the two pipe profiles. */
int ring = max_ii(j, k);
@@ -6229,7 +6229,7 @@ static BevVert *bevel_vert_construct(BMesh *bm, BevelParams *bp, BMVert *v)
break;
}
}
- if (bp->offset_type != BEVEL_AMT_PERCENT && bp->offset_type != BEVEL_AMT_ABSOLUTE) {
+ if (!ELEM(bp->offset_type, BEVEL_AMT_PERCENT, BEVEL_AMT_ABSOLUTE)) {
e->offset_r_spec = e->offset_l_spec;
}
if (bp->use_weights) {
@@ -6771,7 +6771,7 @@ static void bevel_build_edge_polygons(BMesh *bm, BevelParams *bp, BMEdge *bme)
BMIter iter;
BMLoop *l;
BM_ITER_ELEM (l, &iter, r_f, BM_LOOPS_OF_FACE) {
- if (l->v == verts[0] || l->v == verts[2]) {
+ if (ELEM(l->v, verts[0], verts[2])) {
BM_elem_flag_enable(l, BM_ELEM_LONG_TAG);
}
}
@@ -7232,7 +7232,7 @@ static float geometry_collide_offset(BevelParams *bp, EdgeHalf *eb)
EdgeHalf *ec;
BMVert *vd;
float kc;
- if (bp->offset_type == BEVEL_AMT_PERCENT || bp->offset_type == BEVEL_AMT_ABSOLUTE) {
+ if (ELEM(bp->offset_type, BEVEL_AMT_PERCENT, BEVEL_AMT_ABSOLUTE)) {
if (ea->is_bev && ebother != NULL && ebother->prev->is_bev) {
if (bp->offset_type == BEVEL_AMT_PERCENT) {
return 50.0f;
diff --git a/source/blender/bmesh/tools/bmesh_edgenet.c b/source/blender/bmesh/tools/bmesh_edgenet.c
index 9f4327fd1e3..c332d88e83b 100644
--- a/source/blender/bmesh/tools/bmesh_edgenet.c
+++ b/source/blender/bmesh/tools/bmesh_edgenet.c
@@ -51,7 +51,7 @@ enum {
*/
static bool bm_edge_step_ok(BMEdge *e)
{
- return BM_elem_flag_test(e, BM_ELEM_TAG) && ((e->l == NULL) || (e->l->radial_next == e->l));
+ return BM_elem_flag_test(e, BM_ELEM_TAG) && (ELEM(e->l, NULL, e->l->radial_next));
}
static int bm_edge_face(BMEdge *e)