[Bf-blender-cvs] [5ef686b9d19] usd-importer-T81257: Coding convention fixes.

Michael A. Kowalski noreply at git.blender.org
Sun Oct 4 21:54:19 CEST 2020


Commit: 5ef686b9d1926aa3d3b5d6a9b9fb942f7ff256c3
Author: Michael A. Kowalski
Date:   Sat Oct 3 16:43:08 2020 -0400
Branches: usd-importer-T81257
https://developer.blender.org/rB5ef686b9d1926aa3d3b5d6a9b9fb942f7ff256c3

Coding convention fixes.

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

M	source/blender/io/usd/intern/usd_capi.cc
M	source/blender/io/usd/intern/usd_reader_mesh.cc
M	source/blender/io/usd/intern/usd_reader_object.cc
M	source/blender/io/usd/intern/usd_util.cc
M	source/blender/io/usd/intern/usd_util.h

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

diff --git a/source/blender/io/usd/intern/usd_capi.cc b/source/blender/io/usd/intern/usd_capi.cc
index 94a300fd45b..8070473c1dd 100644
--- a/source/blender/io/usd/intern/usd_capi.cc
+++ b/source/blender/io/usd/intern/usd_capi.cc
@@ -273,7 +273,7 @@ static void import_startjob(void *user_data, short *stop, short *do_update, floa
   *data->do_update = true;
   *data->progress = 0.1f;
 
-  create_readers(data->stage, data->readers, import_ctx);
+  create_readers(data->stage, import_ctx, data->readers);
 
   // Create objects
 
diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc
index b6c51876bd2..f4650fcc6d3 100644
--- a/source/blender/io/usd/intern/usd_reader_mesh.cc
+++ b/source/blender/io/usd/intern/usd_reader_mesh.cc
@@ -67,8 +67,12 @@ static void sample_uvs(const pxr::UsdGeomMesh &mesh,
 
   pxr::UsdGeomPrimvar st_primvar = mesh.GetPrimvar(primvar_name);
 
-  if (st_primvar && (st_primvar.GetTypeName() == pxr::SdfValueTypeNames->TexCoord2fArray ||
-                     st_primvar.GetTypeName() == pxr::SdfValueTypeNames->Float2Array)) {
+  if (!st_primvar) {
+    return;
+  }
+
+  if (st_primvar.GetTypeName() == pxr::SdfValueTypeNames->TexCoord2fArray ||
+      st_primvar.GetTypeName() == pxr::SdfValueTypeNames->Float2Array) {
     if (!st_primvar.Get(&mesh_data.uv_values, time)) {
       std::cerr << "WARNING: Couldn't get uvs from primvar " << primvar_name << " for prim "
                 << mesh.GetPath() << std::endl;
@@ -134,9 +138,9 @@ static void read_mpolys(Mesh *mesh, const MeshSampleData &mesh_data)
   MLoop *mloops = mesh->mloop;
   MLoopUV *mloopuvs = nullptr;
 
-  bool do_uvs = (mesh_data.uv_interpolation == pxr::UsdGeomTokens->faceVarying ||
-                 mesh_data.uv_interpolation == pxr::UsdGeomTokens->vertex) &&
-                !(mesh_data.uv_indices.empty() && mesh_data.uv_values.empty());
+  const bool do_uvs = (mesh_data.uv_interpolation == pxr::UsdGeomTokens->faceVarying ||
+                       mesh_data.uv_interpolation == pxr::UsdGeomTokens->vertex) &&
+                      !(mesh_data.uv_indices.empty() && mesh_data.uv_values.empty());
 
   if (do_uvs) {
     void *cd_ptr = add_customdata(mesh, "uvMap", CD_MLOOPUV);
@@ -192,7 +196,7 @@ static void read_mpolys(Mesh *mesh, const MeshSampleData &mesh_data)
 
   BKE_mesh_calc_edges(mesh, false, false);
 
-  /* TODO:  Possibly check for invalid geometry. */
+  /* TODO(makowalski):  Possibly check for invalid geometry. */
 }
 
 namespace blender::io::usd {
@@ -237,7 +241,7 @@ Mesh *UsdMeshReader::read_mesh(Mesh *existing_mesh,
   mesh_.GetFaceVertexIndicesAttr().Get(&mesh_data.vertex_indices, time);
 
   /* For now, always return a new mesh.
-   * TODO: Add logic to handle the cases where the topology
+   * TODO(makowalski): Add logic to handle the cases where the topology
    * hasn't chaged and we return the existing mesh with updated
    * vert positions. */
 
@@ -263,7 +267,7 @@ Mesh *UsdMeshReader::read_mesh(Mesh *existing_mesh,
     BKE_mesh_calc_normals(new_mesh);
   }
 
-  /* TODO:  Handle case where topology hasn't changed. */
+  /* TODO(makowalski):  Handle case where topology hasn't changed. */
 
   return new_mesh;
 }
@@ -297,7 +301,7 @@ void UsdMeshReader::readObjectData(Main *bmain, double time)
     mesh->flag |= autosmooth;
   }
 
-  /* TODO:  Read face sets and add modifier. */
+  /* TODO(makowalski):  Read face sets and add modifier. */
 }
 
 }  // namespace blender::io::usd
diff --git a/source/blender/io/usd/intern/usd_reader_object.cc b/source/blender/io/usd/intern/usd_reader_object.cc
index 178cb4451f4..662c5d25e57 100644
--- a/source/blender/io/usd/intern/usd_reader_object.cc
+++ b/source/blender/io/usd/intern/usd_reader_object.cc
@@ -110,7 +110,7 @@ void UsdObjectReader::setupObjectTransform(const double time)
   BKE_object_apply_mat4(object_, transform_from_usd, true, false);
   BKE_object_to_mat4(object_, object_->obmat);
 
-  /* TODO:  Set up transform constraint if not constant. */
+  /* TODO(makowalski):  Set up transform constraint if not constant. */
 }
 
 void UsdObjectReader::read_matrix(float r_mat[4][4] /* local matrix */,
@@ -126,7 +126,7 @@ void UsdObjectReader::read_matrix(float r_mat[4][4] /* local matrix */,
     return;
   }
 
-  /* TODO:  Check for constant transform. */
+  /* TODO(makowalski):  Check for constant transform. */
 
   pxr::GfMatrix4d usd_local_to_world = xformable.ComputeLocalToWorldTransform(time);
 
diff --git a/source/blender/io/usd/intern/usd_util.cc b/source/blender/io/usd/intern/usd_util.cc
index 25d9d8790f2..dd4593f0852 100644
--- a/source/blender/io/usd/intern/usd_util.cc
+++ b/source/blender/io/usd/intern/usd_util.cc
@@ -214,8 +214,8 @@ void copy_m44_axis_swap(float dst_mat[4][4], float src_mat[4][4], UsdAxisSwapMod
 }
 
 void create_readers(const pxr::UsdStageRefPtr &usd_stage,
-                    std::vector<UsdObjectReader *> &r_readers,
-                    const USDImporterContext &context)
+                    const USDImporterContext &context,
+                    std::vector<UsdObjectReader *> &r_readers)
 {
   if (!usd_stage) {
     return;
diff --git a/source/blender/io/usd/intern/usd_util.h b/source/blender/io/usd/intern/usd_util.h
index e65a280161b..ee324061297 100644
--- a/source/blender/io/usd/intern/usd_util.h
+++ b/source/blender/io/usd/intern/usd_util.h
@@ -30,7 +30,7 @@ class UsdObjectReader;
 
 void debug_traverse_stage(const pxr::UsdStageRefPtr &usd_stage);
 
-/* TODO:  copy_m44_axis_swap and create_swapped_rotation_matrix
+/* TODO(makowalski):  copy_m44_axis_swap and create_swapped_rotation_matrix
  * below are duplicates of the declarations in abc_axis_conversion.h.
  * Should move this to a shared location. */
 typedef enum {
@@ -49,7 +49,7 @@ void create_swapped_rotation_matrix(float rot_x_mat[3][3],
 void copy_m44_axis_swap(float dst_mat[4][4], float src_mat[4][4], UsdAxisSwapMode mode);
 
 void create_readers(const pxr::UsdStageRefPtr &usd_stage,
-                    std::vector<UsdObjectReader *> &r_readers,
-                    const USDImporterContext &context);
+                    const USDImporterContext &context,
+                    std::vector<UsdObjectReader *> &r_readers);
 
 } /* namespace blender::io::usd */



More information about the Bf-blender-cvs mailing list