diff options
Diffstat (limited to 'source/blender')
31 files changed, 78 insertions, 75 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; } diff --git a/source/blender/blenlib/intern/path_util.c b/source/blender/blenlib/intern/path_util.c index a6f09d074e7..f94d49cf1dd 100644 --- a/source/blender/blenlib/intern/path_util.c +++ b/source/blender/blenlib/intern/path_util.c @@ -470,7 +470,7 @@ void BLI_path_rel(char *file, const char *relfile) * can happen with old recent-files.txt files */ BLI_windows_get_default_root_dir(temp); ptemp = &temp[2]; - if (relfile[0] != '\\' && relfile[0] != '/') { + if (!ELEM(relfile[0], '\\', '/')) { ptemp++; } BLI_strncpy(ptemp, relfile, FILE_MAX - 3); diff --git a/source/blender/editors/interface/interface_handlers.c b/source/blender/editors/interface/interface_handlers.c index f5fa710067b..2386b388a41 100644 --- a/source/blender/editors/interface/interface_handlers.c +++ b/source/blender/editors/interface/interface_handlers.c @@ -3930,7 +3930,7 @@ static void ui_do_but_textedit( } #ifdef WITH_INPUT_IME - if (event->type == WM_IME_COMPOSITE_START || event->type == WM_IME_COMPOSITE_EVENT) { + if (ELEM(event->type, WM_IME_COMPOSITE_START, WM_IME_COMPOSITE_EVENT)) { changed = true; if (event->type == WM_IME_COMPOSITE_START && but->selend > but->selsta) { diff --git a/source/blender/editors/space_file/filelist.c b/source/blender/editors/space_file/filelist.c index daa4b53803f..d47e67b9d27 100644 --- a/source/blender/editors/space_file/filelist.c +++ b/source/blender/editors/space_file/filelist.c @@ -3462,8 +3462,7 @@ static void filelist_readjob_main_recursive(Main *bmain, FileList *filelist) // files->entry->nr = totbl + 1; files->entry->poin = id; fake = id->flag & LIB_FAKEUSER; - if (idcode == ID_MA || idcode == ID_TE || idcode == ID_LA || idcode == ID_WO || - idcode == ID_IM) { + if (ELEM(idcode, ID_MA, ID_TE, ID_LA, ID_WO, ID_IM)) { files->typeflag |= FILE_TYPE_IMAGE; } # if 0 diff --git a/source/blender/editors/space_sequencer/sequencer_draw.c b/source/blender/editors/space_sequencer/sequencer_draw.c index 5ac4363e63d..bdad08fe20a 100644 --- a/source/blender/editors/space_sequencer/sequencer_draw.c +++ b/source/blender/editors/space_sequencer/sequencer_draw.c @@ -476,7 +476,7 @@ static void draw_seq_waveform_overlay(View2D *v2d, bool is_line_strip = (value_max - value_min < 0.05f); - if (was_line_strip != -1 && is_line_strip != was_line_strip) { + if (!ELEM(was_line_strip, -1, is_line_strip)) { /* If the previously added strip type isn't the same as the current one, * add transition areas so they transition smoothly between each other. */ if (is_line_strip) { diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 0e29c68cf23..d3fc3e9d352 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -1108,7 +1108,7 @@ static void draw_documentation(const SpaceText *st, ARegion *region) if (*p == '\r' && *(++p) != '\n') { *(--p) = '\n'; /* Fix line endings */ } - if (*p == ' ' || *p == '\t') { + if (ELEM(*p, ' ', '\t')) { br = i; } else if (*p == '\n') { diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c index b8530293d3e..d4b12142162 100644 --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@ -1449,7 +1449,7 @@ static void VertsToTransData(TransInfo *t, td->ext = NULL; td->val = NULL; td->extra = eve; - if (t->mode == TFM_BWEIGHT || t->mode == TFM_VERT_CREASE) { + if (ELEM(t->mode, TFM_BWEIGHT, TFM_VERT_CREASE)) { td->val = bweight; td->ival = *bweight; } diff --git a/source/blender/editors/uvedit/uvedit_parametrizer.c b/source/blender/editors/uvedit/uvedit_parametrizer.c index 53b8a541dba..f19b32e3ad4 100644 --- a/source/blender/editors/uvedit/uvedit_parametrizer.c +++ b/source/blender/editors/uvedit/uvedit_parametrizer.c @@ -2039,7 +2039,7 @@ static float p_collapse_cost(PEdge *edge, PEdge *pair) float *co1 = e->next->vert->co; float *co2 = e->next->next->vert->co; - if ((e->face != oldf1) && (e->face != oldf2)) { + if (!ELEM(e->face, oldf1, oldf2)) { float tetrav2[3], tetrav3[3]; /* tetrahedron volume = (1/3!)*|a.(b x c)| */ diff --git a/source/blender/editors/uvedit/uvedit_select.c b/source/blender/editors/uvedit/uvedit_select.c index 3bba618f682..938b798f4b6 100644 --- a/source/blender/editors/uvedit/uvedit_select.c +++ b/source/blender/editors/uvedit/uvedit_select.c @@ -438,7 +438,7 @@ void uvedit_edge_select_shared_vert(const Scene *scene, const bool do_history, const int cd_loop_uv_offset) { - BLI_assert((sticky_flag == SI_STICKY_LOC) || (sticky_flag == SI_STICKY_VERTEX)); + BLI_assert(ELEM(sticky_flag, SI_STICKY_LOC, SI_STICKY_VERTEX)); /* Set edge flags. Rely on this for face visibility checks */ uvedit_edge_select_set_noflush(scene, l, select, sticky_flag, cd_loop_uv_offset); @@ -647,7 +647,7 @@ void uvedit_uv_select_shared_vert(const Scene *scene, const bool do_history, const int cd_loop_uv_offset) { - BLI_assert((sticky_flag == SI_STICKY_LOC) || (sticky_flag == SI_STICKY_VERTEX)); + BLI_assert(ELEM(sticky_flag, SI_STICKY_LOC, SI_STICKY_VERTEX)); BMEdge *e_first, *e_iter; e_first = e_iter = l->e; @@ -2251,13 +2251,13 @@ static void uv_select_invert(const Scene *scene, BMEditMesh *em) } BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) { luv = BM_ELEM_CD_GET_VOID_P(l, cd_loop_uv_offset); - if ((uv_selectmode == UV_SELECT_EDGE) || (uv_selectmode == UV_SELECT_FACE)) { + if (ELEM(uv_selectmode, UV_SELECT_EDGE, UV_SELECT_FACE)) { /* Use #MLOOPUV_EDGESEL to flag edges that must be selected. */ luv->flag ^= MLOOPUV_EDGESEL; luv->flag &= ~MLOOPUV_VERTSEL; } /* Use #MLOOPUV_VERTSEL to flag verts that must be selected. */ - else if ((uv_selectmode == UV_SELECT_VERTEX) || (uv_selectmode == UV_SELECT_ISLAND)) { + else if (ELEM(uv_selectmode, UV_SELECT_VERTEX, UV_SELECT_ISLAND)) { luv->flag ^= MLOOPUV_VERTSEL; luv->flag &= ~MLOOPUV_EDGESEL; } @@ -2265,10 +2265,10 @@ static void uv_select_invert(const Scene *scene, BMEditMesh *em) } /* Flush based on uv vert/edge flags and current UV select mode */ - if ((uv_selectmode == UV_SELECT_EDGE) || (uv_selectmode == UV_SELECT_FACE)) { + if (ELEM(uv_selectmode, UV_SELECT_EDGE, UV_SELECT_FACE)) { uv_select_flush_from_loop_edge_flag(scene, em); } - else if ((uv_selectmode == UV_SELECT_VERTEX) || (uv_selectmode == UV_SELECT_ISLAND)) { + else if (ELEM(uv_selectmode, UV_SELECT_VERTEX, UV_SELECT_ISLAND)) { uvedit_select_flush(scene, em); } } @@ -3221,7 +3221,7 @@ static void uv_select_flush_from_tag_face(const Scene *scene, Object *obedit, co const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && - ((ts->uv_sticky == SI_STICKY_VERTEX) || (ts->uv_sticky == SI_STICKY_LOC))) { + ELEM(ts->uv_sticky, SI_STICKY_VERTEX, SI_STICKY_LOC)) { struct UvVertMap *vmap; uint efa_index; @@ -3366,7 +3366,7 @@ static void uv_select_flush_from_loop_edge_flag(const Scene *scene, BMEditMesh * const int cd_loop_uv_offset = CustomData_get_offset(&em->bm->ldata, CD_MLOOPUV); if ((ts->uv_flag & UV_SYNC_SELECTION) == 0 && - ((ts->uv_sticky == SI_STICKY_LOC) || (ts->uv_sticky == SI_STICKY_VERTEX))) { + ELEM(ts->uv_sticky, SI_STICKY_LOC, SI_STICKY_VERTEX)) { /* Use the #MLOOPUV_EDGESEL flag to identify which verts must to be selected */ struct UvVertMap *vmap; uint efa_index; diff --git a/source/blender/gpu/intern/gpu_vertex_format.cc b/source/blender/gpu/intern/gpu_vertex_format.cc index eedd660d0a9..a9ac191754b 100644 --- a/source/blender/gpu/intern/gpu_vertex_format.cc +++ b/source/blender/gpu/intern/gpu_vertex_format.cc @@ -133,7 +133,7 @@ uint GPU_vertformat_attr_add(GPUVertFormat *format, case GPU_COMP_I10: /* 10_10_10 format intended for normals (xyz) or colors (rgb) * extra component packed.w can be manually set to { -2, -1, 0, 1 } */ - assert(comp_len == 3 || comp_len == 4); + assert(ELEM(comp_len, 3, 4)); /* Not strictly required, may relax later. */ assert(fetch_mode == GPU_FETCH_INT_TO_FLOAT_UNIT); @@ -143,7 +143,7 @@ uint GPU_vertformat_attr_add(GPUVertFormat *format, /* integer types can be kept as int or converted/normalized to float */ assert(fetch_mode != GPU_FETCH_FLOAT); /* only support float matrices (see Batch_update_program_bindings) */ - assert(comp_len != 8 && comp_len != 12 && comp_len != 16); + assert(!ELEM(comp_len, 8, 12, 16)); } #endif format->name_len++; /* Multi-name support. */ diff --git a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp index 9173b5a9d49..ce5dd4927be 100644 --- a/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp +++ b/source/blender/imbuf/intern/dds/DirectDrawSurface.cpp @@ -34,6 +34,9 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. */ +#include "BLI_utildefines.h" +#undef CLAMP + #include <BlockDXT.h> #include <DirectDrawSurface.h> #include <PixelFormat.h> @@ -596,7 +599,7 @@ void DDSHeader::setDepth(uint d) void DDSHeader::setMipmapCount(uint count) { - if (count == 0 || count == 1) { + if (ELEM(count, 0, 1)) { this->flags &= ~DDSD_MIPMAPCOUNT; this->mipmapcount = 1; @@ -904,11 +907,12 @@ bool DirectDrawSurface::isValid() const bool DirectDrawSurface::isSupported() const { if (header.hasDX10Header()) { - if (header.header10.dxgiFormat == DXGI_FORMAT_BC1_UNORM || - header.header10.dxgiFormat == DXGI_FORMAT_BC2_UNORM || - header.header10.dxgiFormat == DXGI_FORMAT_BC3_UNORM || - header.header10.dxgiFormat == DXGI_FORMAT_BC4_UNORM || - header.header10.dxgiFormat == DXGI_FORMAT_BC5_UNORM) { + if (ELEM(header.header10.dxgiFormat, + DXGI_FORMAT_BC1_UNORM, + DXGI_FORMAT_BC2_UNORM, + DXGI_FORMAT_BC3_UNORM, + DXGI_FORMAT_BC4_UNORM, + DXGI_FORMAT_BC5_UNORM)) { return true; } @@ -916,10 +920,15 @@ bool DirectDrawSurface::isSupported() const } if (header.pf.flags & DDPF_FOURCC) { - if (header.pf.fourcc != FOURCC_DXT1 && header.pf.fourcc != FOURCC_DXT2 && - header.pf.fourcc != FOURCC_DXT3 && header.pf.fourcc != FOURCC_DXT4 && - header.pf.fourcc != FOURCC_DXT5 && header.pf.fourcc != FOURCC_RXGB && - header.pf.fourcc != FOURCC_ATI1 && header.pf.fourcc != FOURCC_ATI2) { + if (!ELEM(header.pf.fourcc, + FOURCC_DXT1, + FOURCC_DXT2, + FOURCC_DXT3, + FOURCC_DXT4, + FOURCC_DXT5, + FOURCC_RXGB, + FOURCC_ATI1, + FOURCC_ATI2)) { /* Unknown fourcc code. */ return false; } diff --git a/source/blender/makesrna/intern/makesrna.c b/source/blender/makesrna/intern/makesrna.c index 01a6108fd8c..20261fb9eeb 100644 --- a/source/blender/makesrna/intern/makesrna.c +++ b/source/blender/makesrna/intern/makesrna.c @@ -724,10 +724,10 @@ static char *rna_def_property_get_func( } else { const PropertySubType subtype = prop->subtype; - const char *string_copy_func = (subtype == PROP_FILEPATH || subtype == PROP_DIRPATH || - subtype == PROP_FILENAME || subtype == PROP_BYTESTRING) ? - "BLI_strncpy" : - "BLI_strncpy_utf8"; + const char *string_copy_func = + ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME, PROP_BYTESTRING) ? + "BLI_strncpy" : + "BLI_strncpy_utf8"; rna_print_data_get(f, dp); @@ -1073,10 +1073,10 @@ static char *rna_def_property_set_func( } else { const PropertySubType subtype = prop->subtype; - const char *string_copy_func = (subtype == PROP_FILEPATH || subtype == PROP_DIRPATH || - subtype == PROP_FILENAME || subtype == PROP_BYTESTRING) ? - "BLI_strncpy" : - "BLI_strncpy_utf8"; + const char *string_copy_func = + ELEM(subtype, PROP_FILEPATH, PROP_DIRPATH, PROP_FILENAME, PROP_BYTESTRING) ? + "BLI_strncpy" : + "BLI_strncpy_utf8"; rna_print_data_get(f, dp); diff --git a/source/blender/makesrna/intern/rna_camera.c b/source/blender/makesrna/intern/rna_camera.c index 0378e64290b..23f6bb768d6 100644 --- a/source/blender/makesrna/intern/rna_camera.c +++ b/source/blender/makesrna/intern/rna_camera.c @@ -136,7 +136,7 @@ static void rna_CameraDOFSettings_aperture_blades_set(PointerRNA *ptr, const int { CameraDOFSettings *dofsettings = (CameraDOFSettings *)ptr->data; - if (value == 1 || value == 2) { + if (ELEM(value, 1, 2)) { if (dofsettings->aperture_blades == 0) { dofsettings->aperture_blades = 3; } diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 5127b418b7f..8e2b9c1d937 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -2394,8 +2394,7 @@ void RNA_def_property_int_sdna(PropertyRNA *prop, const char *structname, const iprop->hardmax = iprop->softmax = INT8_MAX; } - if (prop->subtype == PROP_UNSIGNED || prop->subtype == PROP_PERCENTAGE || - prop->subtype == PROP_FACTOR) { + if (ELEM(prop->subtype, PROP_UNSIGNED, PROP_PERCENTAGE, PROP_FACTOR)) { iprop->hardmin = iprop->softmin = 0; } diff --git a/source/blender/makesrna/intern/rna_dynamicpaint.c b/source/blender/makesrna/intern/rna_dynamicpaint.c index d81e44791f4..ed6d4996c1e 100644 --- a/source/blender/makesrna/intern/rna_dynamicpaint.c +++ b/source/blender/makesrna/intern/rna_dynamicpaint.c @@ -237,8 +237,7 @@ static const EnumPropertyItem *rna_DynamicPaint_surface_type_itemf(bContext *UNU RNA_enum_item_add(&item, &totitem, &tmp); /* Displace */ - if (surface->format == MOD_DPAINT_SURFACE_F_VERTEX || - surface->format == MOD_DPAINT_SURFACE_F_IMAGESEQ) { + if (ELEM(surface->format, MOD_DPAINT_SURFACE_F_VERTEX, MOD_DPAINT_SURFACE_F_IMAGESEQ)) { tmp.value = MOD_DPAINT_SURFACE_T_DISPLACE; tmp.identifier = "DISPLACE"; tmp.name = "Displace"; diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index f61d5456974..2770255802d 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -438,8 +438,7 @@ static void rna_ParticleSystem_co_hair( return; } - if (part->ren_as == PART_DRAW_OB || part->ren_as == PART_DRAW_GR || - part->ren_as == PART_DRAW_NOT) { + if (ELEM(part->ren_as, PART_DRAW_OB, PART_DRAW_GR, PART_DRAW_NOT)) { return; } @@ -836,7 +835,7 @@ static void rna_Particle_target_reset(Main *bmain, Scene *UNUSED(scene), Pointer ParticleTarget *pt = (ParticleTarget *)ptr->data; ParticleSystem *kpsys = NULL, *psys = rna_particle_system_for_target(ob, pt); - if (pt->ob == ob || pt->ob == NULL) { + if (ELEM(pt->ob, ob, NULL)) { kpsys = BLI_findlink(&ob->particlesystem, pt->psys - 1); if (kpsys) { @@ -1334,7 +1333,7 @@ static const EnumPropertyItem *rna_Particle_type_itemf(bContext *UNUSED(C), { ParticleSettings *part = (ParticleSettings *)ptr->owner_id; - if (part->type == PART_HAIR || part->type == PART_EMITTER) { + if (ELEM(part->type, PART_HAIR, PART_EMITTER)) { return part_type_items; } else { diff --git a/source/blender/makesrna/intern/rna_rna.c b/source/blender/makesrna/intern/rna_rna.c index e7c3d90573f..8f1847c00f4 100644 --- a/source/blender/makesrna/intern/rna_rna.c +++ b/source/blender/makesrna/intern/rna_rna.c @@ -1451,7 +1451,7 @@ static int rna_property_override_diff_propptr(Main *bmain, *r_override_changed = true; } - if (extended_rna_path != extended_rna_path_buffer && extended_rna_path != rna_path) { + if (!ELEM(extended_rna_path, extended_rna_path_buffer, rna_path)) { MEM_freeN(extended_rna_path); } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 145746cdce4..209331065ac 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -1425,7 +1425,7 @@ static const EnumPropertyItem *rna_ImageFormatSettings_exr_codec_itemf(bContext } for (i = 0; i < R_IMF_EXR_CODEC_MAX; i++) { - if ((i == R_IMF_EXR_CODEC_B44 || i == R_IMF_EXR_CODEC_B44A)) { + if (ELEM(i, R_IMF_EXR_CODEC_B44, R_IMF_EXR_CODEC_B44A)) { continue; /* B44 and B44A are not defined for 32 bit floats */ } diff --git a/source/blender/makesrna/intern/rna_ui.c b/source/blender/makesrna/intern/rna_ui.c index 00fb48b489a..1d0723851ad 100644 --- a/source/blender/makesrna/intern/rna_ui.c +++ b/source/blender/makesrna/intern/rna_ui.c @@ -549,7 +549,7 @@ static void uilist_filter_items(uiList *ui_list, parm = RNA_function_find_parameter(NULL, func, "filter_flags"); ret_len = RNA_parameter_dynamic_length_get(&list, parm); - if (ret_len != len && ret_len != 0) { + if (!ELEM(ret_len, len, 0)) { printf("%s: Error, py func returned %d items in %s, %d or none were expected.\n", __func__, RNA_parameter_dynamic_length_get(&list, parm), @@ -565,7 +565,7 @@ static void uilist_filter_items(uiList *ui_list, parm = RNA_function_find_parameter(NULL, func, "filter_neworder"); ret_len = RNA_parameter_dynamic_length_get(&list, parm); - if (ret_len != len && ret_len != 0) { + if (!ELEM(ret_len, len, 0)) { printf("%s: Error, py func returned %d items in %s, %d or none were expected.\n", __func__, RNA_parameter_dynamic_length_get(&list, parm), diff --git a/source/blender/makesrna/intern/rna_xr.c b/source/blender/makesrna/intern/rna_xr.c index 9fe3153eb1e..d8be9b7e80d 100644 --- a/source/blender/makesrna/intern/rna_xr.c +++ b/source/blender/makesrna/intern/rna_xr.c @@ -33,7 +33,7 @@ static wmXrData *rna_XrSession_wm_xr_data_get(PointerRNA *ptr) /* Callers could also get XrSessionState pointer through ptr->data, but prefer if we just * consistently pass wmXrData pointers to the WM_xr_xxx() API. */ - BLI_assert((ptr->type == &RNA_XrSessionSettings) || (ptr->type == &RNA_XrSessionState)); + BLI_assert(ELEM(ptr->type, &RNA_XrSessionSettings, &RNA_XrSessionState)); wmWindowManager *wm = (wmWindowManager *)ptr->owner_id; BLI_assert(wm && (GS(wm->id.name) == ID_WM)); @@ -739,7 +739,7 @@ static bool rna_XrSessionState_action_create(bContext *C, return false; } - const bool is_float_action = (ami->type == XR_FLOAT_INPUT || ami->type == XR_VECTOR2F_INPUT); + const bool is_float_action = ELEM(ami->type, XR_FLOAT_INPUT, XR_VECTOR2F_INPUT); const bool is_button_action = (is_float_action || ami->type == XR_BOOLEAN_INPUT); wmOperatorType *ot = NULL; IDProperty *op_properties = NULL; @@ -791,7 +791,7 @@ static bool rna_XrSessionState_action_binding_create(bContext *C, return false; } - const bool is_float_action = (ami->type == XR_FLOAT_INPUT || ami->type == XR_VECTOR2F_INPUT); + const bool is_float_action = ELEM(ami->type, XR_FLOAT_INPUT, XR_VECTOR2F_INPUT); const bool is_button_action = (is_float_action || ami->type == XR_BOOLEAN_INPUT); const bool is_pose_action = (ami->type == XR_POSE_INPUT); float float_thresholds[2]; diff --git a/source/blender/windowmanager/intern/wm_event_system.c b/source/blender/windowmanager/intern/wm_event_system.c index a01da3b1fbd..f6e71ba5df3 100644 --- a/source/blender/windowmanager/intern/wm_event_system.c +++ b/source/blender/windowmanager/intern/wm_event_system.c @@ -5202,7 +5202,7 @@ void wm_event_add_ghostevent(wmWindowManager *wm, wmWindow *win, int type, void #ifdef WITH_XR_OPENXR void wm_event_add_xrevent(wmWindow *win, wmXrActionData *actiondata, short val) { - BLI_assert(val == KM_PRESS || val == KM_RELEASE); + BLI_assert(ELEM(val, KM_PRESS, KM_RELEASE)); wmEvent event = { .type = EVT_XR_ACTION, diff --git a/source/blender/windowmanager/xr/intern/wm_xr_operators.c b/source/blender/windowmanager/xr/intern/wm_xr_operators.c index 54800a5cd35..3c090423c41 100644 --- a/source/blender/windowmanager/xr/intern/wm_xr_operators.c +++ b/source/blender/windowmanager/xr/intern/wm_xr_operators.c @@ -867,7 +867,7 @@ static void wm_xr_fly_compute_turn(eXrFlyMode mode, const float nav_inv[4][4], float r_delta[4][4]) { - BLI_assert(mode == XR_FLY_TURNLEFT || mode == XR_FLY_TURNRIGHT); + BLI_assert(ELEM(mode, XR_FLY_TURNLEFT, XR_FLY_TURNRIGHT)); float z_axis[3], m[3][3], prev[4][4], curr[4][4]; |