Message 1 of 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I am exploring the Maya API and testing code to instance an object by parenting a new transform node to the existing shape node:
import maya.OpenMaya as om
import maya.OpenMayaMPx as mpx
#explicitly get shape node
list = om.MSelectionList()
om.MGlobal.getSelectionListByName("pCubeShape1",list)
shape_node = om.MObject()
list.getDependNode(0,shape_node)
#create transform node
trans_node = om.MFnTransform().create()
dag_node = om.MFnDagNode(trans_node)
#parent shape node to transform node and instance with 'keepExistingParents' flag
dag_node.addChild(shape_node,keepExistingParents=True)
I'm getting the error: 'TypeError: MFnDagNode_addChild() takes no keyword arguments'.
Obviously it's supposed to take this keyword argument and I've seen several example python scripts which do pass this flag to the call.
Any Ideas?
Thanks!
Solved! Go to Solution.