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() On 4/08/2014 6:38 PM, "Michael Boon" <[email protected]> wrote: > > > Hi all, > > I'm trying to load a DX11 shader. In the process I have to make sure VP2.0 > is on and the renderer is set to DX11. > editor = panel.getModelEditor() > pm.evalDeferred("pm.runtime.ActivateViewport20()") > renderer = pm.modelEditor(editor, q=True, rendererDeviceName=1) > ActivateViewport20 only works if deferrred, probably because I just > created the panel. > As it is, renderer gets set to an empty string. If I wait a moment (eg if > I run it line by line in the script editor), renderer > returns 'VirtualDeviceDx11' as appropriate. > > So basically, I think I need to defer twice. Once before > ActivateViewwport20, and again between that and getting the > rendererDeviceName. I've tried this: > editor = panel.getModelEditor() > pm.evalDeferred("pm.runtime.ActivateViewport20()") > pm.refresh(force=True) > renderer = pm.modelEditor(editor, q=True, rendererDeviceName=1) > with no luck. I've also tried time.sleep(), but that halts Maya's main > thread, which doesn't help at all. > > Is there a way to give control back to Maya's event loop until it's idle, > with writing a state machine? > > (This is in Maya 2015.) > > Thanks, > > Boon > > -- > 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 [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/221422dd-df4e-40ae-9f98-cef8cc501f1c%40googlegroups.com > <https://groups.google.com/d/msgid/python_inside_maya/221422dd-df4e-40ae-9f98-cef8cc501f1c%40googlegroups.com?utm_medium=email&utm_source=footer> > . > 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA1hB4xSfnAxx-rMgmesOvOJ9exDTmuRCUMSrLXLOSFHQA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
