Script Iray Draw Settings?
omnifreaker
Posts: 71
Hello--
Is it possible to change Iray Draw Settings via script (not to be confused with Render settings)? Or better yet, is there a way to create and apply an iray draw settings preset? For example, I would like to change Draw Settings->Drawing->Draw Mode from Photoreal to interactive via script
Thanks!
Comments
It is possible by using the Pane Manager, find the pane named "DrawSettings", once you have the pane, grab the Element Editor, which contains the "NVIDIA Iray Draw Options" which is a DzDrawStylePropertyHolder. Although it only works if current draw style is Iray. to change that you need to access the MainWindow.getViewportMgr().getActiveViewport().get3DViewport()
HTH
It looks like that works. Thanks!
Hey,
Curious how'd you manage to get this working as it's something I was trying to do also. I cylced thru all the draw styles, seeing what Get n Set's were available, as I couldnt find any mention of DzDrawSettingsPane in the object Index tho I can get the object and get the element editor for "NVIDIA Iray Draw Options" I couldnt seem to see means of setting the draw mode, even tho I have switched to the Nvidia draw style. Couldnt find much on the mentioned DzDrawStylePropertyHolder, sorry I am a bit of a noob with scripting, care to share where I am going wrong?
Daz Studio Scripting API documentation is a work in progress, so Object Index contains a list of the most important classes. Even if you see a class listed, it is not fully documented as DS is under constant development, so the classes mentioned before are undocumented, what most developers do is inspect the objects to reveal the most up to date exposed interface.
You can inspect objects by using the familiar "for(var name in objToDump) { print(name); }" code snippet.
Another source of documentation is the ChangeLog. There you can see that the upcoming 4.11 version exposes the following draw style modes:
DzPickStyle, DzDefaultStyle, DzUnshadedStyle, DzUserDrawStyle, DzWireBoxStyle, DzSolidBoxStyle, DzWireFrameStyle, DzLitWireFrameStyle, DzHiddenLineStyle, DzWireShadedStyle, DzSmoothShadedStyle, DzWireTexturedStyle, DzTexturedStyle, DzIrayDrawStyle, DzUserDrawStyleAction.
As for the question, to change DrawStyle you need either the DrawSettingsPane or invoke any othe following actions:
Look here for a sample to invoke an action.
HTH
Sasqwatch--not sure if this answers your question but I am setting DrawStyle like so:
I also like "Object.keys(objToDump);"
It looks like I spoke too soon. this only works if the DrawSettings Pane has been opened during your current session. If DrawSettings is not part of your layout (not visible), fresh launch of DS, this will ERROR:
Once you open the DrawSettings pane, it will work.
The $5mil question...how can I get this to work in one go if the pane has never been opened?
Hey Honourable Omni & jag11
Thanks!
I have found this does the trick to flick between Draw settings Draw mode between interactive & PhotoReal, it's a wee bit of a barbaric mash up between my last code & jag11's suggestions (AFAK it doesn't need the for to go thru nDrawStyles to set to Iray draw style, sure there must be a more elegant way, I just used the samples from Docs page...but as the old programmer adage goes..."works for me!")
Omni I dont know if this would be exactly what you are looking for because I am making the presumption that the draw settings pane is always open and present in a session. I aint so au fait with Daz API, but surely there must be a way to invoke and startup the pane or at least instantiate the object without drawing the pane (Tho Jag11's suggestion is only means is to use the findpane method..so...hurrrum..that poses a tough question....no pun intended =D)
Need to get me those tutorials by Winterbrose, tho they seem to be right from starter level...I used to be a coder in games industry..but man I couldnt keep up and as you both know each API has it's idiosyncrasies, now I am "Senior Technical Producer" that means
Senior = Old guy
Technical = Used to be a programmer
Producer = Can't program anymore, schedules other programmers work
=D
Omnifreak, I heavily modified your code, now it works as it should without first open the Draw Settings Pane. Let me know if it works for you.
Working so far. Thanks!