Last active
May 9, 2023 07:38
-
-
Save AndrewHazelden/5f59050155c3159c2185 to your computer and use it in GitHub Desktop.
A python script to check if Maya is running in Batch mode or with a GUI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Check if Maya is running in Batch mode or with a GUI | |
# A return value of 1 means Batch Mode, 0 means GUI mode | |
def checkMayaGuiBatchMode(): | |
""" | |
Maya tip on detecting Maya Batch mode is from Michael Scarpa's blog post "MEL Sillyness": | |
http://www.scarpa.name/2010/12/16/mel-sillyness/ | |
""" | |
# Check if Maya is running in batch mode or with a GUI | |
import maya.OpenMaya | |
isMayaInBatchMode = maya.OpenMaya.MGlobal.mayaState() == maya.OpenMaya.MGlobal.kBatch | |
return isMayaInBatchMode; | |
# Check if Maya is running in Batch mode or with a GUI | |
# 1 means Batch Mode, 0 means GUI mode | |
isMayaInBatchMode = checkMayaGuiBatchMode() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a lot!