USD: fix cache reader open error handling. #114298

Merged
Michael Kowalski merged 1 commits from makowalski/blender:usd_cache_reader_open_error into blender-v4.0-release 2023-10-31 14:50:57 +01:00
1 changed files with 4 additions and 5 deletions
Showing only changes of commit f143700dcf - Show all commits

View File

@ -551,17 +551,16 @@ CacheReader *CacheReader_open_usd_object(CacheArchiveHandle *handle,
return reader;
}
if (reader) {
USD_CacheReader_free(reader);
}
pxr::UsdPrim prim = archive->stage()->GetPrimAtPath(pxr::SdfPath(object_path));
if (!prim) {
WM_reportf(RPT_WARNING, "USD Import: unable to open cache reader for object %s", object_path);
return nullptr;
}
if (reader) {
USD_CacheReader_free(reader);
}
/* TODO(makowalski): The handle does not have the proper import params or settings. */
USDPrimReader *usd_reader = archive->create_reader(prim);