[Bf-blender-cvs] [c8ae60e2dfd] usd-importer-T81257: USD importer: format and compiler warning fixes.

makowalski noreply at git.blender.org
Sun Dec 27 22:18:13 CET 2020


Commit: c8ae60e2dfd0aeafee231dbd63adb477bca8c128
Author: makowalski
Date:   Sun Dec 13 20:39:53 2020 -0500
Branches: usd-importer-T81257
https://developer.blender.org/rBc8ae60e2dfd0aeafee231dbd63adb477bca8c128

USD importer: format and compiler warning fixes.

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

M	source/blender/io/usd/import/usd_reader_shape.h
M	source/blender/io/usd/import/usd_reader_xformable.cc
M	source/blender/io/usd/usd.h

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

diff --git a/source/blender/io/usd/import/usd_reader_shape.h b/source/blender/io/usd/import/usd_reader_shape.h
index bc48ab4ac6c..e22af390478 100644
--- a/source/blender/io/usd/import/usd_reader_shape.h
+++ b/source/blender/io/usd/import/usd_reader_shape.h
@@ -32,7 +32,6 @@ namespace blender::io::usd {
 
 class USDShapeReader : public USDXformableReader {
  protected:
-
  public:
   USDShapeReader(const pxr::UsdPrim &prim, const USDImporterContext &context);
 
diff --git a/source/blender/io/usd/import/usd_reader_xformable.cc b/source/blender/io/usd/import/usd_reader_xformable.cc
index fdca56cf7ed..7a830269f00 100644
--- a/source/blender/io/usd/import/usd_reader_xformable.cc
+++ b/source/blender/io/usd/import/usd_reader_xformable.cc
@@ -68,15 +68,9 @@ void USDXformableReader::eval_merged_with_parent()
       pxr::UsdPrimSiblingRange child_prims = parent.GetFilteredChildren(
           pxr::UsdTraverseInstanceProxies(pxr::UsdPrimDefaultPredicate));
 
-      // Unfortunately, we need to iterate over the child primitives
-      // to count them.
-      int num_child_prims = 0;
-      for (const pxr::UsdPrim &child_prim : child_prims) {
-        ++num_child_prims;
-        if (num_child_prims > 1) {
-          break;
-        }
-      }
+      // UsdPrimSiblingRange doesn't have a size() function, so we compute the child count.
+      std::ptrdiff_t num_child_prims = std::distance(child_prims.begin(), child_prims.end());
+
       merged_with_parent_ = num_child_prims == 1;
     }
   }
diff --git a/source/blender/io/usd/usd.h b/source/blender/io/usd/usd.h
index cd3ff47ab68..1ca1358d344 100644
--- a/source/blender/io/usd/usd.h
+++ b/source/blender/io/usd/usd.h
@@ -25,8 +25,10 @@
 extern "C" {
 #endif
 
-struct Scene;
 struct bContext;
+struct CacheReader;
+struct Object;
+struct Scene;
 
 typedef struct CacheArchiveHandle CacheArchiveHandle;



More information about the Bf-blender-cvs mailing list