I used MFnSkinCluster not that long ago and I retrieved the fullPathName of two different skinClusters and stored them in a list.
Then, I had to compare the list to see if I need to add any influence objects:
list( set( first.influenceObjectsStr ).difference( second.influenceObjectsStr) )
If, the results wasn't None then I executed the MEL command to add them as an influence using "OpenMaya.MDGModifier()", with the two methods commandToExecute and doIt.
So, I recommend to go with your first instinct and use MEL. Don't remember where but someone mentioned that MEL is easier to add influences then trying to use the API.
As for the setWeights() issue...I had no problem changing the weight from zero. Are you using the dataBlock for help setting the weights by chance to retrieve values for setting the final weights?
Try printing out the values from the OpenMaya.MDoubleArray() that you are using to set the values are correct. Could also double check arguments for the setWeights is correct... I had a problem before with setWeights and I tracked it down to a previous issue.
-brian
www.meljunky.com
---------- Original Message --------
Subject: [Maya-Python] Re: Adding Influence Object
From: Brandon Harris <[email protected]>
Date: Wed, December 16, 2009 4:00 pm
To: python_inside_maya <[email protected]>
And this has actually raised another issue. If a joints influence is
entirely at 0 on a skinCluster and I use the setWeights() it won't set
the weights. It just leaves the joint influence at 0. This a known
issue?
On Dec 16, 10:34 am, Brandon Harris <[email protected]> wrote:
> Alright, so I have a system where you can grab components on multiple
> meshes and apply weights to specified joints. Everything works fine
> unless you run into a joint that doesn't effect one of the meshes. The
> easiest way to do this would be just to check if the object influences
> the skin cluster and if it doesn't add it. This would be simple with
> Mel, but is there a way to accomplish this with API? In MFnSkinCluster
> there isn't a method for this and I haven't been able to locate one.
> There's got to be something there for it though.
--
http://groups.google.com/group/python_inside_maya
http://groups.google.com/group/python_inside_maya
