Why doesn't MDagMessage.addMatrixModifiedCallback trigger when rotating the pivot in Maya?

Hi everyone,

I’m working with Maya’s Python API and trying to monitor changes to an object’s pivot—specifically when the user rotates the pivot using the manipulator.

Here’s the setup I currently have:

from maya import cmds
from maya.api import OpenMaya as om2

index = -1

def update(mobject, flags, clientData):
    if flags & (om2.MDagMessage.kScalePivot | om2.MDagMessage.kRotatePivot):
        print(cmds.manipPivot(q=True, o=True)[0])

def main():
    global index
    node    = om2.MGlobal.getSelectionListByName('pCube1').getDependNode(0) 
    dagPath = om2.MDagPath.getAPathTo(node)
    index   = om2.MDagMessage.addMatrixModifiedCallback(dagPath, update, None)

if __name__ == '__main__':
    main()
    #om2.MEventMessage.removeCallback(index)

This works fine when I move the pivot (e.g. using the Insert key and dragging the pivot), and the callback is triggered as expected. However, when I rotate the pivot using the manipulator, the callback does not fire—even though I’m querying cmds.manipPivot(q=True, o=True) and expecting changes.

Is there a way to detect when the pivot is being rotated interactively? Does Maya expose any event or callback that can be used to track pivot rotation changes?

I can repro on 2024.2.1 (PFIX). A pivot rotation doesn’t trigger any event.

1 Like

I believe the object only has the position of the pivot. The rotation you see is used by the Move/Rotate/Scale tools and I don’t seen any signal that gets sent when it changes. I could just be missing it, but if it’s there somewhere then it would be under OpenMayaUI somewhere, or maybe with the contexts themselves?

1 Like