Another way, if I remember correctly without being at a computer, is to just
see if the main window evals:
mainWin = maya.mel.eval("$temp1=$gMainWindow")
If mainWin is blank then you are not in a gui. You can also do it with the api,
to get a main window ref. but I dont have the docs in front of me.
On Aug 21, 2012, at 12:09 AM, Chad Dombrova <[email protected]> wrote:
> there is also maya.OpenMaya.MGlobal.mayaState() which provides even more
> granular info. it will return kInteractive in GUI, kLibraryApp in mayapy
> (after maya has been initialized), and kBatch in batch mode (i.e maya -prompt
> or maya -batch). you have to be careful about the second one though, because
> in mayapy it will return kInteractive before maya has been initialized.
>
> -chad
>
> --
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings:
> http://groups.google.com/group/python_inside_maya/subscribe
--
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings:
http://groups.google.com/group/python_inside_maya/subscribe