[Bf-blender-cvs] [ee9d96f458a] usd-importer-T81257: USD Importer Xform merge bug fix.
makowalski
noreply at git.blender.org
Sun Dec 27 22:18:13 CET 2020
Commit: ee9d96f458a206b26edf069d8c7ecba3a76816f6
Author: makowalski
Date: Wed Dec 23 12:34:14 2020 -0500
Branches: usd-importer-T81257
https://developer.blender.org/rBee9d96f458a206b26edf069d8c7ecba3a76816f6
USD Importer Xform merge bug fix.
Disallow merging if parent isn't a UsdGeomXform.
===================================================================
M source/blender/io/usd/import/usd_reader_xformable.cc
M source/blender/io/usd/import/usd_reader_xformable.h
===================================================================
diff --git a/source/blender/io/usd/import/usd_reader_xformable.cc b/source/blender/io/usd/import/usd_reader_xformable.cc
index 7a830269f00..2d96effa0c1 100644
--- a/source/blender/io/usd/import/usd_reader_xformable.cc
+++ b/source/blender/io/usd/import/usd_reader_xformable.cc
@@ -76,6 +76,18 @@ void USDXformableReader::eval_merged_with_parent()
}
}
+bool USDXformableReader::can_merge_with_parent() const
+{
+ bool can_merge = false;
+
+ if (valid()) {
+ pxr::UsdPrim parent = prim_.GetParent();
+ can_merge = parent && !parent.IsPseudoRoot() && parent.IsA<pxr::UsdGeomXform>();
+ }
+
+ return can_merge;
+}
+
void USDXformableReader::set_object_transform(const double time, CacheFile *cache_file)
{
if (!object_) {
diff --git a/source/blender/io/usd/import/usd_reader_xformable.h b/source/blender/io/usd/import/usd_reader_xformable.h
index 4f21f153482..65511f8b092 100644
--- a/source/blender/io/usd/import/usd_reader_xformable.h
+++ b/source/blender/io/usd/import/usd_reader_xformable.h
@@ -99,10 +99,7 @@ class USDXformableReader : public USDPrimReader {
virtual void create_object(Main *bmain, double time, USDDataCache *data_cache) = 0;
- virtual bool can_merge_with_parent() const
- {
- return true;
- }
+ virtual bool can_merge_with_parent() const;
void set_object_transform(const double time, CacheFile *cache_file = nullptr);
More information about the Bf-blender-cvs
mailing list