Skinning in maya api and MObject and MDagPath

This topic is 3016 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

The problem I have with using maya API in general seems to be everything is so generic and with so many layers of indirection I can never get a handle on what anything actually expects for its interface, let alone how to get at it. I have some skinning info generated out programatically for a mesh, with the proper values and joint names and I simply want to set the values to an existing skin cluster which has all the joints as influences already. I'm trying to use the MFnSkinCluster. This has two methods for setting weights:
MStatus setWeights (const MDagPath &path, const MObject &components, unsigned int jointIndex, double value, bool normalize=true, MDoubleArray *oldValues=NULL)
MStatus setWeights (const MDagPath &path, const MObject &components, MIntArray &influenceIndices, MDoubleArray &values, bool normalize=true, MDoubleArray *oldValues=NULL)

Now the dagpath seems to be the actual joint, but what do I put in the components area? At first I thought that this was supposed to be the verts, which is the only thing that makes real sense in my mind. If set the influences to zero for all verts, though, it doesn't do anything at all. Now I guess it could be the mesh object, but that doesn't make a ton of sense either. In that case I'd have to set the influence for every vert when I want to make a change to the joint's influence. So you'd be setting n^2 values to set the entire thing, which has got to be slower than just using mel commands. It's also confusing it says 'components'. I have never quite gotten the hang of the whole node business and honestly it makes no more sense now than it ever has, but how can the node ever be 'components'? I guess it can always traverse down the nodes, but the thing has to BE something specific, right?

Share on other sites
I got this resolved. It seems you need to go through the MfnGeometryFilter that the skin function inherits from to get the verts or it doesn't work.

The path should be the path to the shape, and the component is the path to the vert.

• 10
• 18
• 14
• 19
• 15