[EMSUSD-1276] Relative paths are not retained in mayaUsdProxyShape.filePath attributes
- Dominant language
- Wolfram Language
- Stars
- 905
- Forks
- 223
- Avg merge
- 2d 9h
- Merged PRs (30d)
- 17
Description
**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**
```python
from pxr import Sdf
from maya import cmds
```
1. Create an usd file in current working dir
```python
layer = Sdf.Layer.CreateNew("someUsdFileInWorkingDir.usda")
layer.ImportFromString('#usda 1.0\ndef Sphere "sphere" {}\n')
layer.Save()
```
2. Create a proxyShape with the relative path to the file just created
```python
proxyShape = cmds.createNode("mayaUsdProxyShape")
cmds.setAttr(f"{proxyShape}.filePath", "someUsdFileInWorkingDir.usda", type="string")
```
3. Notice that the path is now stored as absolute
```python
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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.