Search code examples
pythonmayamelpymel

Detect when a keyframe is set on an attribute in Maya?


I'm trying to trigger a script to run when a keyframe is set in Maya. I'm currently using scriptJob's to trigger scripts on the timeChanged event and when certain attributes change, but I've not found an event for when a keyframe is set.

Is there a way to detect when a keyframe is set in maya and trigger a script to run when this happens?


Solution

  • You can relay on MAnimMessage Docs .This callback can help you to find the keyframe action and plug a callback eg :

    OpenMayaAnim.MAnimMessage.addAnimKeyframeEditedCallback( obj.addKeyframeDelta, None)