I would just use the skinCluster command to create a skin cluster and not the API. There's not really any easy way to do it all in the API.
On Fri, Aug 24, 2012 at 1:06 AM, Maïckel Pasta <[email protected]>wrote: > Hi, > I try to skin an object with python and the API, but I don't understand > how that's work ... > > for exemple with a single joint, and one random mesh: > > import maya.OpenMaya as OpenMaya > import maya.OpenMayaAnim as OpenMayaAnim > def skin (shape, joint) : > fnDepCluster = OpenMaya.MFnDependencyNode () > oCluster = fnDepCluster.create('skinCluster') > fnCluster = OpenMayaAnim.MFnSkinCluster( oCluster ) > generator = OpenMaya.MItGeometry(shape) > dagNode = OpenMaya.MFnDagNode(shape) > shapePath = OpenMaya.MDagPath() > dagNode.getPath(path) > fnDepJoint = OpenMaya.MFnDependencyNode (joint) > fnDepShape = OpenMaya.MFnDependencyNode (shape) > plugWorldMatrix = fnDepJoint.findPlug('worldMatrix') > plugMatrix = fnDepCluster.findPlug('matrix') > plugMatrixArray = plugMatrix.elementByLogicalIndex(0) > plugOutputGeometry = fnDepCluster.findPlug(' outputGeometry') > plugOutputGeometryArray = plugOutputGeometry.elementByLogicalIndex(0) > plugCreate = fnDepShape.findPlug('create') > modifier = OpenMaya.MDGModifier() > modifier.connect( plugWorldMatrix , plugMatrixArray ) > modifier.connect( plugOutputGeometryArray , plugCreate ) > modifier.doIt() > while not generator.isDone(): > fnCluster.setWeights(shapePath, generator.currentItem(), 1, > 1) > generator.next() > So i'm stuck at this point ... If someone have a piece of code for explain > me basically the process ? Thx :) > > -- > view archives: http://groups.google.com/group/python_inside_maya > change your subscription settings: > http://groups.google.com/group/python_inside_maya/subscribe > -- view archives: http://groups.google.com/group/python_inside_maya change your subscription settings: http://groups.google.com/group/python_inside_maya/subscribe
