Is there any callback for Maya autoKeyframe function?


I want to trigger a function when maya auto keyframe. Is there any callback for Maya autoKeyframe function?

I know the scriptjob and MAnimMessage class. But a question is that they only provides events when keys are edited. But you won’t knew whether the key is modified, deleted, or added. And you won’t know the key is changed/added by setkeyframe or autokeyframe.

Is there any way for those information?


I’m not 100% sure on this, but I do not believe there is a callback specifically centered around auto hotkey.

What exactly are you hoping to accomplish with that information though? There might be a non-callback related way to solve the issue.


The OpenMayaAnim.MAnimMessage should support this I think:

addAnimKeyframeEditCheckCallback ()
addAnimKeyframeEditedCallback ()
addDisableImplicitControlCallback ()
addNodeAnimKeyframeEditedCallback ()
addPostBakeResultsCallback ()
addPreBakeResultsCallback ()
flushAnimKeyframeEditedCallbacks ()


addAnimCurveEditedCallback(function, clientData=None) -> id

This method registers a callback that is called whenever an
AnimCurve is edited.

  • function - callable which will be passed a MObjectArray object containing
    an array of AnimCurves which have been edited, and the clientData object
  • clientData - User defined data passed to the callback function
  • return: Identifier used for removing the callback.

Your calling the callback on a function curve.

I agree with @bob.w - what are you looking to do? - Callbacks can be quite tricky things to deal with especially unregistering them correctly.