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 <campbell@blender.org>2022-03-09 01:35:37 +0300
committerCampbell Barton <campbell@blender.org>2022-03-09 02:13:43 +0300
commit21462565632b876ac4eadf2bd30573f2fda70c76 (patch)
tree483da4fc20c4c8cc7198abd6edd5f3a53aa90b91 /source/blender/blenkernel
parent626c844105afc3b2455f5a1b87ac8a7839a7e0bf (diff)
Cleanup: use ELEM macro
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r--source/blender/blenkernel/intern/fluid.c11
-rw-r--r--source/blender/blenkernel/intern/gpencil_modifier.c8
-rw-r--r--source/blender/blenkernel/intern/idprop.c3
-rw-r--r--source/blender/blenkernel/intern/image_gpu.cc2
-rw-r--r--source/blender/blenkernel/intern/mask.c2
-rw-r--r--source/blender/blenkernel/intern/node.cc4
-rw-r--r--source/blender/blenkernel/intern/pointcache.c3
-rw-r--r--source/blender/blenkernel/intern/spline_bezier.cc2
-rw-r--r--source/blender/blenkernel/intern/tracking.c2
-rw-r--r--source/blender/blenkernel/intern/writeffmpeg.c3
10 files changed, 19 insertions, 21 deletions
diff --git a/source/blender/blenkernel/intern/fluid.c b/source/blender/blenkernel/intern/fluid.c
index 6f2760e91a6..f85361e94ff 100644
--- a/source/blender/blenkernel/intern/fluid.c
+++ b/source/blender/blenkernel/intern/fluid.c
@@ -1845,8 +1845,8 @@ static void sample_mesh(FluidFlowSettings *ffs,
const float surface_distance = 1.732;
nearest.dist_sq = surface_distance * surface_distance; /* find_nearest uses squared distance. */
- bool is_gas_flow = (ffs->type == FLUID_FLOW_TYPE_SMOKE || ffs->type == FLUID_FLOW_TYPE_FIRE ||
- ffs->type == FLUID_FLOW_TYPE_SMOKEFIRE);
+ bool is_gas_flow = ELEM(
+ ffs->type, FLUID_FLOW_TYPE_SMOKE, FLUID_FLOW_TYPE_FIRE, FLUID_FLOW_TYPE_SMOKEFIRE);
/* Emission strength for gases will be computed below.
* For liquids it's not needed. Just set to non zero value
@@ -2035,8 +2035,7 @@ static void emit_from_mesh_task_cb(void *__restrict userdata,
/* Compute emission only for flow objects that produce fluid (i.e. skip outflow objects).
* Result in bb->influence. Also computes initial velocities. Result in bb->velocity. */
- if ((data->ffs->behavior == FLUID_FLOW_BEHAVIOR_GEOMETRY) ||
- (data->ffs->behavior == FLUID_FLOW_BEHAVIOR_INFLOW)) {
+ if (ELEM(data->ffs->behavior, FLUID_FLOW_BEHAVIOR_GEOMETRY, FLUID_FLOW_BEHAVIOR_INFLOW)) {
sample_mesh(data->ffs,
data->mvert,
data->vert_normals,
@@ -2697,8 +2696,8 @@ static bool escape_flowsobject(Object *flowobj,
bool is_static = is_static_object(flowobj);
bool liquid_flow = ffs->type == FLUID_FLOW_TYPE_LIQUID;
- bool gas_flow = (ffs->type == FLUID_FLOW_TYPE_SMOKE || ffs->type == FLUID_FLOW_TYPE_FIRE ||
- ffs->type == FLUID_FLOW_TYPE_SMOKEFIRE);
+ bool gas_flow = ELEM(
+ ffs->type, FLUID_FLOW_TYPE_SMOKE, FLUID_FLOW_TYPE_FIRE, FLUID_FLOW_TYPE_SMOKEFIRE);
bool is_geometry = (ffs->behavior == FLUID_FLOW_BEHAVIOR_GEOMETRY);
bool liquid_domain = fds->type == FLUID_DOMAIN_TYPE_LIQUID;
diff --git a/source/blender/blenkernel/intern/gpencil_modifier.c b/source/blender/blenkernel/intern/gpencil_modifier.c
index ffc1f2d8774..9c546cc118a 100644
--- a/source/blender/blenkernel/intern/gpencil_modifier.c
+++ b/source/blender/blenkernel/intern/gpencil_modifier.c
@@ -196,9 +196,11 @@ bool BKE_gpencil_has_transform_modifiers(Object *ob)
LISTBASE_FOREACH (GpencilModifierData *, md, &ob->greasepencil_modifiers) {
/* Only if enabled in edit mode. */
if (!GPENCIL_MODIFIER_EDIT(md, true) && GPENCIL_MODIFIER_ACTIVE(md, false)) {
- if ((md->type == eGpencilModifierType_Armature) || (md->type == eGpencilModifierType_Hook) ||
- (md->type == eGpencilModifierType_Lattice) ||
- (md->type == eGpencilModifierType_Offset)) {
+ if (ELEM(md->type,
+ eGpencilModifierType_Armature,
+ eGpencilModifierType_Hook,
+ eGpencilModifierType_Lattice,
+ eGpencilModifierType_Offset)) {
return true;
}
}
diff --git a/source/blender/blenkernel/intern/idprop.c b/source/blender/blenkernel/intern/idprop.c
index d00fc8814e0..7b8dfdc690c 100644
--- a/source/blender/blenkernel/intern/idprop.c
+++ b/source/blender/blenkernel/intern/idprop.c
@@ -903,8 +903,7 @@ IDProperty *IDP_New(const char type, const IDPropertyTemplate *val, const char *
break;
case IDP_ARRAY: {
/* for now, we only support float and int and double arrays */
- if ((val->array.type == IDP_FLOAT) || (val->array.type == IDP_INT) ||
- (val->array.type == IDP_DOUBLE) || (val->array.type == IDP_GROUP)) {
+ if (ELEM(val->array.type, IDP_FLOAT, IDP_INT, IDP_DOUBLE, IDP_GROUP)) {
prop = MEM_callocN(sizeof(IDProperty), "IDProperty array");
prop->subtype = val->array.type;
if (val->array.len) {
diff --git a/source/blender/blenkernel/intern/image_gpu.cc b/source/blender/blenkernel/intern/image_gpu.cc
index c4a43d8b023..0d470c5b663 100644
--- a/source/blender/blenkernel/intern/image_gpu.cc
+++ b/source/blender/blenkernel/intern/image_gpu.cc
@@ -280,7 +280,7 @@ static GPUTexture **get_image_gpu_texture_ptr(Image *ima,
{
const bool in_range = (textarget >= 0) && (textarget < TEXTARGET_COUNT);
BLI_assert(in_range);
- BLI_assert(multiview_eye == 0 || multiview_eye == 1);
+ BLI_assert(ELEM(multiview_eye, 0, 1));
const int resolution = (texture_resolution == IMA_TEXTURE_RESOLUTION_LIMITED) ? 1 : 0;
if (in_range) {
diff --git a/source/blender/blenkernel/intern/mask.c b/source/blender/blenkernel/intern/mask.c
index fca7c10ca77..da0f899001c 100644
--- a/source/blender/blenkernel/intern/mask.c
+++ b/source/blender/blenkernel/intern/mask.c
@@ -1374,7 +1374,7 @@ static void mask_calc_point_handle(MaskSplinePoint *point,
else if (handle_type == HD_AUTO) {
BKE_nurb_handle_calc(bezt, bezt_prev, bezt_next, 0, 0);
}
- else if (handle_type == HD_ALIGN || handle_type == HD_ALIGN_DOUBLESIDE) {
+ else if (ELEM(handle_type, HD_ALIGN, HD_ALIGN_DOUBLESIDE)) {
float v1[3], v2[3];
float vec[3], h[3];
diff --git a/source/blender/blenkernel/intern/node.cc b/source/blender/blenkernel/intern/node.cc
index 1c0eb0ecd44..29770ea5475 100644
--- a/source/blender/blenkernel/intern/node.cc
+++ b/source/blender/blenkernel/intern/node.cc
@@ -553,7 +553,7 @@ void ntreeBlendWrite(BlendWriter *writer, bNodeTree *ntree)
BKE_curvemapping_blend_write(writer, (const CurveMapping *)node->storage);
}
else if ((ntree->type == NTREE_TEXTURE) &&
- (node->type == TEX_NODE_CURVE_RGB || node->type == TEX_NODE_CURVE_TIME)) {
+ ELEM(node->type, TEX_NODE_CURVE_RGB, TEX_NODE_CURVE_TIME)) {
BKE_curvemapping_blend_write(writer, (const CurveMapping *)node->storage);
}
else if ((ntree->type == NTREE_COMPOSIT) && (node->type == CMP_NODE_MOVIEDISTORTION)) {
@@ -579,7 +579,7 @@ void ntreeBlendWrite(BlendWriter *writer, bNodeTree *ntree)
BLO_write_struct_by_name(writer, node->typeinfo->storagename, node->storage);
}
else if ((ntree->type == NTREE_COMPOSIT) &&
- (ELEM(node->type, CMP_NODE_CRYPTOMATTE, CMP_NODE_CRYPTOMATTE_LEGACY))) {
+ ELEM(node->type, CMP_NODE_CRYPTOMATTE, CMP_NODE_CRYPTOMATTE_LEGACY)) {
NodeCryptomatte *nc = (NodeCryptomatte *)node->storage;
BLO_write_string(writer, nc->matte_id);
LISTBASE_FOREACH (CryptomatteEntry *, entry, &nc->entries) {
diff --git a/source/blender/blenkernel/intern/pointcache.c b/source/blender/blenkernel/intern/pointcache.c
index 859e3499cc4..19abff19b77 100644
--- a/source/blender/blenkernel/intern/pointcache.c
+++ b/source/blender/blenkernel/intern/pointcache.c
@@ -683,8 +683,7 @@ static int ptcache_dynamicpaint_write(PTCacheFile *pf, void *dp_v)
if (surface->type == MOD_DPAINT_SURFACE_T_PAINT) {
in_len = sizeof(PaintPoint) * total_points;
}
- else if (surface->type == MOD_DPAINT_SURFACE_T_DISPLACE ||
- surface->type == MOD_DPAINT_SURFACE_T_WEIGHT) {
+ else if (ELEM(surface->type, MOD_DPAINT_SURFACE_T_DISPLACE, MOD_DPAINT_SURFACE_T_WEIGHT)) {
in_len = sizeof(float) * total_points;
}
else if (surface->type == MOD_DPAINT_SURFACE_T_WAVE) {
diff --git a/source/blender/blenkernel/intern/spline_bezier.cc b/source/blender/blenkernel/intern/spline_bezier.cc
index 3c2ac1dae9c..e9ae51b16f8 100644
--- a/source/blender/blenkernel/intern/spline_bezier.cc
+++ b/source/blender/blenkernel/intern/spline_bezier.cc
@@ -365,7 +365,7 @@ BezierSpline::InsertResult BezierSpline::calculate_segment_insertion(const int i
using namespace blender::math;
BLI_assert(parameter <= 1.0f && parameter >= 0.0f);
- BLI_assert(next_index == 0 || next_index == index + 1);
+ BLI_assert(ELEM(next_index, 0, index + 1));
const float3 &point_prev = positions_[index];
const float3 &handle_prev = handle_positions_right_[index];
const float3 &handle_next = handle_positions_left_[next_index];
diff --git a/source/blender/blenkernel/intern/tracking.c b/source/blender/blenkernel/intern/tracking.c
index 5708d3eeaec..2a415b8f6fb 100644
--- a/source/blender/blenkernel/intern/tracking.c
+++ b/source/blender/blenkernel/intern/tracking.c
@@ -1473,7 +1473,7 @@ static const MovieTrackingMarker *get_usable_marker_for_interpolation(
const MovieTrackingMarker *anchor_marker,
const int direction)
{
- BLI_assert(direction == -1 || direction == 1);
+ BLI_assert(ELEM(direction, -1, 1));
const MovieTrackingMarker *last_marker = track->markers + track->markersnr - 1;
const MovieTrackingMarker *current_marker = anchor_marker;
diff --git a/source/blender/blenkernel/intern/writeffmpeg.c b/source/blender/blenkernel/intern/writeffmpeg.c
index b9d013d4756..5e11cd0703a 100644
--- a/source/blender/blenkernel/intern/writeffmpeg.c
+++ b/source/blender/blenkernel/intern/writeffmpeg.c
@@ -622,8 +622,7 @@ static AVStream *alloc_video_stream(FFMpegContext *context,
if (codec_id == AV_CODEC_ID_VP9 && rd->im_format.planes == R_IMF_PLANES_RGBA) {
c->pix_fmt = AV_PIX_FMT_YUVA420P;
}
- else if ((codec_id == AV_CODEC_ID_H264 || codec_id == AV_CODEC_ID_VP9) &&
- context->ffmpeg_crf == 0) {
+ else if (ELEM(codec_id, AV_CODEC_ID_H264, AV_CODEC_ID_VP9) && (context->ffmpeg_crf == 0)) {
/* Use 4:4:4 instead of 4:2:0 pixel format for lossless rendering. */
c->pix_fmt = AV_PIX_FMT_YUV444P;
}