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?