This commit is contained in:
2025-04-17 04:52:48 +08:00
commit 9985b73dc1
3708 changed files with 2387532 additions and 0 deletions

View File

@ -0,0 +1,17 @@
from functools import wraps
import maya.cmds as cmds
def mayaUndoRun(func):
""" Puts the wrapped `func` into a single Maya Undo action, then
undoes it when the function enters the finally: block """
@wraps(func)
def _undofunc(*args, **kwargs):
try:
# start an undo chunk
cmds.undoInfo(openChunk=True)
return func(*args, **kwargs)
finally:
# after calling the func, end the undo chunk
cmds.undoInfo(closeChunk=True)
return _undofunc