[Bf-blender-cvs] [8703e17ace0] tmp_usd_import_unbound_mtls: USD import: fixed compiler warnings.

Michael Kowalski noreply at git.blender.org
Thu Oct 6 16:34:47 CEST 2022


Commit: 8703e17ace01fe2fdac1d8fc8fe3f607a589c0ca
Author: Michael Kowalski
Date:   Thu Oct 6 10:33:43 2022 -0400
Branches: tmp_usd_import_unbound_mtls
https://developer.blender.org/rB8703e17ace01fe2fdac1d8fc8fe3f607a589c0ca

USD import: fixed compiler warnings.

Removed unused function and assignment in
a conditional expression.

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

M	source/blender/io/usd/intern/usd_reader_mesh.cc
M	source/blender/io/usd/intern/usd_reader_stage.cc

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

diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc
index 3dbdd5d486b..3f7d51e3e76 100644
--- a/source/blender/io/usd/intern/usd_reader_mesh.cc
+++ b/source/blender/io/usd/intern/usd_reader_mesh.cc
@@ -48,20 +48,6 @@ static const pxr::TfToken normalsPrimvar("normals", pxr::TfToken::Immortal);
 }  // namespace usdtokens
 
 namespace utils {
-/* Very similar to #blender::io::alembic::utils. */
-static void build_mat_map(const Main *bmain, std::map<std::string, Material *> *r_mat_map)
-{
-  if (r_mat_map == nullptr) {
-    return;
-  }
-
-  Material *material = static_cast<Material *>(bmain->materials.first);
-
-  for (; material; material = static_cast<Material *>(material->id.next)) {
-    /* We have to do this because the stored material name is coming directly from USD. */
-    (*r_mat_map)[pxr::TfMakeValidIdentifier(material->id.name + 2)] = material;
-  }
-}
 
 static pxr::UsdShadeMaterial compute_bound_material(const pxr::UsdPrim &prim)
 {
diff --git a/source/blender/io/usd/intern/usd_reader_stage.cc b/source/blender/io/usd/intern/usd_reader_stage.cc
index 0533cbbffee..aaa14dad51b 100644
--- a/source/blender/io/usd/intern/usd_reader_stage.cc
+++ b/source/blender/io/usd/intern/usd_reader_stage.cc
@@ -332,8 +332,8 @@ void USDStageReader::import_all_materials(Main *bmain)
       }
 
       /* Add the material now. */
-      if (blend_mtl = mtl_reader.add_material(usd_mtl)) {
-
+      blend_mtl = mtl_reader.add_material(usd_mtl);
+      if (blend_mtl) {
         if (params_.mtl_name_collision_mode == USD_MTL_NAME_COLLISION_MAKE_UNIQUE) {
           /* Record the name of the Blender material we created for the USD material
            * with the given path, so we don't import the material again if the



More information about the Bf-blender-cvs mailing list