Skip to content

Instantly share code, notes, and snippets.

@csaez
Last active October 11, 2015 20:37
Show Gist options
  • Save csaez/3915755 to your computer and use it in GitHub Desktop.
Save csaez/3915755 to your computer and use it in GitHub Desktop.
Softimage: A python decorator to wrap an execution into 1 undo level.
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