The cmds equivalent of MEventMessage is
cmds.scriptJob(event='idle', fn)
I haven't used it for a very long time but I think the fn might need to be
a string representing MEL code.
Or you might be better off with evalDeferred:
cmds.evalDeferrred('print "a"')
cmds.evalDeferrred('print "b"', lowPriority=True)
cmds.evalDeferrred('print "c"', lowestPriority=True)
None of this is exactly what you want, I know. I looked into it briefly
last year and didn't see any simple way to do it.
On Wednesday, 31 May 2017 07:56:09 UTC+10, likage wrote:
>
> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/d30f3e5d-f251-4bcc-bf76-d1ae083ba1f3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.