Get View Type in Current View Port

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

  • hphoenixhphoenix Posts: 1,335
    edited March 2016

    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.

     

    Post edited by hphoenix on
  • 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.

  • DraagonStormDraagonStorm Posts: 748
    edited March 2016

    Thanks Richard

     

    Post edited by DraagonStorm on
  • DraagonStormDraagonStorm Posts: 748
    edited March 2016

    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.

    Where is the documentation shaderStyle, I can't find it. :(

    Nevermind I found it

    Post edited by DraagonStorm on
  • DraagonStormDraagonStorm Posts: 748
    edited March 2016

    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 frown

     

    Post edited by DraagonStorm on
  • You are a mega star!!! Thank you

  • YudinEdYudinEd Posts: 90

     DraagonStorm, maybe you need in this common code to change vusualization mode in viewport? In my comment - other actions for different mode 

    var mgr = MainWindow.getActionMgr();

    func = mgr.findAction( "DzTexturedStyleAction" )

    if( !func )

    {

    return;

    }

    func.trigger();

     

    //DzWireShadedStyleAction,DzWireTexturedStyleAction,DzWireBoxStyleAction.... - other actions for visual mode in Viewport

Sign In or Register to comment.