[Bf-blender-cvs] [16420283103] master: Cleanup: use the ELEM macro

Campbell Barton noreply at git.blender.org
Fri Jan 7 08:06:31 CET 2022


Commit: 164202831032164ed52108b4a365b9ff9ca4ac84
Author: Campbell Barton
Date:   Fri Jan 7 15:30:14 2022 +1100
Branches: master
https://developer.blender.org/rB164202831032164ed52108b4a365b9ff9ca4ac84

Cleanup: use the ELEM macro

===================================================================

M	source/blender/blenkernel/intern/subdiv_mesh.c
M	source/blender/draw/intern/draw_cache_impl_subdivision.cc
M	source/blender/io/alembic/intern/abc_customdata.cc
M	source/blender/windowmanager/xr/intern/wm_xr_operators.c

===================================================================

diff --git a/source/blender/blenkernel/intern/subdiv_mesh.c b/source/blender/blenkernel/intern/subdiv_mesh.c
index 9630b30a21e..5bf519e5f70 100644
--- a/source/blender/blenkernel/intern/subdiv_mesh.c
+++ b/source/blender/blenkernel/intern/subdiv_mesh.c
@@ -1118,7 +1118,7 @@ static void subdiv_mesh_vertex_of_loose_edge(const struct SubdivForeachContext *
   find_edge_neighbors(ctx, coarse_edge, neighbors);
   /* Interpolate custom data when not an end point.
    * This data has already been copied from the original vertex by #subdiv_mesh_vertex_loose. */
-  if (u != 0.0 && u != 1.0) {
+  if (!ELEM(u, 0.0, 1.0)) {
     subdiv_mesh_vertex_of_loose_edge_interpolate(ctx, coarse_edge, u, subdiv_vertex_index);
   }
   /* Interpolate coordinate. */
diff --git a/source/blender/draw/intern/draw_cache_impl_subdivision.cc b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
index 06b83a379e4..372566a8f90 100644
--- a/source/blender/draw/intern/draw_cache_impl_subdivision.cc
+++ b/source/blender/draw/intern/draw_cache_impl_subdivision.cc
@@ -258,10 +258,11 @@ static GPUShader *get_patch_evaluation_shader(int shader_type)
 
 static GPUShader *get_subdiv_shader(int shader_type, const char *defines)
 {
-  if (shader_type == SHADER_PATCH_EVALUATION ||
-      shader_type == SHADER_PATCH_EVALUATION_LIMIT_NORMALS ||
-      shader_type == SHADER_PATCH_EVALUATION_FVAR ||
-      shader_type == SHADER_PATCH_EVALUATION_FACE_DOTS) {
+  if (ELEM(shader_type,
+           SHADER_PATCH_EVALUATION,
+           SHADER_PATCH_EVALUATION_LIMIT_NORMALS,
+           SHADER_PATCH_EVALUATION_FVAR,
+           SHADER_PATCH_EVALUATION_FACE_DOTS)) {
     return get_patch_evaluation_shader(shader_type);
   }
   if (g_subdiv_shaders[shader_type] == nullptr) {
diff --git a/source/blender/io/alembic/intern/abc_customdata.cc b/source/blender/io/alembic/intern/abc_customdata.cc
index 26203864cf8..c3ff64fd0ad 100644
--- a/source/blender/io/alembic/intern/abc_customdata.cc
+++ b/source/blender/io/alembic/intern/abc_customdata.cc
@@ -620,7 +620,7 @@ AbcUvScope get_uv_scope(const Alembic::AbcGeom::GeometryScope scope,
   /* kVaryingScope is sometimes used for vertex scopes as the values vary across the vertices. To
    * be sure, one has to check the size of the data against the number of vertices, as it could
    * also be a varying attribute across the faces (i.e. one value per face). */
-  if ((scope == kVaryingScope || scope == kVertexScope) && indices->size() == config.totvert) {
+  if ((ELEM(scope, kVaryingScope, kVertexScope)) && indices->size() == config.totvert) {
     return ABC_UV_SCOPE_VERTEX;
   }
 
diff --git a/source/blender/windowmanager/xr/intern/wm_xr_operators.c b/source/blender/windowmanager/xr/intern/wm_xr_operators.c
index c503f5d4fee..9c2eaefd61c 100644
--- a/source/blender/windowmanager/xr/intern/wm_xr_operators.c
+++ b/source/blender/windowmanager/xr/intern/wm_xr_operators.c
@@ -956,7 +956,7 @@ static int wm_xr_navigation_fly_modal(bContext *C, wmOperator *op, const wmEvent
   const double time_now = PIL_check_seconds_timer();
 
   mode = (eXrFlyMode)RNA_enum_get(op->ptr, "mode");
-  turn = (mode == XR_FLY_TURNLEFT || mode == XR_FLY_TURNRIGHT);
+  turn = (ELEM(mode, XR_FLY_TURNLEFT, XR_FLY_TURNRIGHT));
 
   locz_lock = RNA_boolean_get(op->ptr, "lock_location_z");
   dir_lock = RNA_boolean_get(op->ptr, "lock_direction");



More information about the Bf-blender-cvs mailing list