Commit: 46748e7f0303f08a2d1695b46dd96dcbccb20574 Author: Sybren A. Stüvel Date: Thu Nov 28 12:54:14 2019 +0100 Branches: temp-sybren-usd-patch-02 https://developer.blender.org/rB46748e7f0303f08a2d1695b46dd96dcbccb20574
USD: Avoid crash when USD JSON files cannot be found USD ships with a set of JSON files that define which formats can be written and which plugins are required. This is used even when statically building and only using the default USDA and USDC formats. =================================================================== M source/blender/usd/intern/usd_capi.cc =================================================================== diff --git a/source/blender/usd/intern/usd_capi.cc b/source/blender/usd/intern/usd_capi.cc index 9f807d05968..d6130d36423 100644 --- a/source/blender/usd/intern/usd_capi.cc +++ b/source/blender/usd/intern/usd_capi.cc @@ -88,8 +88,17 @@ static void export_startjob(void *customdata, short *stop, short *do_update, flo // For restoring the current frame after exporting animation is done. const int orig_frame = CFRA; - // Create a stage and set up the metadata. pxr::UsdStageRefPtr usd_stage = pxr::UsdStage::CreateNew(data->filename); + if (!usd_stage) { + /* This happens when the USD JSON files cannot be found. When that happens, + * the USD library doesn't know it has the functionality to write USDA and + * USDC files, and creating a new UsdStage fails. */ + WM_reportf( + RPT_ERROR, "USD Export: unable to find suitable USD plugin to write %s", data->filename); + data->export_ok = false; + return; + } + usd_stage->SetMetadata(pxr::UsdGeomTokens->upAxis, pxr::VtValue(pxr::UsdGeomTokens->z)); usd_stage->SetMetadata(pxr::UsdGeomTokens->metersPerUnit, pxr::VtValue(scene->unit.scale_length)); _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs