Skip to content
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

[EMSUSD-1276] Relative paths are not retained in mayaUsdProxyShape.filePath attributes #3751

Open
jufrantz opened this issue May 6, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@jufrantz
Copy link
Contributor

jufrantz commented May 6, 2024

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
  1. 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()
  1. 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")
  1. 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.

@jufrantz jufrantz added the bug Something isn't working label May 6, 2024
@wallworm
Copy link
Collaborator

wallworm commented May 7, 2024

Thank you for reporting this. The team will discuss.

@santosg87 santosg87 changed the title Relative paths are not retained in mayaUsdProxyShape.filePath attributes [EMSUSD-1276] Relative paths are not retained in mayaUsdProxyShape.filePath attributes May 7, 2024
@santosg87
Copy link
Collaborator

logged this issue internally for investigation on possible next steps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants