-
Notifications
You must be signed in to change notification settings - Fork 320
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
Wrap a mtlx document into a nodedef (through API or graphEditor) #1765
Comments
This is a good question, @MatthieuBEAUD, and I'm CC'ing @kwokcb who has done some initial work on adding NodeDef publication methods to the MaterialX API. One related pull request may be found here: |
Hi @MatthieuBEAUD , This line is a bit "strange" in approach node_def.copyContentFrom(doc_in) as you're trying to copy the entire document into a single element. It will embed the document inside but it's has a source reference (adds a
BTW< It's an interesting way to populate a definition from an external whole document source which from what I see should not have any side-effects but is not a well tested scenario. I'm not sure if this fits your workflow but perhaps taking a "libraries" approach is useful ? For example Hope this helps, and is an workflow that would interesting to get more clarification on. |
Hi @kwokcb, Thank you for the explainations.
would remove the nodeDef from the materialX and replace it with the I'll try with the libraries. But would it need to import a NodeDef or I could import any materialX graph ? The workflow would be for the creation of an eye shader with MaterialX. It would be as follows:
So basically, my main concern was to make a materialX graph into a nodeDef. I don't know if there are any plans for MaterialX to have exposable / dynamic parameters (like the inputs of a shader) ? Thank you again for your time ! |
Hi @MatthieuBEAUD , It's great to have this context information. In a nutshell this sounds like dynamic
It's not hard to do this with just Python API as well as I wrote up a utility here which will patch the current API call as needed and also has some logic for content copying. Since the code is not checked in yet. you need to assume
For Maya I'm not sure from your comments if you know there OGSFX shader generator which will produce ogsfx for the viewport rendering. Thus I don't think you have to go this route. I haven't checked the current state of the Anyways the key elements are:
For dynamic parameter exposure, on a nodegraph it's already there by adding input nodes to a graph. For a definition they could be possible but definitions are meant to be statically created once for a definition. In your case you can dynamically change the inputs to expose and rebuild the definition as needed. |
BTW, I wrote a tutorial for definition creation (from graphs or source) here. Maybe overkill but has all the "gory" details (especially for the latter) :). |
Thank you so much for all the documentation and help @kwokcb ! It'll help a lot ! |
No problem. If you need something more interactive and not on them, the ASWF Slack channels have a lot of great folks. |
Hi,
I'm pretty new to the MaterialX API, but I can't seem to find a way to wrap a mtlx into a NodeDef:
In the result the NodeDef disappeared:
I thought I should get:
I also tried having all the nodes of my_material into a NodeGraph, and then using Document.addNodeDefFromGraph but it only set the outputs in the NodeDef, but not the inputs.
How could one wrap the content of a materialX into a NodeDef ?
Could it be possibly done into the graphEditor ?
Thank you
The text was updated successfully, but these errors were encountered: