[EMSUSD-1276] Relative paths are not retained in mayaUsdProxyShape.filePath attributes
jufrantz opened this issue · 2 comments
Describe the bug
Since maya-usd v0.27, when creating a mayaUsdProxyShape
given a relative path to an existing usd file, the filePath
attribute's value now encodes the current absolute path of the file, the current working directory is baked in the maya scene file.
Prior to v0.27, the relative path remained as such and was resolved later during the proxyShape's compute. Internally, the USD resolver had the capability to resolve it in the working directory (or in other search paths).
This new behaviour is problematic for us as we need to resolve usd files from maya scenes dynamically - as with USD default resolver - for our asset management needs.
Steps to reproduce
from pxr import Sdf
from maya import cmds
- Create an usd file in current working dir
layer = Sdf.Layer.CreateNew("someUsdFileInWorkingDir.usda")
layer.ImportFromString('#usda 1.0\ndef Sphere "sphere" {}\n')
layer.Save()
- Create a proxyShape with the relative path to the file just created
proxyShape = cmds.createNode("mayaUsdProxyShape")
cmds.setAttr(f"{proxyShape}.filePath", "someUsdFileInWorkingDir.usda", type="string")
- Notice that the path is now stored as absolute
cmds.getAttr(f"{proxyShape}.filePath")
# Result: /home/frantzy/someUsdFileInWorkingDir.usda
Specs (if applicable):
- Maya 2023
- maya-usd 0.27.0
Additional context
The issue is very likely due to changes from #3482. Since the filePath
attribute is flagged usedAsFileName
, this affects behaviour of setAttr
.
In our pipeline, we typically rely on environment variables for similar cases, eg file.filteTextureName
set to $WORKSPACE_DIR/someImage.exr
. Env var substitutions is not yet supported by mayaUsdProxyShape, but the approach could work also for us in this context.
Thank you for reporting this. The team will discuss.
logged this issue internally for investigation on possible next steps.