MDagMessage.addChildAddedDagPathCallback on newly created node?

MDagMessage.addChildAddedDagPathCallback on newly created node?

Anonymous
Not applicable
237 Views
0 Replies
Message 1 of 1

MDagMessage.addChildAddedDagPathCallback on newly created node?

Anonymous
Not applicable
I'm having trouble adding the addChildAddedDagPathCallback on a newly created node.

Writing a simple node (.py) and want to register a callback when a child is parented under the node.
The node at the creation time is a shape node but I want to register the callback to its parent transform

def postConstructor(self):
nodeFn = OpenMaya.MFnDependencyNode(self.thisMObject())
nodeFn.setName("&#xsS;hape#" % self.typeName())

dpath = OpenMaya.MDagPath()
OpenMaya.MDagPath.getAPathTo(self.thisMObject(), dpath)

dpath.transform()
self._cbchild = OpenMaya.MDagMessage.addChildAddedDagPathCallback( dpath, self._childAdded, nodeFn )



The transform is not recognized at the time when the callback is created so the path is invalid.
Any workaround? Or am I doing it wrong?

Thanks!
0 Likes
238 Views
0 Replies
Replies (0)