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

mayaUsdExport wrongly translates file texture names with envvar expansions. #3766

Closed
jufrantz opened this issue May 15, 2024 · 0 comments · Fixed by #3769
Closed

mayaUsdExport wrongly translates file texture names with envvar expansions. #3766

jufrantz opened this issue May 15, 2024 · 0 comments · Fixed by #3769
Assignees
Labels
bug Something isn't working

Comments

@jufrantz
Copy link
Contributor

Describe the bug

We use environment variables expansion in file texture paths for asset management needs. This is supported by maya file node but not by maya-usd export, which results in invalid usd asset paths.

Steps to reproduce

import os
from maya import cmds
from pxr import Usd, UsdShade
cmds.loadPlugin("mayaUsdPlugin", quiet=True)
  1. Prepare environment and open scene from mayaUSDExport_file_envvar_expansion.zip
MY_TEST_DIR = "/path/to/issue_files/mayaUSDExport_file_envvar_expansion"
os.environ["MY_TEST_DIR"] = MY_TEST_DIR
cmds.file(os.path.join(MY_TEST_DIR, "scene.ma"), open=True, force=True)
  1. It reads a texture file with MY_TEST_DIR expansion, this is supported by file node
maya.cmds.getAttr("file1.ftn")
# Result: $MY_TEST_DIR/images/grid.png
  1. Export it
outStage = Usd.Stage.CreateInMemory()
cmds.mayaUSDExport(file=outStage.GetRootLayer().identifier)
  1. Notice that the file path was wrongly translated
UsdShade.Shader.Get(outStage, "/pPlane1/mtl/lambert2SG/file1").GetInput("file").Get()
# Result: Sdf.AssetPath('/path/to/issue_files/mayaUSDExport_file_envvar_expansion/$MY_TEST_DIR/images/grid.png')

Expected behavior

mayaUSDExport should produce an asset path that is valid for USD's default resolver.

Specs (if applicable):

  • CentOS 7.8
  • Maya 2023.3
  • maya-usd 0.27.0
  • USD 23.11
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

Successfully merging a pull request may close this issue.

2 participants