Skip to content

Commit

Permalink
Merge pull request #3521 from dj-mcg/pr/Update_Material_Translator_Hy…
Browse files Browse the repository at this point in the history
…dra_API

Update usage of the Hydra API
  • Loading branch information
seando-adsk authored Jan 4, 2024
2 parents 8f5704b + 3210d01 commit cdb9eae
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/mayaUsd/fileio/translators/translatorMaterial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -379,16 +379,28 @@ bool UsdMayaTranslatorMaterial::AssignMaterial(

std::string reasonWhyNotPartition;

const bool validPartition = UsdGeomSubset::ValidateSubsets(
faceSubsets, faceCount, UsdGeomTokens->partition, &reasonWhyNotPartition);
UsdGeomImageable geom(primSchema.GetPrim());
if (UsdGeomSubset::GetFamilyType(geom, UsdShadeTokens->materialBind)
!= UsdGeomTokens->partition) {
TF_WARN(
"The family type of family material bind "
"on <%s> is not set as a partition.",
primSchema.GetPath().GetText());
}
const bool validPartition = UsdGeomSubset::ValidateFamily(
geom, UsdGeomTokens->face, UsdShadeTokens->materialBind, &reasonWhyNotPartition);
if (!validPartition) {
TF_WARN(
"Face-subsets on <%s> don't form a valid partition: %s",
primSchema.GetPath().GetText(),
reasonWhyNotPartition.c_str());

#if PXR_VERSION <= 2311
VtIntArray unassignedIndices
= UsdGeomSubset::GetUnassignedIndices(faceSubsets, faceCount);
#else
VtIntArray unassignedIndices = UsdGeomSubset::GetUnassignedIndices(
geom, UsdGeomTokens->face, UsdShadeTokens->materialBind);
#endif
if (!_AssignMaterialFaceSet(
shadingEngine, primSchema, shapeDagPath, unassignedIndices, uvBindings)) {
return false;
Expand Down

0 comments on commit cdb9eae

Please sign in to comment.