Maya python or mel command

Forums: Maya python or mel command
Autodesk Maya (Plugin developed by JimStar)

Moderator: JimStar

Maya python or mel command

Postby ptunstall » Sat Sep 26, 2020 8:41 pm

ptunstall Sat Sep 26, 2020 8:41 pm
Until MaterialX is fully integrated, I am messing around with the localDb and using it to do a surfacing publish for assets. What I am trying to automate is the shader publishing (assignments and shaders) via script so I can then import it into our existing Houdini/Octane pipeline. The assignment part should be simple enough, but it's the shader export that I would love some guidance on. I have found the "octane -sdb octaneDiffuseMaterial" which brings up the dialog where I can tell it location, category. etc. Is there a singe command (python preferred) to export the shader to the correct location, with the settings I want as flags? That way I don't have to rely on a GUI.
ptunstall
Licensed Customer
Licensed Customer
 
Posts: 152
Joined: Thu Jun 04, 2015 1:36 am

Re: Maya python or mel command

Postby JimStar » Sat Sep 26, 2020 11:19 pm

JimStar Sat Sep 26, 2020 11:19 pm
What you get with "octane -sdb octaneDiffuseMaterial" is is not a plugin-level functionality, the plugin just uses Octane API to store by its "-sdb" command. And this Octane API does not have any parameters - it just opens the UI dialog you see.
You need to ask the standalone team about that, maybe they could implement what you need (the headless export) on the API level for plugins...

But I'm not sure that this is what you need. Because even if you export some material to LiveDB, importing it later back will be creating a new material nodes-tree and assign it to some objects, so the previously assigned tree will need to be deleted - otherwise you'll be collecting unused garbage with every import.
I'm actually not sure that you are trying to reach you goal the right way. IMHO you could just write some complex Python export script in Maya that uses standard Maya's Python API to store the nodes with their attributes' values into some ASCII file. This is nothing to do with Octane or any other plugin - this is a standard Maya feature, you can do this for any shaders, not just for Octane. You can open any Maya's .MA scene file (which is ASCII) in a text editor and see how Maya stores its shader nodes and their attributes. And then you can read your file by other Python script in Houdini and create these Houdini nodes assigning their attributes with values stored in this exported file...
But be prepared to write a big complex Python script, that knows all the node-types and their attribute-names in both Maya and Houdini and knows how to match them to each other... Doable, but it's a big task for your Python coders...
User avatar
JimStar
OctaneRender Team
OctaneRender Team
 
Posts: 3781
Joined: Thu Jul 28, 2011 8:19 pm
Location: Auckland, New Zealand

Re: Maya python or mel command

Postby ptunstall » Sun Sep 27, 2020 1:40 pm

ptunstall Sun Sep 27, 2020 1:40 pm
Well that is disappointing. I figured I could write a complex python script to handle all of this, but isn't that essentially a large part of what materialX trying to alleviate? If I was able to use the localDB function, via command line, that would negate having to write a bunch of the complex shader reconstruction in python. The liveDB orbx's get unpacked into already connected shader node networks in the DCC's (via the liveDB), so all I would have to write/manage in python is the shader assignments to geometry. To me, this approach was the fastest way to get what I needed without having to write an overly complex shader reconstruction script.
ptunstall
Licensed Customer
Licensed Customer
 
Posts: 152
Joined: Thu Jun 04, 2015 1:36 am

Re: Maya python or mel command

Postby JimStar » Sun Sep 27, 2020 10:24 pm

JimStar Sun Sep 27, 2020 10:24 pm
Sorry, I don't know what is MaterialX - I've not been given any info about that. Hear this term for the first time from you.
Just to clarify: the LiveDB does not get unpacked into already connected shader node networks. It creates a new shader network and connects it to selected geometries. This is what I wrote here about possibly garbage (unused nodes) remaining that would need to be collected after each re-import of different shaders.

But as I told you here - you still could use LiveDB if the headless export API for that was implemented by Standalone SDK. If this API was available, I could do some improvements to "octane -sdb" command in Maya to use that API, in which case you could export shaders by some script without being forced to interact with the UI window opened every time...
So, as I wrote here regarding this: You need to ask the standalone team about that, maybe they could implement what you need (the headless export) on the API level for plugins...
User avatar
JimStar
OctaneRender Team
OctaneRender Team
 
Posts: 3781
Joined: Thu Jul 28, 2011 8:19 pm
Location: Auckland, New Zealand

Re: Maya python or mel command

Postby ptunstall » Mon Sep 28, 2020 3:50 am

ptunstall Mon Sep 28, 2020 3:50 am
I have made an attempt to contact the standalone team. I'll keep you posted.
ptunstall
Licensed Customer
Licensed Customer
 
Posts: 152
Joined: Thu Jun 04, 2015 1:36 am

Re: Maya python or mel command

Postby Goldorak » Mon Sep 28, 2020 4:24 pm

Goldorak Mon Sep 28, 2020 4:24 pm
ptunstall wrote:I have made an attempt to contact the standalone team. I'll keep you posted.


Can you post this int be feature requests system so the whole team can follow and track? Thanks!
User avatar
Goldorak
OctaneRender Team
OctaneRender Team
 
Posts: 2321
Joined: Sun Apr 22, 2012 8:09 pm

Re: Maya python or mel command

Postby ptunstall » Tue Sep 29, 2020 1:43 pm

ptunstall Tue Sep 29, 2020 1:43 pm
I believe I submitted it to the correct location.
ptunstall
Licensed Customer
Licensed Customer
 
Posts: 152
Joined: Thu Jun 04, 2015 1:36 am

Return to Autodesk Maya


Who is online

Users browsing this forum: No registered users and 7 guests

Thu Apr 18, 2024 3:15 pm [ UTC ]