I should have posted my code, here goes:

def set_vp2_settings():
    cmds.setAttr('hardwareRenderingGlobals.vertexAnimationCache', 2)
    cmds.setAttr('hardwareRenderingGlobals.hwInstancing', 1)
    cmds.setAttr('hardwareRenderingGlobals.threadDGEvaluation', 1)
    cmds.setAttr('hardwareRenderingGlobals.maxHardwareLights', 1)
    cmds.setAttr('hardwareRenderingGlobals.transparencyAlgorithm', 0)

def main():
    # Apply viewport 2.0 settings
    print 'Apply custim settings for Viewport 2.0'
    set_vp2_settings()
    # Disabling viewport
    #mel.eval("paneLayout -e -manage false $gMainPane")


    # Switch to Viewport 2.0
    print 'Switching to use Viewport 2.0'
    mel.eval('ActivateViewport20;')
    
    # Enable back viewport
    #mel.eval("paneLayout -e -manage true $gMainPane")
    print 'Done!'


main()



When I am running the code, it will print out all the print statements 
including the last one - Done!, but as soon as the last print statement is 
done, it is then I will be seeing 'Viewport2.0 Processing' on the bottom 
lefthand corner, which may take about a min to 2.
I tried disabling and re-enabling the viewport, still, viewport 2.0 only 
seems to get processed after the whole code execution.

In my main() function, I am expecting the `mel.eval('ActivateViewport20;')` 
to finish the processing before it prints the `Done!` statement, and hence 
I am asking about 'catching' ot..

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/5485a235-6fd0-43e3-90c0-ee6919b4f38c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to