Problem:
Run Time Command “ToggleFullScreenMode” must be executed at the beginning of the script.
But, in fact, this command is always executed most recently.
Various tricks with “eval” and “time.sleep” do not help to solve the problem …
At the same time, the “refresh” and “viewFit” commands are executed correctly and in a timely manner.
Any ideas?
MEL:
...
if (!`optionVar -q "workspacesInFullScreenUIMode"`)
{
showWindow MayaWindow ;
setFocus "MayaWindow" ;
setFocus "modelPanel4" ;
evalDeferred -en "ToggleFullScreenMode" ;
viewFit -all -an 1 -p "modelPanel4" ;
refresh -cv -f ;
}
...
OR
Python:
import maya.cmds as cmds
...
if cmds.optionVar(q = "workspacesInFullScreenUIMode") == 0:
cmds.showWindow('MayaWindow')
cmds.setFocus('MayaWindow')
cmds.setFocus('modelPanel4')
cmds.evalDeferred('mel.eval(\'ToggleFullScreenMode\')', en = True)
cmds.viewFit(all = True, an = 1, p = "modelPanel4")
cmds.refresh(currentView = True, force = True)
...