[Bf-blender-cvs] [471636ffcd4] universal-scene-description: USD Import: fix error messages loading instances.
Michael Kowalski
noreply at git.blender.org
Mon Oct 24 17:19:08 CEST 2022
Commit: 471636ffcd49d5d339f80edce58d812cbe9aa12d
Author: Michael Kowalski
Date: Wed Oct 19 15:15:47 2022 -0400
Branches: universal-scene-description
https://developer.blender.org/rB471636ffcd49d5d339f80edce58d812cbe9aa12d
USD Import: fix error messages loading instances.
Added logic to avoid attempting to bind the pxr::UsdSkelBindingAPI
to instance proxies and prototypes, as this was generating errors.
===================================================================
M source/blender/io/usd/intern/usd_reader_mesh.cc
M source/blender/io/usd/intern/usd_skel_convert.cc
===================================================================
diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc
index d4acba8059b..7a12258df0a 100644
--- a/source/blender/io/usd/intern/usd_reader_mesh.cc
+++ b/source/blender/io/usd/intern/usd_reader_mesh.cc
@@ -1093,20 +1093,22 @@ bool USDMeshReader::get_local_usd_xform(pxr::GfMatrix4d *r_xform,
return USDXformReader::get_local_usd_xform(r_xform, r_is_constant, time);
}
- if (pxr::UsdSkelBindingAPI skel_api = pxr::UsdSkelBindingAPI::Apply(prim_)) {
- if (skel_api.GetGeomBindTransformAttr().HasAuthoredValue()) {
- pxr::GfMatrix4d bind_xf;
- if (skel_api.GetGeomBindTransformAttr().Get(&bind_xf)) {
- /* Assume that if a bind transform is defined, then the
- * transform is constant. */
- if (r_is_constant) {
- *r_is_constant = true;
+ if (!(prim_.IsInstanceProxy() || prim_.IsInPrototype())) {
+ if (pxr::UsdSkelBindingAPI skel_api = pxr::UsdSkelBindingAPI::Apply(prim_)) {
+ if (skel_api.GetGeomBindTransformAttr().HasAuthoredValue()) {
+ pxr::GfMatrix4d bind_xf;
+ if (skel_api.GetGeomBindTransformAttr().Get(&bind_xf)) {
+ /* Assume that if a bind transform is defined, then the
+ * transform is constant. */
+ if (r_is_constant) {
+ *r_is_constant = true;
+ }
+ return get_geom_bind_xform_correction(bind_xf, r_xform, time);
+ }
+ else {
+ std::cout << "WARNING: couldn't compute geom bind transform for " << prim_.GetPath()
+ << std::endl;
}
- return get_geom_bind_xform_correction(bind_xf, r_xform, time);
- }
- else {
- std::cout << "WARNING: couldn't compute geom bind transform for " << prim_.GetPath()
- << std::endl;
}
}
}
diff --git a/source/blender/io/usd/intern/usd_skel_convert.cc b/source/blender/io/usd/intern/usd_skel_convert.cc
index f05c0ffc2dc..69ab05c234e 100644
--- a/source/blender/io/usd/intern/usd_skel_convert.cc
+++ b/source/blender/io/usd/intern/usd_skel_convert.cc
@@ -586,6 +586,12 @@ void import_skel_bindings(Main *bmain, Object *mesh_obj, pxr::UsdPrim prim)
return;
}
+ if (prim.IsInstanceProxy() || prim.IsInPrototype()) {
+ /* Attempting to create a UsdSkelBindingAPI for
+ * instance proxies and prototypes generates USD errors. */
+ return;
+ }
+
if (mesh_obj->type != OB_MESH) {
return;
}
More information about the Bf-blender-cvs
mailing list