Hello,
I created a script that will copy the skinweight from the first vertex you select, to the second. It works fine, even for separate objects, but I've come across one issue. If the separate objects are affected by all the same joints, then it errors out, saying, jointX isn't an influence object on such-and-such skin cluster. Here's my code:
CODE
//--Find the joints affecting the components, and the size of their array.-----------------
$firstVertexJoints = skinPercent -q -t $firstSkinCluster $firstVertex;
$firstJointsSize = size $firstVertexJoints;
//--Find the weight percent of each joint for each vertex.--------------------
$firstVertPercents = skinPercent -q -v $firstSkinCluster $firstVertex;
$secondVertPercents = skinPercent -q -v $secondSkinCluster $secondVertex;
//--For each joint affecting the first object, set its weight to affect the second.---------------------
for ($counter = 1; $counter <= 5; $counter++) //--This will run the weight matching 5 times, since Maya automatically maintains a value of 1, this ensures precision.--\
{
for ($i = 0; $i < $firstJointsSize; $i++)
{
skinPercent -tv $firstVertexJoints[$i] $firstVertPercents[$i] $secondSkinCluster $secondVertex;
}
}
So, I'm finding the transforms affecting a particular vertex of a skin cluster, and setting that information onto the second vertex selected. The example I'm having issues with, is that I'm trying to copy skin weights from a body/head mesh to an eye shell mesh, which is just a specular layer in front of the eye. The eye mesh is much smaller than the body/head mesh, so even though the verts are affected by the same joints, the two skin cluster's have a completely different number of joints affecting them. I don't see where or how my script is even calling the other joints into effect. I checked in the component editor, and the joint its erring out on doesn't have any weighting on it for the first vert selected.
Any help would be appreciated. Thanks!