I think I'm going to have to go another route. The attribute change callback
is triggered for any changing attribute on the node, which could be quite a
lot in this particular case. I will have to monitor the association, which
is a little more complex structurally, but will be a lot more efficient in
the end. These attributes are referred to by another node, so I'll use
MDGMessage.addConnectionCallback to track their removal.

On Fri, May 7, 2010 at 8:37 AM, Ryan <[email protected]> wrote:

> Use MNodeMessage.addAttributeChangedCallback
>
> id = OpenMaya.MNodeMessage.addAttributeChangedCallback(node, func,
> clientData)
>
>
> create a callback method (that you pass as to func above) like
>
> def attributeChangedCallback(self, msg, mplug, otherMplug,
> clientData):
>
>    nodeName, attrName = mplug.name().split('.')
>    if msg & OpenMaya.MNodeMessage.kAttributeRemoved:
>        print 'attr %s on node %s was removed' % (attrName, nodeName)
>
>
>
>
> Ryan
>
> On 7 May, 03:26, Judah Baron <[email protected]> wrote:
> > Does anyone have a good way of monitoring the deletion of a secific
> > attribute? MNodeMessage.addNodePreRemovalCallback doesn't like
> attributes.
> > It works nicely for dg/dag nodes, but gives kInvalidParameter for
> attribute
> > mobjects.
> >
> > -Judah
> >
> > --http://groups.google.com/group/python_inside_maya
>
> --
> http://groups.google.com/group/python_inside_maya

-- 
http://groups.google.com/group/python_inside_maya

Reply via email to