Skip to content

Commit

Permalink
Merge pull request #3693 from Autodesk/gamaj/LOOKDEVX-2358/show_relat…
Browse files Browse the repository at this point in the history
…ive_on_non_existent_shader_attribute

LOOKDEVX-2358 - Fix image file attribute detection
  • Loading branch information
seando-adsk authored Apr 8, 2024
2 parents 71d9c51 + e964cc3 commit 3110b6a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/mayaUsd/resources/ae/usdschemabase/ae_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -963,6 +963,10 @@ def isImageAttribute(self, attrName):
kFilenameAttr = ufe.Attribute.kFilename if hasattr(ufe.Attribute, "kFilename") else 'Filename'
if self.attrS.attributeType(attrName) != kFilenameAttr:
return False
shader = UsdShade.Shader(self.prim)
if shader and attrName.startswith("inputs:"):
# Shader attribute. The actual USD Attribute might not exist yet.
return True
attr = self.prim.GetAttribute(attrName)
if not attr:
return False
Expand Down
10 changes: 10 additions & 0 deletions lib/mayaUsdAPI/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,4 +128,14 @@ bool requireUsdPathsRelativeToEditTargetLayer()
return PXR_NS::UsdMayaUtilFileSystem::requireUsdPathsRelativeToEditTargetLayer();
}

std::string handleAssetPathThatMaybeRelativeToLayer(
std::string fileName,
const std::string& attrName,
const PXR_NS::SdfLayerHandle& layer,
const std::string& optionVarName)
{
return PXR_NS::UsdMayaUtilFileSystem::handleAssetPathThatMaybeRelativeToLayer(
fileName, attrName, layer, optionVarName);
}

} // End of namespace MAYAUSDAPI_NS_DEF
7 changes: 7 additions & 0 deletions lib/mayaUsdAPI/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,13 @@ makePathRelativeTo(const std::string& fileName, const std::string& relativeToDir
MAYAUSD_API_PUBLIC
bool requireUsdPathsRelativeToEditTargetLayer();

MAYAUSD_API_PUBLIC
std::string handleAssetPathThatMaybeRelativeToLayer(
std::string fileName,
const std::string& attrName,
const PXR_NS::SdfLayerHandle& layer,
const std::string& optionVarName);

} // namespace MAYAUSDAPI_NS_DEF

#endif // MAYAUSDAPI_UTILS_H

0 comments on commit 3110b6a

Please sign in to comment.