-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MAYA-106486 UDIM Import/Export #883
Conversation
Correctly detect and handle UDIM on import and export.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
// USD did not resolve the path to absolute because the file name was not an | ||
// actual file on disk. We need to find the first tile to help Maya find the | ||
// other ones. | ||
std::string udimPath(filePath.substr(0, udimPos)); | ||
udimPath += "1001"; | ||
udimPath += filePath.substr(udimPos + _tokens->UDIMTag.GetString().size()); | ||
|
||
Usd_Resolver res(&prim.GetPrimIndex()); | ||
for (; res.IsValid(); res.NextLayer()) { | ||
std::string resolvedName | ||
= SdfComputeAssetPathRelativeToLayer(res.GetLayer(), udimPath); | ||
|
||
if (!resolvedName.empty() && !ArIsPackageRelativePath(resolvedName) | ||
&& resolvedName != udimPath) { | ||
udimPath = resolvedName; | ||
break; | ||
} | ||
} | ||
val = SdfAssetPath(udimPath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As of USD 20.08, there's a UsdImaging_ResolveMaterialParamValue()
utility that might be useful here:
https://github.com/PixarAnimationStudios/USD/blob/71b4baace2044ea4400ba802e91667f9ebe342f0/pxr/usdImaging/usdImaging/materialParamUtils.h#L45
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would love to use that function, but it is currently private:
https://github.com/PixarAnimationStudios/USD/blob/dev/pxr/usdImaging/usdImaging/CMakeLists.txt#L68
Maybe in the next version?
Correctly detect and handle UDIM on import and export.