This MEL line in Python


#1

Hi everyone !

I have a really simple question, I have this line of MEL script who check if the ArnoldRenderView si open and I want it in Python please :

workspaceControl -q -vis “ArnoldRenderView”; #Return 0 if closed, return 1 if open

So I tried to translate it in python but I didn’t found the correct way :

cmds.workspaceControl(q=True, vis=“ArnoldRenderView”)

Can you help me please ?
Thank you !


#2

The mel command is a little bit misleading. The argument “vis” is not a string but a boolean and the “ArnoldRenderView” string is the name of the control to be examined. So the python command should look like this:


cmds.workspaceControl("ArnoldRenderView", q=True, v=True)

Keep in mind that the command will throw an exception if the ArnoldRenderView was not yet opended after starting maya to catch this you can do a try/except structure.