Updates to build with USD 21.11.

This commit is contained in:
Michael Kowalski 2022-05-02 20:22:01 -04:00
parent 8f17cb2052
commit 00aa4252c5
2 changed files with 8 additions and 10 deletions

View File

@ -54,8 +54,8 @@ void USDInstanceReader::set_instance_collection(Collection *coll)
pxr::SdfPath USDInstanceReader::proto_path() const
{
if (pxr::UsdPrim master = prim_.GetMaster()) {
return master.GetPath();
if (pxr::UsdPrim proto = prim_.GetPrototype()) {
return proto.GetPath();
}
return pxr::SdfPath();

View File

@ -60,16 +60,10 @@ using namespace blender::io::usd;
static std::string anchor_relative_path(pxr::UsdStagePtr stage, const std::string &asset_path)
{
if (asset_path.empty()) {
if (asset_path.empty() || asset_path.front() != '.') {
return std::string();
}
pxr::ArResolver &resolver = pxr::ArGetResolver();
if (!resolver.IsRelativePath(asset_path)) {
return asset_path;
}
// TODO(makowalski): avoid recomputing the USD path, if possible.
pxr::SdfLayerHandle layer = stage->GetRootLayer();
@ -79,7 +73,11 @@ static std::string anchor_relative_path(pxr::UsdStagePtr stage, const std::strin
return asset_path;
}
return resolver.AnchorRelativePath(stage_path, asset_path);
#if PXR_VERSION >= 2111
return pxr::ArGetResolver().CreateIdentifier(asset_path, pxr::ArResolvedPath(stage_path));
#else
return pxr::ArGetResolver().AnchorRelativePath(stage_path, asset_path);
#endif
}
static void print_obj(PyObject *obj)