I am trying to find if there is a better callback that I can use instead of MNodeMessage.addAttributeChangedCallback
.
def test (msg, plug, otherplug, *clientData):
if msg & OM.MNodeMessage.kConnectionMade:
print "connection made"
if msg & OM.MNodeMessage.kConnectionBroken:
print "connection broken"
if msg & OM.MNodeMessage.kAttributeEval:
print "attribute eval"
if msg & OM.MNodeMessage.kAttributeSet:
print "attribute set"
if msg & OM.MNodeMessage.kAttributeLocked:
print "attribute locked"
if msg & OM.MNodeMessage.kAttributeUnlocked:
print "attribute unlocked"
if msg & OM.MNodeMessage.kAttributeAdded:
print "attribute added"
if msg & OM.MNodeMessage.kAttributeRemoved:
print "attribute removed"
if msg & OM.MNodeMessage.kAttributeRenamed:
print "attribute renamed"
if msg & OM.MNodeMessage.kOtherPlugSet:
print "attribute other plug set"
node = cmds.ls(sl=True, l=True)[0] # |imagePlane1
sel = OM.MSelectionList()
sel.add (node)
obj = OM.MObject ()
sel.getDependNode (0, obj)
cb = OM.MNodeMessage.addAttributeChangedCallback(obj, test)
Currently if I used the above callback and made any changes towards the ‘top’ portion attributes (eg. tx,ty,tx, rx,ry,rz,sx,sy,sz and vis) of the node I have set to, it does prints out the relevant statements.
But as soon as I starts to edit the shapes attributes (eg. width, height etc), none of the statements got printed.
Am I using the wrong callback?
P.S: My tool is only dealing with the shapes’ attributes.