Cleanup: use STR_ELEM macro

This commit is contained in:
Campbell Barton 2020-11-06 15:29:25 +11:00
parent 4f140ec7cc
commit 2d803d3f6d
16 changed files with 37 additions and 34 deletions

View File

@ -521,7 +521,7 @@ static void movieclip_convert_multilayer_add_pass(void *UNUSED(layer),
MEM_freeN(rect);
return;
}
if (STREQ(pass_name, RE_PASSNAME_COMBINED) || STREQ(chan_id, "RGBA") || STREQ(chan_id, "RGB")) {
if (STREQ(pass_name, RE_PASSNAME_COMBINED) || STR_ELEM(chan_id, "RGBA", "RGB")) {
ctx->combined_pass = rect;
ctx->num_combined_channels = num_channels;
}

View File

@ -2155,7 +2155,7 @@ bool BKE_scene_multiview_is_render_view_active(const RenderData *rd, const Scene
}
/* SCE_VIEWS_SETUP_BASIC */
if (STREQ(srv->name, STEREO_LEFT_NAME) || STREQ(srv->name, STEREO_RIGHT_NAME)) {
if (STR_ELEM(srv->name, STEREO_LEFT_NAME, STEREO_RIGHT_NAME)) {
return true;
}

View File

@ -2100,7 +2100,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (!MAIN_VERSION_ATLEAST(bmain, 280, 8)) {
/* Blender Internal removal */
for (Scene *scene = bmain->scenes.first; scene; scene = scene->id.next) {
if (STREQ(scene->r.engine, "BLENDER_RENDER") || STREQ(scene->r.engine, "BLENDER_GAME")) {
if (STR_ELEM(scene->r.engine, "BLENDER_RENDER", "BLENDER_GAME")) {
BLI_strncpy(scene->r.engine, RE_engine_id_BLENDER_EEVEE, sizeof(scene->r.engine));
}
@ -4079,8 +4079,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain)
if (STREQ(view_settings->view_transform, "Default")) {
STRNCPY(view_settings->view_transform, "Standard");
}
else if (STREQ(view_settings->view_transform, "RRT") ||
STREQ(view_settings->view_transform, "Film")) {
else if (STR_ELEM(view_settings->view_transform, "RRT", "Film")) {
STRNCPY(view_settings->view_transform, "Filmic");
}
else if (STREQ(view_settings->view_transform, "Log")) {

View File

@ -388,7 +388,7 @@ static void blt_lang_check_ime_supported(void)
{
#ifdef WITH_INPUT_IME
const char *uilng = BLT_lang_get();
ime_is_lang_supported = STREQ(uilng, "zh_CN") || STREQ(uilng, "zh_TW") || STREQ(uilng, "ja_JP");
ime_is_lang_supported = STR_ELEM(uilng, "zh_CN", "zh_TW", "ja_JP");
#else
ime_is_lang_supported = false;
#endif

View File

@ -209,8 +209,7 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
}
}
/* Final transform properties go to the Done node for the exit. */
else if (STREQ(prop_name, "head") || STREQ(prop_name, "tail") ||
STREQ(prop_name, "length") || STRPREFIX(prop_name, "matrix")) {
else if (STR_ELEM(prop_name, "head", "tail", "length") || STRPREFIX(prop_name, "matrix")) {
if (source == RNAPointerSource::EXIT) {
node_identifier.operation_code = OperationCode::BONE_DONE;
}
@ -325,7 +324,7 @@ RNANodeIdentifier RNANodeQuery::construct_node_identifier(const PointerRNA *ptr,
node_identifier.type = NodeType::GEOMETRY;
return node_identifier;
}
if (STREQ(prop_identifier, "hide_viewport") || STREQ(prop_identifier, "hide_render")) {
if (STR_ELEM(prop_identifier, "hide_viewport", "hide_render")) {
node_identifier.type = NodeType::OBJECT_FROM_LAYER;
return node_identifier;
}

View File

@ -453,7 +453,7 @@ static bool eevee_volume_object_mesh_init(Scene *scene,
DRW_shgroup_uniform_texture_ref(
grp, gpu_grid->sampler_name, fds->tex_color ? &fds->tex_color : &e_data.dummy_one);
}
else if (STREQ(gpu_grid->name, "flame") || STREQ(gpu_grid->name, "temperature")) {
else if (STR_ELEM(gpu_grid->name, "flame", "temperature")) {
DRW_shgroup_uniform_texture_ref(
grp, gpu_grid->sampler_name, fds->tex_flame ? &fds->tex_flame : &e_data.dummy_flame);
}

View File

@ -1616,9 +1616,13 @@ static bool gpencil_convert_poll_property(const bContext *UNUSED(C),
const bool valid_timing = RNA_boolean_get(ptr, "use_timing_data");
/* Always show those props */
if (STREQ(prop_id, "type") || STREQ(prop_id, "use_normalize_weights") ||
STREQ(prop_id, "radius_multiplier") || STREQ(prop_id, "use_link_strokes") ||
STREQ(prop_id, "bevel_depth") || STREQ(prop_id, "bevel_resolution")) {
if (STR_ELEM(prop_id,
"type",
"use_normalize_weights",
"radius_multiplier",
"use_link_strokes",
"bevel_depth",
"bevel_resolution")) {
return true;
}
@ -1635,7 +1639,7 @@ static bool gpencil_convert_poll_property(const bContext *UNUSED(C),
if (timing_mode != GP_STROKECONVERT_TIMING_NONE) {
/* Only show when link_stroke is true and stroke timing is enabled */
if (STREQ(prop_id, "frame_range") || STREQ(prop_id, "start_frame")) {
if (STR_ELEM(prop_id, "frame_range", "start_frame")) {
return true;
}

View File

@ -24,6 +24,7 @@
#include "DNA_object_types.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BKE_context.h"
#include "BKE_editmesh.h"
@ -172,7 +173,7 @@ static bool edbm_spin_poll_property(const bContext *UNUSED(C),
const bool dupli = RNA_boolean_get(op->ptr, "dupli");
if (dupli) {
if (STREQ(prop_id, "use_auto_merge") || STREQ(prop_id, "use_normal_flip")) {
if (STR_ELEM(prop_id, "use_auto_merge", "use_normal_flip")) {
return false;
}
}

View File

@ -28,6 +28,7 @@
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLI_utildefines.h"
#include "BKE_context.h"
@ -585,7 +586,7 @@ static bool data_transfer_poll_property(const bContext *UNUSED(C),
return false;
}
if ((STREQ(prop_id, "layers_select_src") || STREQ(prop_id, "layers_select_dst")) &&
if (STR_ELEM(prop_id, "layers_select_src", "layers_select_dst") &&
!DT_DATATYPE_IS_MULTILAYERS(data_type)) {
return false;
}

View File

@ -512,8 +512,7 @@ static bool sound_mixdown_draw_check_prop(PointerRNA *UNUSED(ptr),
void *UNUSED(user_data))
{
const char *prop_id = RNA_property_identifier(prop);
return !(STREQ(prop_id, "filepath") || STREQ(prop_id, "directory") ||
STREQ(prop_id, "filename"));
return !(STR_ELEM(prop_id, "filepath", "directory", "filename"));
}
static void sound_mixdown_draw(bContext *C, wmOperator *op)

View File

@ -1436,8 +1436,7 @@ static bool image_open_draw_check_prop(PointerRNA *UNUSED(ptr),
{
const char *prop_id = RNA_property_identifier(prop);
return !(STREQ(prop_id, "filepath") || STREQ(prop_id, "directory") ||
STREQ(prop_id, "filename"));
return !(STR_ELEM(prop_id, "filepath", "directory", "filename"));
}
static void image_open_draw(bContext *UNUSED(C), wmOperator *op)

View File

@ -31,6 +31,7 @@
#include "BLI_linklist.h"
#include "BLI_listbase.h"
#include "BLI_math.h"
#include "BLI_string.h"
#include "BLT_translation.h"
@ -68,10 +69,11 @@ static bool node_group_operator_active(bContext *C)
* Disabled otherwise to allow pynodes define their own operators
* with same keymap.
*/
if (STREQ(snode->tree_idname, "ShaderNodeTree") ||
STREQ(snode->tree_idname, "CompositorNodeTree") ||
STREQ(snode->tree_idname, "TextureNodeTree") ||
STREQ(snode->tree_idname, "SimulationNodeTree")) {
if (STR_ELEM(snode->tree_idname,
"ShaderNodeTree",
"CompositorNodeTree",
"TextureNodeTree",
"SimulationNodeTree")) {
return true;
}
}

View File

@ -315,7 +315,7 @@ static bool seq_effect_add_properties_poll(const bContext *UNUSED(C),
/* Hide start/end frames for effect strips that are locked to their parents' location. */
if (BKE_sequence_effect_get_num_inputs(type) != 0) {
if ((STREQ(prop_id, "frame_start")) || (STREQ(prop_id, "frame_end"))) {
if (STR_ELEM(prop_id, "frame_start", "frame_end")) {
return false;
}
}
@ -639,8 +639,7 @@ static bool sequencer_add_draw_check_fn(PointerRNA *UNUSED(ptr),
{
const char *prop_id = RNA_property_identifier(prop);
return !(STREQ(prop_id, "filepath") || STREQ(prop_id, "directory") ||
STREQ(prop_id, "filename"));
return !(STR_ELEM(prop_id, "filepath", "directory", "filename"));
}
static int sequencer_add_movie_strip_exec(bContext *C, wmOperator *op)

View File

@ -29,6 +29,7 @@
#include "MEM_guardedalloc.h"
#include "BLI_string.h"
#include "BLI_system.h" /* for 'BLI_system_backtrace' stub. */
#include "BLI_utildefines.h"
@ -760,9 +761,10 @@ static char *rna_def_property_get_func(
fprintf(f, "static PointerRNA %s(CollectionPropertyIterator *iter)\n", func);
fprintf(f, "{\n");
if (manualfunc) {
if (STREQ(manualfunc, "rna_iterator_listbase_get") ||
STREQ(manualfunc, "rna_iterator_array_get") ||
STREQ(manualfunc, "rna_iterator_array_dereference_get")) {
if (STR_ELEM(manualfunc,
"rna_iterator_listbase_get",
"rna_iterator_array_get",
"rna_iterator_array_dereference_get")) {
fprintf(f,
" return rna_pointer_inherit_refine(&iter->parent, &RNA_%s, %s(iter));\n",
(cprop->item_type) ? (const char *)cprop->item_type : "UnknownType",

View File

@ -1158,7 +1158,7 @@ static int rna_RenderSettings_stereoViews_skip(CollectionPropertyIterator *iter,
ListBaseIterator *internal = &iter->internal.listbase;
SceneRenderView *srv = (SceneRenderView *)internal->link;
if ((STREQ(srv->name, STEREO_LEFT_NAME)) || (STREQ(srv->name, STEREO_RIGHT_NAME))) {
if (STR_ELEM(srv->name, STEREO_LEFT_NAME, STEREO_RIGHT_NAME)) {
return 0;
}

View File

@ -992,9 +992,7 @@ bool RE_WriteRenderResult(ReportList *reports,
/* We only store RGBA passes as half float, for
* others precision loss can be problematic. */
bool pass_half_float = half_float &&
(STREQ(rp->chan_id, "RGB") || STREQ(rp->chan_id, "RGBA") ||
STREQ(rp->chan_id, "R") || STREQ(rp->chan_id, "G") ||
STREQ(rp->chan_id, "B") || STREQ(rp->chan_id, "A"));
(STR_ELEM(rp->chan_id, "RGB", "RGBA", "R", "G", "B", "A"));
for (int a = 0; a < rp->channels; a++) {
/* Save Combined as RGBA if single layer save. */