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-2188 make materialX bindings accessible in Maya #4137

Merged
merged 1 commit into from
Feb 28, 2025

Conversation

pierrebai-adsk
Copy link
Collaborator

@pierrebai-adsk pierrebai-adsk commented Feb 26, 2025

  • Add the path leading to MaterialX to the PYTHONPATH in the MayaUSD Maya plugin module.
  • Add a unit test that imports the MaterialX bindings.
  • Make the unit test dependent on the version of USD
  • Fix problem with GLSL in unit test in Maya 2025 with an extra import.

Copy link
Collaborator

@JGamache-autodesk JGamache-autodesk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do suspect you will have to make this version dependent on USD as these Python bindings are a recent addition to the USD we package with MayaUSD.

@pierrebai-adsk
Copy link
Collaborator Author

pierrebai-adsk commented Feb 26, 2025

@JGamache-autodesk I'm getting errors on older version of MayaUSD. Are they expected? Should the test only be run for Maya 2026 and higher? For example:

    import MaterialX.PyMaterialXGenGlsl as mxgl
11:03:30      ImportError: generic_type: type "GlslShaderGenerator" referenced unknown base type "MaterialX_MayaUSD_v1_38_8::HwShaderGenerator"

On Maya 2022:

import MaterialX as mx
10:59:19      ModuleNotFoundError: No module named 'MaterialX'

@JGamache-autodesk
Copy link
Collaborator

I would expect 2025 and 2026 to work. Before that we did not even compile the MaterialX Python bindings.
The error in 2025 is annoying. I would have expected at least Linux to work. Can you try importing PyMaterialXGenShader before PyMaterialXGenGlsl to see if it helps resolving the base class of GlslShaderGenerator?

@pierrebai-adsk
Copy link
Collaborator Author

I tested on Windows, Maya 2025.3: adding that import fixes the problem.

@pierrebai-adsk pierrebai-adsk removed their assignment Feb 26, 2025
@pierrebai-adsk pierrebai-adsk force-pushed the bailp/EMSUSD-2188/materialx-python-bindings branch from ea50e4d to 185a994 Compare February 26, 2025 18:04
@pierrebai-adsk pierrebai-adsk self-assigned this Feb 26, 2025
@JGamache-autodesk
Copy link
Collaborator

Good!
Maya 2025 has MaterialX 1.38.8, while Maya 2026 has MaterialX 1.38.10-OpenPBR. Main difference is this very important PR AcademySoftwareFoundation/MaterialX#1595 that correctly pre loads dependencies in 1.38.10. Without it you need to manually load dependencies.

- Add the path leading to MaterialX to the PYTHONPATH in the MayaUSD Maya plugin module.
- Make the new python path conditional based on the version of USD.
- Add a unit test that imports the MaterialX bindings.
- Make the unit test dependent on the version of USD
- Fix problem with GLSL in unit test in Maya 2025 with an extra import.
@pierrebai-adsk pierrebai-adsk removed their assignment Feb 27, 2025
@pierrebai-adsk pierrebai-adsk force-pushed the bailp/EMSUSD-2188/materialx-python-bindings branch from 6d31b29 to 4779bed Compare February 27, 2025 13:24
@pierrebai-adsk pierrebai-adsk self-assigned this Feb 27, 2025
@pierrebai-adsk pierrebai-adsk added the ready-for-merge Development process is finished, PR is ready for merge label Feb 27, 2025
@seando-adsk seando-adsk merged commit 1e4a8d9 into dev Feb 28, 2025
11 checks passed
@seando-adsk seando-adsk deleted the bailp/EMSUSD-2188/materialx-python-bindings branch February 28, 2025 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
materials ready-for-merge Development process is finished, PR is ready for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants