Cleanup: use ELEM macro (>2 args)
This commit is contained in:
parent
d89fedf266
commit
f11f7ce08e
|
@ -4697,9 +4697,11 @@ void BKE_fluid_fields_sanitize(FluidDomainSettings *settings)
|
|||
const char data_depth = settings->openvdb_data_depth;
|
||||
|
||||
if (settings->type == FLUID_DOMAIN_TYPE_GAS) {
|
||||
if (coba_field == FLUID_DOMAIN_FIELD_PHI || coba_field == FLUID_DOMAIN_FIELD_PHI_IN ||
|
||||
coba_field == FLUID_DOMAIN_FIELD_PHI_OUT ||
|
||||
coba_field == FLUID_DOMAIN_FIELD_PHI_OBSTACLE) {
|
||||
if (ELEM(coba_field,
|
||||
FLUID_DOMAIN_FIELD_PHI,
|
||||
FLUID_DOMAIN_FIELD_PHI_IN,
|
||||
FLUID_DOMAIN_FIELD_PHI_OUT,
|
||||
FLUID_DOMAIN_FIELD_PHI_OBSTACLE)) {
|
||||
/* Defaulted to density for gas domain. */
|
||||
settings->coba_field = FLUID_DOMAIN_FIELD_DENSITY;
|
||||
}
|
||||
|
@ -4710,10 +4712,14 @@ void BKE_fluid_fields_sanitize(FluidDomainSettings *settings)
|
|||
}
|
||||
}
|
||||
else if (settings->type == FLUID_DOMAIN_TYPE_LIQUID) {
|
||||
if (coba_field == FLUID_DOMAIN_FIELD_COLOR_R || coba_field == FLUID_DOMAIN_FIELD_COLOR_G ||
|
||||
coba_field == FLUID_DOMAIN_FIELD_COLOR_B || coba_field == FLUID_DOMAIN_FIELD_DENSITY ||
|
||||
coba_field == FLUID_DOMAIN_FIELD_FLAME || coba_field == FLUID_DOMAIN_FIELD_FUEL ||
|
||||
coba_field == FLUID_DOMAIN_FIELD_HEAT) {
|
||||
if (ELEM(coba_field,
|
||||
FLUID_DOMAIN_FIELD_COLOR_R,
|
||||
FLUID_DOMAIN_FIELD_COLOR_G,
|
||||
FLUID_DOMAIN_FIELD_COLOR_B,
|
||||
FLUID_DOMAIN_FIELD_DENSITY,
|
||||
FLUID_DOMAIN_FIELD_FLAME,
|
||||
FLUID_DOMAIN_FIELD_FUEL,
|
||||
FLUID_DOMAIN_FIELD_HEAT)) {
|
||||
/* Defaulted to phi for liquid domain. */
|
||||
settings->coba_field = FLUID_DOMAIN_FIELD_PHI;
|
||||
}
|
||||
|
|
|
@ -807,22 +807,22 @@ static void makecubetable(void)
|
|||
INTLIST *edges;
|
||||
|
||||
for (edges = polys->list; edges; edges = edges->next) {
|
||||
if (edges->i == LB || edges->i == LT || edges->i == LN || edges->i == LF) {
|
||||
if (ELEM(edges->i, LB, LT, LN, LF)) {
|
||||
faces[i] |= 1 << L;
|
||||
}
|
||||
if (edges->i == RB || edges->i == RT || edges->i == RN || edges->i == RF) {
|
||||
if (ELEM(edges->i, RB, RT, RN, RF)) {
|
||||
faces[i] |= 1 << R;
|
||||
}
|
||||
if (edges->i == LB || edges->i == RB || edges->i == BN || edges->i == BF) {
|
||||
if (ELEM(edges->i, LB, RB, BN, BF)) {
|
||||
faces[i] |= 1 << B;
|
||||
}
|
||||
if (edges->i == LT || edges->i == RT || edges->i == TN || edges->i == TF) {
|
||||
if (ELEM(edges->i, LT, RT, TN, TF)) {
|
||||
faces[i] |= 1 << T;
|
||||
}
|
||||
if (edges->i == LN || edges->i == RN || edges->i == BN || edges->i == TN) {
|
||||
if (ELEM(edges->i, LN, RN, BN, TN)) {
|
||||
faces[i] |= 1 << N;
|
||||
}
|
||||
if (edges->i == LF || edges->i == RF || edges->i == BF || edges->i == TF) {
|
||||
if (ELEM(edges->i, LF, RF, BF, TF)) {
|
||||
faces[i] |= 1 << F;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3997,19 +3997,25 @@ void object_remove_particle_system(Main *bmain, Scene *UNUSED(scene), Object *ob
|
|||
if (psys->part->type == PART_FLUID_FLIP) {
|
||||
fmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_FLIP;
|
||||
}
|
||||
if (psys->part->type == PART_FLUID_SPRAY || psys->part->type == PART_FLUID_SPRAYFOAM ||
|
||||
psys->part->type == PART_FLUID_SPRAYBUBBLE ||
|
||||
psys->part->type == PART_FLUID_SPRAYFOAMBUBBLE) {
|
||||
if (ELEM(psys->part->type,
|
||||
PART_FLUID_SPRAY,
|
||||
PART_FLUID_SPRAYFOAM,
|
||||
PART_FLUID_SPRAYBUBBLE,
|
||||
PART_FLUID_SPRAYFOAMBUBBLE)) {
|
||||
fmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_SPRAY;
|
||||
}
|
||||
if (psys->part->type == PART_FLUID_FOAM || psys->part->type == PART_FLUID_SPRAYFOAM ||
|
||||
psys->part->type == PART_FLUID_FOAMBUBBLE ||
|
||||
psys->part->type == PART_FLUID_SPRAYFOAMBUBBLE) {
|
||||
if (ELEM(psys->part->type,
|
||||
PART_FLUID_FOAM,
|
||||
PART_FLUID_SPRAYFOAM,
|
||||
PART_FLUID_FOAMBUBBLE,
|
||||
PART_FLUID_SPRAYFOAMBUBBLE)) {
|
||||
fmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_FOAM;
|
||||
}
|
||||
if (psys->part->type == PART_FLUID_BUBBLE || psys->part->type == PART_FLUID_FOAMBUBBLE ||
|
||||
psys->part->type == PART_FLUID_SPRAYBUBBLE ||
|
||||
psys->part->type == PART_FLUID_SPRAYFOAMBUBBLE) {
|
||||
if (ELEM(psys->part->type,
|
||||
PART_FLUID_BUBBLE,
|
||||
PART_FLUID_FOAMBUBBLE,
|
||||
PART_FLUID_SPRAYBUBBLE,
|
||||
PART_FLUID_SPRAYFOAMBUBBLE)) {
|
||||
fmd->domain->particle_type &= ~FLUID_DOMAIN_PARTICLE_BUBBLE;
|
||||
}
|
||||
if (psys->part->type == PART_FLUID_TRACER) {
|
||||
|
@ -4017,9 +4023,11 @@ void object_remove_particle_system(Main *bmain, Scene *UNUSED(scene), Object *ob
|
|||
}
|
||||
|
||||
/* Disable combined export if combined particle system was deleted. */
|
||||
if (psys->part->type == PART_FLUID_SPRAYFOAM || psys->part->type == PART_FLUID_SPRAYBUBBLE ||
|
||||
psys->part->type == PART_FLUID_FOAMBUBBLE ||
|
||||
psys->part->type == PART_FLUID_SPRAYFOAMBUBBLE) {
|
||||
if (ELEM(psys->part->type,
|
||||
PART_FLUID_SPRAYFOAM,
|
||||
PART_FLUID_SPRAYBUBBLE,
|
||||
PART_FLUID_FOAMBUBBLE,
|
||||
PART_FLUID_SPRAYFOAMBUBBLE)) {
|
||||
fmd->domain->sndparticle_combined_export = SNDPARTICLE_COMBINED_EXPORT_OFF;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4151,20 +4151,17 @@ static bool particles_has_tracer(short parttype)
|
|||
|
||||
static bool particles_has_spray(short parttype)
|
||||
{
|
||||
return ((parttype == PART_FLUID_SPRAY) || (parttype == PART_FLUID_SPRAYFOAM) ||
|
||||
(parttype == PART_FLUID_SPRAYFOAMBUBBLE));
|
||||
return (ELEM(parttype, PART_FLUID_SPRAY, PART_FLUID_SPRAYFOAM, PART_FLUID_SPRAYFOAMBUBBLE));
|
||||
}
|
||||
|
||||
static bool particles_has_bubble(short parttype)
|
||||
{
|
||||
return ((parttype == PART_FLUID_BUBBLE) || (parttype == PART_FLUID_FOAMBUBBLE) ||
|
||||
(parttype == PART_FLUID_SPRAYFOAMBUBBLE));
|
||||
return (ELEM(parttype, PART_FLUID_BUBBLE, PART_FLUID_FOAMBUBBLE, PART_FLUID_SPRAYFOAMBUBBLE));
|
||||
}
|
||||
|
||||
static bool particles_has_foam(short parttype)
|
||||
{
|
||||
return ((parttype == PART_FLUID_FOAM) || (parttype == PART_FLUID_SPRAYFOAM) ||
|
||||
(parttype == PART_FLUID_SPRAYFOAMBUBBLE));
|
||||
return (ELEM(parttype, PART_FLUID_FOAM, PART_FLUID_SPRAYFOAM, PART_FLUID_SPRAYFOAMBUBBLE));
|
||||
}
|
||||
|
||||
static void particles_fluid_step(ParticleSimulationData *sim,
|
||||
|
|
|
@ -2461,7 +2461,7 @@ int text_check_identifier_nodigit_unicode(const unsigned int ch)
|
|||
|
||||
bool text_check_whitespace(const char ch)
|
||||
{
|
||||
if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n') {
|
||||
if (ELEM(ch, ' ', '\t', '\r', '\n')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -667,7 +667,7 @@ template<typename T> void crosssegs_test()
|
|||
if (out.vert.size() == 5) {
|
||||
int v_intersect = -1;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (i != v0_out && i != v1_out && i != v2_out && i != v3_out) {
|
||||
if (!ELEM(i, v0_out, v1_out, v2_out, v3_out)) {
|
||||
EXPECT_EQ(v_intersect, -1);
|
||||
v_intersect = i;
|
||||
}
|
||||
|
|
|
@ -116,12 +116,19 @@
|
|||
|
||||
bool Converter::is_fast_node(bNode *b_node)
|
||||
{
|
||||
return !(b_node->type == CMP_NODE_BLUR || b_node->type == CMP_NODE_VECBLUR ||
|
||||
b_node->type == CMP_NODE_BILATERALBLUR || b_node->type == CMP_NODE_DEFOCUS ||
|
||||
b_node->type == CMP_NODE_BOKEHBLUR || b_node->type == CMP_NODE_GLARE ||
|
||||
b_node->type == CMP_NODE_DBLUR || b_node->type == CMP_NODE_MOVIEDISTORTION ||
|
||||
b_node->type == CMP_NODE_LENSDIST || b_node->type == CMP_NODE_DOUBLEEDGEMASK ||
|
||||
b_node->type == CMP_NODE_DILATEERODE || b_node->type == CMP_NODE_DENOISE);
|
||||
return !ELEM(b_node->type,
|
||||
CMP_NODE_BLUR,
|
||||
CMP_NODE_VECBLUR,
|
||||
CMP_NODE_BILATERALBLUR,
|
||||
CMP_NODE_DEFOCUS,
|
||||
CMP_NODE_BOKEHBLUR,
|
||||
CMP_NODE_GLARE,
|
||||
CMP_NODE_DBLUR,
|
||||
CMP_NODE_MOVIEDISTORTION,
|
||||
CMP_NODE_LENSDIST,
|
||||
CMP_NODE_DOUBLEEDGEMASK,
|
||||
CMP_NODE_DILATEERODE,
|
||||
CMP_NODE_DENOISE);
|
||||
}
|
||||
|
||||
Node *Converter::convert(bNode *b_node)
|
||||
|
|
|
@ -2295,7 +2295,7 @@ void uiItemFullR(uiLayout *layout,
|
|||
ui_item_enum_expand(layout, block, ptr, prop, name, h, icon_only);
|
||||
}
|
||||
/* property with separate label */
|
||||
else if (type == PROP_ENUM || type == PROP_STRING || type == PROP_POINTER) {
|
||||
else if (ELEM(type, PROP_ENUM, PROP_STRING, PROP_POINTER)) {
|
||||
but = ui_item_with_label(layout, block, name, icon, ptr, prop, index, 0, 0, w, h, flag);
|
||||
but = ui_but_add_search(but, ptr, prop, NULL, NULL);
|
||||
|
||||
|
|
|
@ -792,7 +792,7 @@ void UI_butstore_update(uiBlock *block)
|
|||
/* warning, loop-in-loop, in practice we only store <10 buttons at a time,
|
||||
* so this isn't going to be a problem, if that changes old-new mapping can be cached first */
|
||||
LISTBASE_FOREACH (uiButStore *, bs_handle, &block->butstore) {
|
||||
BLI_assert((bs_handle->block == NULL) || (bs_handle->block == block) ||
|
||||
BLI_assert(ELEM(bs_handle->block, NULL, block) ||
|
||||
(block->oldblock && block->oldblock == bs_handle->block));
|
||||
|
||||
if (bs_handle->block == block->oldblock) {
|
||||
|
|
|
@ -3922,7 +3922,7 @@ static void do_elastic_deform_brush_task_cb_ex(void *__restrict userdata,
|
|||
|
||||
if (brush->elastic_deform_type == BRUSH_ELASTIC_DEFORM_TWIST) {
|
||||
int symm = ss->cache->mirror_symmetry_pass;
|
||||
if (symm == 1 || symm == 2 || symm == 4 || symm == 7) {
|
||||
if (ELEM(symm, 1, 2, 4, 7)) {
|
||||
dir = -dir;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1897,7 +1897,7 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *region, const bool sel)
|
|||
end += max;
|
||||
chop = 1;
|
||||
}
|
||||
else if (ch == ' ' || ch == '-' || ch == '\0') {
|
||||
else if (ELEM(ch, ' ', '-', '\0')) {
|
||||
if (j >= oldc) {
|
||||
*charp = BLI_str_utf8_offset_from_column((*linep)->line, start);
|
||||
loop = 0;
|
||||
|
@ -3065,7 +3065,7 @@ static void text_cursor_set_to_pos_wrapped(
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (ch == ' ' || ch == '-' || ch == '\0') {
|
||||
else if (ELEM(ch, ' ', '-', '\0')) {
|
||||
if (found) {
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -76,7 +76,7 @@ static uint16_t vbo_bind(const ShaderInterface *interface,
|
|||
|
||||
enabled_attrib |= (1 << input->location);
|
||||
|
||||
if (a->comp_len == 16 || a->comp_len == 12 || a->comp_len == 8) {
|
||||
if (ELEM(a->comp_len, 16, 12, 8)) {
|
||||
BLI_assert(a->fetch_mode == GPU_FETCH_FLOAT);
|
||||
BLI_assert(a->comp_type == GPU_COMP_F32);
|
||||
for (int i = 0; i < a->comp_len / 4; i++) {
|
||||
|
|
|
@ -277,9 +277,7 @@ LogImageFile *dpxOpen(const unsigned char *byteStuff, int fromMemory, size_t buf
|
|||
}
|
||||
|
||||
dpx->element[i].bitsPerSample = header.imageHeader.element[i].bits_per_sample;
|
||||
if (dpx->element[i].bitsPerSample != 1 && dpx->element[i].bitsPerSample != 8 &&
|
||||
dpx->element[i].bitsPerSample != 10 && dpx->element[i].bitsPerSample != 12 &&
|
||||
dpx->element[i].bitsPerSample != 16) {
|
||||
if (!ELEM(dpx->element[i].bitsPerSample, 1, 8, 10, 12, 16)) {
|
||||
if (verbose) {
|
||||
printf("DPX: Unsupported bitsPerSample for elements %d: %d\n",
|
||||
i,
|
||||
|
|
|
@ -998,7 +998,7 @@ static void add_poly(SkinOutput *so, BMVert *v1, BMVert *v2, BMVert *v3, BMVert
|
|||
BMVert *verts[4] = {v1, v2, v3, v4};
|
||||
BMFace *f;
|
||||
|
||||
BLI_assert(v1 != v2 && v1 != v3 && v1 != v4);
|
||||
BLI_assert(!ELEM(v1, v2, v3, v4));
|
||||
BLI_assert(!ELEM(v2, v3, v4));
|
||||
BLI_assert(v3 != v4);
|
||||
BLI_assert(v1 && v2 && v3);
|
||||
|
@ -1414,7 +1414,7 @@ static void quad_from_tris(BMEdge *e, BMFace *adj[2], BMVert *ndx[4])
|
|||
|
||||
/* Find what the second tri has that the first doesn't */
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (tri[1][i] != tri[0][0] && tri[1][i] != tri[0][1] && tri[1][i] != tri[0][2]) {
|
||||
if (!ELEM(tri[1][i], tri[0][0], tri[0][1], tri[0][2])) {
|
||||
opp = tri[1][i];
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -373,7 +373,7 @@ static PyObject *py_blf_shadow(PyObject *UNUSED(self), PyObject *args)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
if (level != 0 && level != 3 && level != 5) {
|
||||
if (!ELEM(level, 0, 3, 5)) {
|
||||
PyErr_SetString(PyExc_TypeError, "blf.shadow expected arg to be in (0, 3, 5)");
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -514,7 +514,7 @@ static PyObject *C_Matrix_Rotation(PyObject *cls, PyObject *args)
|
|||
|
||||
angle = angle_wrap_rad(angle);
|
||||
|
||||
if (matSize != 2 && matSize != 3 && matSize != 4) {
|
||||
if (!ELEM(matSize, 2, 3, 4)) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"Matrix.Rotation(): "
|
||||
"can only return a 2x2 3x3 or 4x4 matrix");
|
||||
|
@ -653,7 +653,7 @@ static PyObject *C_Matrix_Scale(PyObject *cls, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "fi|O:Matrix.Scale", &factor, &matSize, &vec)) {
|
||||
return NULL;
|
||||
}
|
||||
if (matSize != 2 && matSize != 3 && matSize != 4) {
|
||||
if (!ELEM(matSize, 2, 3, 4)) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"Matrix.Scale(): "
|
||||
"can only return a 2x2 3x3 or 4x4 matrix");
|
||||
|
@ -759,7 +759,7 @@ static PyObject *C_Matrix_OrthoProjection(PyObject *cls, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "Oi:Matrix.OrthoProjection", &axis, &matSize)) {
|
||||
return NULL;
|
||||
}
|
||||
if (matSize != 2 && matSize != 3 && matSize != 4) {
|
||||
if (!ELEM(matSize, 2, 3, 4)) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"Matrix.OrthoProjection(): "
|
||||
"can only return a 2x2 3x3 or 4x4 matrix");
|
||||
|
@ -895,7 +895,7 @@ static PyObject *C_Matrix_Shear(PyObject *cls, PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "siO:Matrix.Shear", &plane, &matSize, &fac)) {
|
||||
return NULL;
|
||||
}
|
||||
if (matSize != 2 && matSize != 3 && matSize != 4) {
|
||||
if (!ELEM(matSize, 2, 3, 4)) {
|
||||
PyErr_SetString(PyExc_ValueError,
|
||||
"Matrix.Shear(): "
|
||||
"can only return a 2x2 3x3 or 4x4 matrix");
|
||||
|
|
Loading…
Reference in New Issue