Get View Type in Current View Port
DraagonStorm
Posts: 748
Not even sure if that's the right wording...
How would I get what is selected in the drop down for how the scene looks in the view port.. And possibly set it to something else.
Capture.JPG
290 x 227 - 19K
Comments
I'm from the C++ plugin side, but it should go something like:
mainWindow = dzApp->getMainWindow()
viewportMgr = mainWindow->getViewportMgr()
viewport = viewportMgr->getActiveViewport()
3dviewport = viewport->get3DViewport()
shadestyle = 3dviewport->getShadeStyle();
That should give you a value inside the ShadeStyle enum { WireBox, SolidBox, Wireframe, LitWireframe, HiddenLine, WireShaded, SmoothShaded, WireTextured, Textured };
(naturally, you'll want to check for null values in each along the way to make sure you don't crash your script)
There's also a 'setShadeStyle(ShadeStyle x)' method in Dz3DViewport, so you should be able to set it with that. Might have to update the actual control, but you'll have to fiddle through the UI layout stuff to reach it.
Thanks.. That helped... shadestyle was what I didn't know to be able to find it :)
I think you'd need to query Dz3DViewport.shaderStyle, which is an enumerated value. It's a variable so I assume setting it to a new value would update it.
Thanks Richard
Where is the documentation shaderStyle, I can't find it. :(
Nevermind I found it
So, I'm able to get the shaderStyle................ But... There are duplicates???????
Texture Shaded & Cartoon Shaded are both 8, and Smooth Shaded & NVIDIA Iray are both 6
The thing is I need to check to see if it is set to NVIDIA Iray, and if it is, either warn the user, or temporarilly change it to Texture Shaded while I'm doing some OpenGL renders.
Any ideas?????
I wonder if it has something to do with Cartoon Shaded and NVIDIA Iray are not one of the Documented Enumerations
Scripting > API Reference > Samples > Specific Interface > Active Viewport DrawStyle
-Rob
You are a mega star!!! Thank you
DraagonStorm, maybe you need in this common code to change vusualization mode in viewport? In my comment - other actions for different mode