CODE
/*
Written by Doug Hines on 10/15/2007
Tool used to move vertex weights of a skin cluster from one joint to another.
Joints must be in same skin cluster.
Script does not support multiple skinned objects.
Select one vertex at a time
*/
global proc string jointSelection_fromScrollList()
{
// Get Selected Item (Joint Name) from textScrollList "jointLIST"
string $listSelection[] = textScrollList -q -si jointLIST
;
print ($listSelection[0] + "\n");
string $destinedJoint = $listSelection[0];
return $destinedJoint;
}
global proc transferWeights(string $weightDestination)
{
string $selectedVertices[] = ls -sl -fl
;
if(size($selectedVertices)
== 0)
{
error ("Found 0 vertices selected. Expected minimum size: 1 \n");
}
int $index = 0;
string $componentParentList[0];
for($vert in $selectedVertices)
{
string $componentParent = match "^[^\.]*" $vert
;
$componentParentList[$index] = $componentParent;
// print ($componentParentList[$index] + "\n");
if($index > 0)
{
if(gmatch $componentParentList[$index] $componentParentList[$index - 1]
== 0)
{
error("Component parent objects do not match.");
}
}
$index++;
}
print ("Selected Vertex Count: "+ size($componentParentList)
+ "\n");
string $vertParentskinCluster = findRelatedSkinCluster $componentParentList[0]
;
print ("Selected Vertices belong to Skin Cluster : " + $vertParentskinCluster + "\n");
// Get the skin weight and copy it to the new joint influence. Set old influence to 0;
for($vert in $selectedVertices)
{
string $oldVertInfluence[] = skinPercent -ib .001 -q -t $vertParentskinCluster
;
float $skinWeight[] = skinPercent -ib .001 -q -v $vertParentskinCluster
;
print $skinWeight;
print $weightDestination;
skinPercent -tv $weightDestination $skinWeight[0] $vertParentskinCluster $vert;
skinPercent -tv $oldVertInfluence[0] 0.0 $vertParentskinCluster $vert;
}
}
global proc dhU_transferVertexWeightsWindow()
{
if(window -exists jointWinGUI
)
{
deleteUI jointWinGUI;
}
string $jointDestination;
string $jointListWin = window -mxb 0 -mnb 0 -t "Joints" jointWinGUI
;
columnLayout;
textScrollList -ams 0 -sc "$jointDestination = jointSelection\_fromScrollList
" jointLIST;
string $sceneJoints[] = ls -type joint
;
for($joint in $sceneJoints)
{
textScrollList -e -append $joint jointLIST;
}
button -w 250 -h 25 -l "Move Vertex Weights" -c ("transferWeights($jointDestination)");
textScrollList -e -h 500 jointLIST;
window -e -wh 300 600 jointWinGUI;
showWindow $jointListWin;
}
dhU_transferVertexWeightsWindow
I wrote this for similiar purposes on one of my characters. It only works for 1 vert at a time, but can be easily modified to do sets of verts.