Created
August 31, 2024 07:55
-
-
Save justsh/59d064840cae7ee0bc35a69803580daf to your computer and use it in GitHub Desktop.
Only execute the given (deferred) command in Interactive mode. Based on pymel.mayautils.executeDeferred
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.utils | |
| import maya.OpenMaya | |
| def deferOnlyInteractive(func, *args, **kwargs): | |
| if maya.OpenMaya.MGlobal.mayaState() == maya.OpenMaya.MGlobal.kInteractive: | |
| maya.utils.executeDeferred(func, *args, **kwargs) | |
| else: | |
| print("Execution of interactive function {0} was skipped in non-interactive mode" | |
| "".format(func.__name__)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment