Skip to content

Instantly share code, notes, and snippets.

@whoiscarlo
Created October 30, 2014 00:05
Show Gist options
  • Save whoiscarlo/e56279f164ce66005f13 to your computer and use it in GitHub Desktop.
Save whoiscarlo/e56279f164ce66005f13 to your computer and use it in GitHub Desktop.
Maya Python Callback
class Callback(object):
def __init__(self, func, *args, **kwargs):
self.func = func
self.args = args
self.kwargs = kwargs
def __call__(self, *args):
return self.func( *self.args, **self.kwargs )
and this to call it
mc.menuItem(l='Remove set from scene', c=Callback(self.stripObject, obj, member, 1, selButton))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment