Sign in to follow this  

Skinning in maya api and MObject and MDagPath

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 this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this