[Bf-blender-cvs] [50ad13419fc] usd-importer-T81257-merge: USD import: apply root transform to merged prims.

makowalski noreply at git.blender.org
Fri Jun 18 03:43:33 CEST 2021


Commit: 50ad13419fcedbf4f656911b2360689a23e5c4da
Author: makowalski
Date:   Thu May 27 14:27:47 2021 -0400
Branches: usd-importer-T81257-merge
https://developer.blender.org/rB50ad13419fcedbf4f656911b2360689a23e5c4da

USD import: apply root transform to merged prims.

Fixed logic to identify root objects to work correctly
for objects that represent merged prims.

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

M	source/blender/io/usd/intern/usd_reader_xform.cc
M	source/blender/io/usd/intern/usd_reader_xform.h

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

diff --git a/source/blender/io/usd/intern/usd_reader_xform.cc b/source/blender/io/usd/intern/usd_reader_xform.cc
index 5cdf126d6eb..4fa5d271690 100644
--- a/source/blender/io/usd/intern/usd_reader_xform.cc
+++ b/source/blender/io/usd/intern/usd_reader_xform.cc
@@ -162,7 +162,11 @@ bool USDXformReader::is_root_xform_prim() const
      * UsdGeomScope that has an xformable ancestor. */
     pxr::UsdPrim cur_parent = prim_.GetParent();
 
-    while (cur_parent) {
+    if (use_parent_xform_) {
+      cur_parent = cur_parent.GetParent();
+    }
+
+    while (cur_parent && !cur_parent.IsPseudoRoot()) {
       if (cur_parent.IsA<pxr::UsdGeomXformable>()) {
         return false;
       }
diff --git a/source/blender/io/usd/intern/usd_reader_xform.h b/source/blender/io/usd/intern/usd_reader_xform.h
index 194eee8918b..fefe1f85a09 100644
--- a/source/blender/io/usd/intern/usd_reader_xform.h
+++ b/source/blender/io/usd/intern/usd_reader_xform.h
@@ -50,6 +50,7 @@ class USDXformReader : public USDPrimReader {
   void set_use_parent_xform(bool flag)
   {
     use_parent_xform_ = flag;
+    is_root_xform_ = is_root_xform_prim();
   }
 
   bool prim_has_xform_ops() const;



More information about the Bf-blender-cvs mailing list