I'm able to use custom mtlx VEX nodes and preview their output in Karma after running mtlx2HDA.py and mtlx2Karma.py (see this thread [www.sidefx.com])
But when I go to export a mtlx file from the vex graph (right click node -> Save -> MaterialX) I get a python error that it cannot find my custom node def.
If I manually drop my mtlx files that include the node def into the standard houdini library (C:\Program Files\Side Effects Software\Houdini 19.0.589\houdini\materialx) they will export as expected.
We'd rather pull in the node def mtlx files from a user package, so that we don't have to modify the houdini install directory.
We have a folder that gets pulled in as a user package (added to the houdini_path in C:\Users\<user>\Documents\houdini19.0\packages\myPackage.json) Houdini will automatically find a subfolder called "materialX" inside of our package folder, and it adds it to the environment variable MATERIALX_SEARCH_PATH, I confirmed this by running hou.getenv('MATERIALX_SEARCH_PATH') in the python console after Houdini starts up. If I understand how materialx is supposed to work, this SHOULD be enough to let houdini's materialx implementation find our node def mtlx files.
Does Houdini support using the MATERIALX_SEARCH_PATH for extending the standard library?
How to extend the MaterialX standard library?
2720 2 2- spencer_luebbert
- Member
- 9 posts
- Joined: April 2021
- Offline
- StefanA
- Member
- 56 posts
- Joined: Oct. 2019
- Offline
- rafal
- Staff
- 1455 posts
- Joined: July 2005
- Offline
The Save > MaterialX menu entry is defined in `$HH/OPmenu.xml`. Basically, it runs `vop2mtlx.saveShaderNetwork()` from `vop2mtlx.py`.
Looking at it, it seems like `_standardLibrariesDoc()` uses `DEFAULT_LIBRARY_PATH` which is set to Houdini's installation path. So it does not appear like it's straight forward to spcify own library path.
But you could write own version of `saveShaderNetwork()` that passes a library path (directories can be separated with semicolons). Ie, write own python function, import vop2mtls to access VOPCOnverter and pass the library path to it. The rest of the code will be the same as in `saveShaderNetwork()`.
You can then create own custom entry in `OPmenu.xml` and call your function.
Looking at it, it seems like `_standardLibrariesDoc()` uses `DEFAULT_LIBRARY_PATH` which is set to Houdini's installation path. So it does not appear like it's straight forward to spcify own library path.
But you could write own version of `saveShaderNetwork()` that passes a library path (directories can be separated with semicolons). Ie, write own python function, import vop2mtls to access VOPCOnverter and pass the library path to it. The rest of the code will be the same as in `saveShaderNetwork()`.
You can then create own custom entry in `OPmenu.xml` and call your function.
-
- Quick Links