editor = panel.getModelEditor()
pm.evalDeferred("pm.runtime.ActivateViewport20()")
renderer = pm.modelEditor(editor, q=True, rendererDeviceName=1) editor = panel.getModelEditor()
pm.evalDeferred("pm.runtime.ActivateViewport20()")
pm.refresh(force=True)
renderer = pm.modelEditor(editor, q=True, rendererDeviceName=1)Untested, but have you checked if the refresh command helps to flush the event queue?
http://download.autodesk.com/global/docs/maya2012/en_us/CommandsPython/refresh.html
Otherwise I am pretty sure using the qt processEvents() call would work:
from PySide import QtGui
QtGui.qApp.processEvents()
--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/221422dd-df4e-40ae-9f98-cef8cc501f1c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
def doMyThang(): pm.runtime.ActivateViewport20()
renderer = pm.modelEditor(editor, q=True, rendererDeviceName=1)
If that doesn't work, you can try breaking it up into two parts:editor = panel.getModelEditor() pm.evalDeferred(doMyThang)
def part1(): pm.runtime.ActivateViewport20() pm.evalDeferred(part2) def part2():
renderer = pm.modelEditor(editor, q=True, rendererDeviceName=1)
Of course, this means you won't back the answer to what the renderer is in the original context - but if processing of idle events is required first, it might make sense to design things so that it puts things in an intermediate state, and then "updates" once it can get access to the "right" answer.editor = panel.getModelEditor() pm.evalDeferred(part1)
pm.evalDeferred("print 'this should print first'")
maya.utils.processIdleEvents()
print 'this should print second'renderer = pm.modelEditor(editor, q=True, rendererDeviceName=1)>> email to python_inside_maya+unsub...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/python_inside_maya/221422dd-df4e-40ae-9f98-cef8cc501f1c%40googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
> --
> 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+unsub...@googlegroups.com.
editor = panel.getModelEditor()
pm.runtime.ActivateViewport20()
pm.modelEditor(editor, e=True, rendererName="vp2Renderer")
pm.refresh()
renderer = pm.modelEditor(editor, q=True, rendererDeviceName=1)
if renderer != 'VirtualDeviceDx11':
# Complain...