USD: Skeleton and blend shape import #110912

Merged
Michael Kowalski merged 38 commits from makowalski/blender:usdskel_import into main 2023-08-17 20:11:58 +02:00
2 changed files with 10 additions and 30 deletions
Showing only changes of commit 076689ae9c - Show all commits

View File

@ -995,9 +995,9 @@ Mesh *USDMeshReader::read_mesh(Mesh *existing_mesh,
std::string USDMeshReader::get_skeleton_path() const
{
/* Make sure we can apply UsdSkelBindingAPI to the prim.
* Attempting to apply the API to instance proxies or
* prototypes generates an error. */
if (!prim_ || prim_.IsInstanceProxy() || prim_.IsInPrototype()) {
* Attempting to apply the API to instance proxies generates
* a USD error. */
if (!prim_ || prim_.IsInstanceProxy()) {
return "";
}
@ -1022,9 +1022,10 @@ bool USDMeshReader::get_local_usd_xform(const float time,
return false;
}
if (!import_params_.import_skeletons || prim_.IsInstanceProxy() || prim_.IsInPrototype()) {
if (!import_params_.import_skeletons || prim_.IsInstanceProxy()) {
/* Use the standard transform computation, since we are ignoring
makowalski marked this conversation as resolved Outdated

theUsdSkelBindingAPI missing space ;)

`theUsdSkelBindingAPI` missing space ;)
* skinning data. */
* skinning data. Note that applying theUsdSkelBindingAPI to an
* instance proxy generates a USD error. */
return USDXformReader::get_local_usd_xform(time, r_xform, r_is_constant);
}

View File

@ -82,36 +82,15 @@ void add_bezt(FCurve *fcu,
namespace blender::io::usd {
//pxr::GfMatrix4d get_world_matrix(const pxr::UsdPrim &prim, pxr::UsdTimeCode time)
//{
// pxr::GfMatrix4d local_xf(1.0f);
//
// if (!prim) {
// return local_xf;
// }
//
// pxr::UsdGeomXformable xformable(prim);
//
// if (xformable) {
// bool reset_xform_stack = false;
// if (!xformable.GetLocalTransformation(&local_xf, &reset_xform_stack, time)) {
// std::cout << "WARNING: couldn't get local xform for prim " << prim.GetPath() << std::endl;
// return local_xf;
// }
// }
//
// return local_xf * get_world_matrix(prim.GetParent(), time);
//}
void import_blendshapes(Main *bmain, Object *obj, pxr::UsdPrim prim)
{
if (!(obj && obj->data && obj->type == OB_MESH && prim)) {
return;
}
if (prim.IsInstanceProxy() || prim.IsInPrototype()) {
if (prim.IsInstanceProxy()) {
/* Attempting to create a UsdSkelBindingAPI for
* instance proxies and prototypes generates USD errors. */
* instance proxies generates USD errors. */
return;
}
@ -535,9 +514,9 @@ void import_skel_bindings(Main *bmain, Object *mesh_obj, pxr::UsdPrim prim)
return;
}
if (prim.IsInstanceProxy() || prim.IsInPrototype()) {
if (prim.IsInstanceProxy()) {
/* Attempting to create a UsdSkelBindingAPI for
* instance proxies and prototypes generates USD errors. */
* instance proxies generates USD errors. */
return;
}