[Bf-blender-cvs] [3568d56bccc] master: Alembic: transformed chain-of-ifs into switch statement

Sybren A. Stüvel noreply at git.blender.org
Tue Jul 30 17:07:06 CEST 2019


Commit: 3568d56bccc556e04c61d8f6ac3f005b0ff838b7
Author: Sybren A. Stüvel
Date:   Thu Jul 4 11:53:17 2019 +0200
Branches: master
https://developer.blender.org/rB3568d56bccc556e04c61d8f6ac3f005b0ff838b7

Alembic: transformed chain-of-ifs into switch statement

By having a switch statement that lists all the values of the enum, it is
clear which cases we're not handling, and it also allows for warnings in
the future when the enum expands.

No functional changes.

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

M	source/blender/alembic/intern/abc_mesh.cc

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

diff --git a/source/blender/alembic/intern/abc_mesh.cc b/source/blender/alembic/intern/abc_mesh.cc
index 39d9f9d768e..1903b5149c5 100644
--- a/source/blender/alembic/intern/abc_mesh.cc
+++ b/source/blender/alembic/intern/abc_mesh.cc
@@ -919,11 +919,19 @@ ABC_INLINE void read_normals_params(AbcMeshData &abc_data,
 
   IN3fGeomParam::Sample normsamp = normals.getExpandedValue(selector);
 
-  if (normals.getScope() == kFacevaryingScope) {
-    abc_data.face_normals = normsamp.getVals();
-  }
-  else if ((normals.getScope() == kVertexScope) || (normals.getScope() == kVaryingScope)) {
-    abc_data.vertex_normals = N3fArraySamplePtr();
+  Alembic::AbcGeom::GeometryScope scope = normals.getScope();
+  switch (scope) {
+    case Alembic::AbcGeom::kFacevaryingScope:
+      abc_data.face_normals = normsamp.getVals();
+      break;
+    case Alembic::AbcGeom::kVertexScope:
+    case Alembic::AbcGeom::kVaryingScope:
+      abc_data.vertex_normals = N3fArraySamplePtr();
+      break;
+    case Alembic::AbcGeom::kConstantScope:
+    case Alembic::AbcGeom::kUniformScope:
+    case Alembic::AbcGeom::kUnknownScope:
+      break;
   }
 }



More information about the Bf-blender-cvs mailing list