Commit: 8306081cfc7cff6a582d009b198ad4ee952bb415
Author: Michael A. Kowalski
Date:   Tue Oct 20 12:41:04 2020 -0400
Branches: usd-importer-T81257
https://developer.blender.org/rB8306081cfc7cff6a582d009b198ad4ee952bb415

USD importer:  removed unused code.

Removed unused version of create_readers().

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

M       source/blender/io/usd/import/usd_import_util.cc
M       source/blender/io/usd/import/usd_import_util.h

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

diff --git a/source/blender/io/usd/import/usd_import_util.cc 
b/source/blender/io/usd/import/usd_import_util.cc
index cac7a5e271d..d5f7ed90af2 100644
--- a/source/blender/io/usd/import/usd_import_util.cc
+++ b/source/blender/io/usd/import/usd_import_util.cc
@@ -230,115 +230,6 @@ void copy_m44_axis_swap(float dst_mat[4][4], float 
src_mat[4][4], UsdAxisSwapMod
   mul_m4_m4m4(dst_mat, dst_mat, dst_scale_mat);
 }
 
-void create_readers(const pxr::UsdStageRefPtr &usd_stage,
-                    const USDImporterContext &context,
-                    std::vector<UsdObjectReader *> &r_readers)
-{
-  if (!usd_stage) {
-    return;
-  }
-
-  /* Map a USD prim path to the corresponding reader,
-   * for keeping track of which prims have been processed
-   * and for setting parenting relationships when we are
-   * done with the traversal. */
-  std::map<std::string, UsdObjectReader *> readers_map;
-
-  pxr::UsdPrimRange prims = usd_stage->Traverse(
-      pxr::UsdTraverseInstanceProxies(pxr::UsdPrimAllPrimsPredicate));
-
-  for (const pxr::UsdPrim &prim : prims) {
-
-    std::string prim_path = prim.GetPath().GetString();
-
-    std::map<std::string, UsdObjectReader *>::const_iterator prim_entry = 
readers_map.find(
-        prim_path);
-
-    if (prim_entry != readers_map.end()) {
-      /* We already processed the reader for this prim, probably when merging 
it with its parent.
-       */
-      continue;
-    }
-
-    UsdObjectReader *reader = nullptr;
-    bool merge_reader = false;
-
-    if (prim.GetTypeName() == usdtokens::xform_type) {
-
-      /* Check if the Xform and prim should be merged. */
-
-      pxr::UsdPrimSiblingRange children = prim.GetFilteredChildren(
-          pxr::UsdTraverseInstanceProxies(pxr::UsdPrimAllPrimsPredicate));
-
-      size_t num_children = boost::size(children);
-
-      /* Merge only if the Xform has a single Mesh child. */
-      if (num_children == 1) {
-        pxr::UsdPrim child_prim = children.front();
-
-        if (child_prim && child_prim.GetTypeName() == usdtokens::mesh_type) {
-          /* We don't create a reader for the current Xform prim, but instead
-           * make a single reader that will merge the Xform and its child. */
-
-          merge_reader = true;
-          reader = get_reader(child_prim, context);
-          prim_path = child_prim.GetPath().GetString();
-
-          if (reader) {
-            reader->set_merged_with_parent(true);
-          }
-          else {
-            std::cerr << "WARNING:  Couldn't get reader when merging child 
prim." << std::endl;
-          }
-        }
-      }
-    }
-
-    if (!merge_reader) {
-      reader = get_reader(prim, context);
-    }
-
-    if (reader) {
-      readers_map.insert(std::make_pair(prim_path, reader));
-
-      /* If we merged, we also add the reader to the map under the parent prim 
path. */
-      if (merge_reader) {
-        std::string parent_path = prim.GetPath().GetString();
-        if (readers_map.insert(std::make_pair(parent_path, reader)).second == 
false) {
-          std::cerr << "Programmer error: couldn't insert merged prim into 
reader map with parent "
-                       "path key."
-                    << std::endl;
-        }
-      }
-
-      r_readers.push_back(reader);
-      reader->incref();
-    }
-  }
-
-  /* Set parenting. */
-  for (UsdObjectReader *r : r_readers) {
-
-    pxr::UsdPrim parent = r->prim().GetParent();
-
-    if (parent && r->merged_with_parent()) {
-      /* If we are merging, we use the grandparent. */
-      parent = parent.GetParent();
-    }
-
-    if (parent) {
-      std::string parent_path = parent.GetPath().GetString();
-
-      std::map<std::string, UsdObjectReader *>::const_iterator parent_entry = 
readers_map.find(
-          parent_path);
-
-      if (parent_entry != readers_map.end()) {
-        r->set_parent(parent_entry->second);
-      }
-    }
-  }
-}
-
 void create_readers(const pxr::UsdPrim &prim,
                     const USDImporterContext &context,
                     std::vector<UsdObjectReader *> &r_readers,
diff --git a/source/blender/io/usd/import/usd_import_util.h 
b/source/blender/io/usd/import/usd_import_util.h
index ce837817240..a925f2f41eb 100644
--- a/source/blender/io/usd/import/usd_import_util.h
+++ b/source/blender/io/usd/import/usd_import_util.h
@@ -57,10 +57,6 @@ BLI_INLINE void copy_zup_from_yup(float zup[3], const float 
yup[3])
   zup[2] = old_yup1;
 }
 
-void create_readers(const pxr::UsdStageRefPtr &usd_stage,
-                    const USDImporterContext &context,
-                    std::vector<UsdObjectReader *> &r_readers);
-
 void create_readers(const pxr::UsdPrim &root,
                     const USDImporterContext &context,
                     std::vector<UsdObjectReader *> &r_readers,

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to