Autodesk / Autodesk/maya-usd

mayaUsdProxyShape.filePath missing when querying external file dependencies

Open
#2,602 1 comment 0 reactions 1 assignee Claimed by @santosg87 View on GitHub
bug
Dominant language
Wolfram Language
Stars
905
Forks
223
Avg merge
2d 9h
Merged PRs (30d)
17

Description

**Describe the bug**
The mayaUsdProxyShape has an attribute to refer to a file on-disk however that path is not attribute / attribute value is not discoverable via the Maya API, that I can see right now.

**Steps to reproduce**
Run this script

```python
import tempfile

from maya import cmds
from pxr import Sdf

def _get_all_external_files():
output = set()

directories = cmds.filePathEditor(query=True, listDirectories="", unresolved=True) or []

for directory in directories:
output.update(
cmds.filePathEditor(
query=True,
listFiles=directory,
withAttribute=False,
unresolved=True,
) or []
)

return output

_, path = tempfile.mkstemp(suffix="_some_path.usda")
layer = Sdf.Layer.CreateNew(path)
Sdf.CreatePrimInLayer(layer, "/root")
layer.Save()
node = cmds.createNode("mayaUsdProxyShape")
cmds.setAttr("{node}.filePath".format(node=node), layer.realPath, type="string")
print("external files", layer.realPath in _get_all_external_files())
print("file path attributes", cmds.listAttr(node, usedAsFilename=True))
print("known, used files in the maya scene", layer.realPath in cmds.file(list=True, q=True))
```

Note that:

- the `filePath` attribute's text from the created mayaUsdProxyShape is not listed out of `_get_all_external_files()`
- `cmds.listAttr(node, usedAsFilename=True)` returns `[u'templatePath', u'iconName']`, which is missing the expected `u'filePath'`
- `cmds.file(list=True, q=True)` does not detect the Sdf Layer path (this may be intended behavior, just figured I'd point it out in case. The other two points are bugs though)

**Expected behavior**
- `_get_all_external_files()` should include the created `tempfile.mkstemp` path in its returned set
- `cmds.listAttr(node, usedAsFilename=True)` should contain `u'filePath'` as a returned value
- (maybe) `cmds.file(list=True, q=True)` would contain the same `tempfile.mkstemp` path as `_get_all_external_files()`

**Specs (if applicable):**
- OS & version: CentOS Linux release 7.9.2009 (Core)
- Compiler & version: 9.3.1
- Maya version: 2022.4.1
- Maya USD commit SHA: 0fbed565b9fae9685f0a6553f3f30135b512463b (v0.12.0)
- Pixar USD commit SHA: [7a5f8c4311fed3ef2271d5e4b51025fb0f513730](https://github.com/PixarAnimationStudios/USD/commit/7a5f8c4311fed3ef2271d5e4b51025fb0f513730) (v21.08)

**Additional context**
Since we're a few versions behind maya-usd's latest release, if you are aware of any changes to the Maya attributes in the plug-in, we can try upgrading to the latest maya-usd if you think that will fix the issue.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.