[Bf-blender-cvs] [182443da4b7] universal-scene-description: USD import: 'preview' purpose material fallback
Michael Kowalski
noreply at git.blender.org
Tue Aug 31 22:10:22 CEST 2021
Commit: 182443da4b7f38a71f80e41fa8878a4a78cba64f
Author: Michael Kowalski
Date: Tue Aug 31 15:49:11 2021 -0400
Branches: universal-scene-description
https://developer.blender.org/rB182443da4b7f38a71f80e41fa8878a4a78cba64f
USD import: 'preview' purpose material fallback
Added logic to explicitly query bound materials
with purpose 'preview', if querying 'allPurpse' bound
materials returns no result.
===================================================================
M source/blender/io/usd/intern/usd_reader_mesh.cc
===================================================================
diff --git a/source/blender/io/usd/intern/usd_reader_mesh.cc b/source/blender/io/usd/intern/usd_reader_mesh.cc
index cc5a542625b..0d4af292439 100644
--- a/source/blender/io/usd/intern/usd_reader_mesh.cc
+++ b/source/blender/io/usd/intern/usd_reader_mesh.cc
@@ -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();
More information about the Bf-blender-cvs
mailing list