Message 1 of 1
MDagMessage.addChildAddedDagPathCallback on newly created node?

Not applicable
08-13-2012
07:42 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
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
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!
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!