[Bf-blender-cvs] [1be73e8f917] usd-importer-T81257: USD import: remove ref counting.

Michael A. Kowalski noreply at git.blender.org
Fri Nov 6 17:09:33 CET 2020


Commit: 1be73e8f917b82b26202e02f75c0eb552d0711d0
Author: Michael A. Kowalski
Date:   Fri Nov 6 11:01:24 2020 -0500
Branches: usd-importer-T81257
https://developer.blender.org/rB1be73e8f917b82b26202e02f75c0eb552d0711d0

USD import: remove ref counting.

Temporarily removing reference counting from USDPrimReader,
because it isn't needed yet and because the current
implementation is incomplete and not sufficiently robust
(e.g., the reader class destructors shouldn't be public).

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

M	source/blender/io/usd/import/usd_reader_prim.cc
M	source/blender/io/usd/import/usd_reader_prim.h
M	source/blender/io/usd/intern/usd_capi.cc

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

diff --git a/source/blender/io/usd/import/usd_reader_prim.cc b/source/blender/io/usd/import/usd_reader_prim.cc
index 587e2bf07a8..bfa1630fa11 100644
--- a/source/blender/io/usd/import/usd_reader_prim.cc
+++ b/source/blender/io/usd/import/usd_reader_prim.cc
@@ -27,8 +27,7 @@ USDPrimReader::USDPrimReader(const pxr::UsdPrim &prim, const USDImporterContext
       prim_path_(""),
       context_(context),
       min_time_(std::numeric_limits<double>::max()),
-      max_time_(std::numeric_limits<double>::min()),
-      refcount_(0)
+      max_time_(std::numeric_limits<double>::min())
 {
   if (prim) {
     prim_path_ = prim.GetPath().GetString();
@@ -54,20 +53,4 @@ double USDPrimReader::max_time() const
   return max_time_;
 }
 
-int USDPrimReader::refcount() const
-{
-  return refcount_;
-}
-
-void USDPrimReader::incref()
-{
-  refcount_++;
-}
-
-void USDPrimReader::decref()
-{
-  refcount_--;
-  BLI_assert(refcount_ >= 0);
-}
-
 } /* namespace blender::io::usd */
diff --git a/source/blender/io/usd/import/usd_reader_prim.h b/source/blender/io/usd/import/usd_reader_prim.h
index a1fa1a9057d..0f46452895e 100644
--- a/source/blender/io/usd/import/usd_reader_prim.h
+++ b/source/blender/io/usd/import/usd_reader_prim.h
@@ -42,10 +42,6 @@ class USDPrimReader {
   double min_time_;
   double max_time_;
 
-  /* Use reference counting since the same reader may be used by multiple
-   * modifiers and/or constraints. */
-  int refcount_;
-
  public:
   explicit USDPrimReader(const pxr::UsdPrim &prim, const USDImporterContext &context);
 
@@ -80,10 +76,6 @@ class USDPrimReader {
 
   double min_time() const;
   double max_time() const;
-
-  int refcount() const;
-  void incref();
-  void decref();
 };
 
 } /* namespace blender::io::usd */
diff --git a/source/blender/io/usd/intern/usd_capi.cc b/source/blender/io/usd/intern/usd_capi.cc
index aabe02bce04..4e64ae1e8c5 100644
--- a/source/blender/io/usd/intern/usd_capi.cc
+++ b/source/blender/io/usd/intern/usd_capi.cc
@@ -395,12 +395,7 @@ static void import_endjob(void *user_data)
   }
 
   for (iter = data->readers.begin(); iter != data->readers.end(); ++iter) {
-    USDXformableReader *reader = *iter;
-    reader->decref();
-
-    if (reader->refcount() == 0) {
-      delete reader;
-    }
+    delete *iter;
   }
 
   data->readers.clear();



More information about the Bf-blender-cvs mailing list