USD import: 'preview' purpose material fallback
Added logic to explicitly query bound materials with purpose 'preview', if querying 'allPurpse' bound materials returns no result.
This commit is contained in:
parent
2e32a0871f
commit
182443da4b
Notes:
blender-bot
2023-02-14 04:56:36 +01:00
Referenced by issue #90535, USDPreviewSurface materials in Animal Logic's ALab are missing textures
|
@ -723,6 +723,11 @@ void USDMeshReader::assign_facesets_to_mpoly(double motionSampleTime,
|
|||
|
||||
pxr::UsdShadeMaterial subset_mtl = subset_api.ComputeBoundMaterial();
|
||||
|
||||
if (!subset_mtl) {
|
||||
/* Check for a preview material as fallback. */
|
||||
subset_mtl = subset_api.ComputeBoundMaterial(pxr::UsdShadeTokens->preview);
|
||||
}
|
||||
|
||||
if (!subset_mtl) {
|
||||
continue;
|
||||
}
|
||||
|
@ -753,7 +758,14 @@ void USDMeshReader::assign_facesets_to_mpoly(double motionSampleTime,
|
|||
if (r_mat_map->empty()) {
|
||||
pxr::UsdShadeMaterialBindingAPI api = pxr::UsdShadeMaterialBindingAPI(prim_);
|
||||
|
||||
if (pxr::UsdShadeMaterial mtl = api.ComputeBoundMaterial()) {
|
||||
pxr::UsdShadeMaterial mtl = api.ComputeBoundMaterial();
|
||||
|
||||
if (!mtl) {
|
||||
/* Check for a preview material as fallback. */
|
||||
mtl = api.ComputeBoundMaterial(pxr::UsdShadeTokens->preview);
|
||||
}
|
||||
|
||||
if (mtl) {
|
||||
|
||||
pxr::SdfPath mtl_path = mtl.GetPath();
|
||||
|
||||
|
|
Loading…
Reference in New Issue