Last active
October 5, 2022 15:23
-
-
Save hogjonny/5832309 to your computer and use it in GitHub Desktop.
maya, check for 'unsaved changes', if there are ... save before proceeding:
This file contains hidden or 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
import maya.cmds as mc | |
# check if there are unsaved changes | |
fileCheckState = mc.file(q=True, modified=True) | |
# if there are, save them first ... then we can proceed | |
if fileCheckState: | |
print 'Need to save.' | |
# This is maya's native call to save, with dialogs, etc. | |
# No need to write your own. | |
mc.SaveScene() | |
pass | |
else: | |
print 'No new changes, proceed." | |
pass |
You have a ' and " on line 14.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for this! Saved me 10 minutes of scratching my head looking for the commands!