Hi everyone,

I try to parent an instanciate shape to new transform with API.
With command is *cmds.parent(my_shape, ma_new_parent, relative=True, 
shape=True)*

All parenting function I've found  need MObject in argument.
But with MObject it's my original shape was parented. 
It's possible to have N MDagPath for one MObject (First is path of original 
shape, other is instanciate object). But I don't found solution for 
reparent instanciate shape....

If any have solution...

Here is my code:

# Duplicate shape
mfn_shape = OpenMaya.MFnDagNode(mo_node)
mo_duplicate = mfn_shape.duplicate(True, False)

# Retrieve shape.
# When duplicate shape, new parent is created and is returned by duplicate 
function
mfn_duplicate = OpenMaya.MFnDagNode(mo_duplicate)
dp_duplicate = OpenMaya.MDagPath()
mfn_duplicate.getPath(dp_duplicate)
dp_duplicate.extendToShape()
# print dp_duplicate.fullPathName() # Here long path is valid

# Reparent
# dp_duplicate.node() give original shape not new shape instance
mfn_parent = OpenMaya.MFnDagNode(mo_parent)
mfn_parent.addChild(dp_duplicate.node())


-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/f14c30f9-081d-428b-940e-35a7518afe53%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to