Last active
October 11, 2015 20:37
-
-
Save csaez/3915755 to your computer and use it in GitHub Desktop.
Softimage: A python decorator to wrap an execution into 1 undo level.
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
from functools import wraps | |
def OneUndo(function): | |
@wraps(function) | |
def _decorated(*args, **kwargs): | |
try: | |
Application.BeginUndo() | |
f = function(*args, **kwargs) | |
finally: | |
Application.EndUndo() | |
return f | |
return _decorated |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment