Cleanup: use ELEM macro
This commit is contained in:
parent
626c844105
commit
2146256563
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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') {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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)| */
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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. */
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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 */
|
||||
}
|
||||
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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];
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ static int *parse_int_relative_clamp_n(
|
|||
int i = 0;
|
||||
while (true) {
|
||||
const char *str_end = strchr(str, sep);
|
||||
if ((*str == sep) || (*str == '\0')) {
|
||||
if (ELEM(*str, sep, '\0')) {
|
||||
static const char *msg = "incorrect comma use";
|
||||
*r_err_msg = msg;
|
||||
goto fail;
|
||||
|
|
Loading…
Reference in New Issue