cod2-sdk/bin/maya/selectBound.mel

57 lines
1.9 KiB
Plaintext
Raw Permalink Normal View History

2006-04-20 00:00:00 +00:00
// Selects joints in selected character mesh. Selects and returns only the joints that are being used for
// the character. To use, FIRST select single mesh, then select the bones you would like to keep in skinCluster
global proc selectBound()
{
int $i=0;
string $boundList[];
string $headSet[];
string $bodySet[];
string $fullSet[];
string $TAG_BODY[]={"TAG_ORIGIN","TAG_WEAPON_LEFT","TAG_WEAPON_RIGHT"};
string $TAG_HEAD[]={"TAG_EYE","J_Head_END","J_Helmet"};
string $FULL_TAG_CHAR[]= stringArrayCatenate($TAG_HEAD,$TAG_BODY);
string $coatRig="CoatRig";
string $selAll[];
string $sel[]=`ls -sl`;
removeUnusedInfluences;
for($each in $sel)
{
string $skinSel=$each;
string $influence[]=`skinCluster -q -inf $skinSel`;
for($bones in $influence)
{
$selAll[$i]=$bones;
$i++;
}
}
string $boundList[] = stringArrayRemoveDuplicates($selAll);
string $listBoundList = stringArrayToString($boundList," ");
if(`gmatch $listBoundList "*J_Cheek_LE*"` == 1 && `gmatch $listBoundList "*J_Spine1*"` == 1)
{
string $fullSet[] = stringArrayCatenate($boundList,$FULL_TAG_CHAR);
select $fullSet;
int $totalSize=`size($fullSet)`;
print ("There are " + $totalSize + " bones in this full character set");
}
if(`gmatch $listBoundList "*J_Spine1*"` == 1 && `gmatch $listBoundList "*J_Cheek_LE*"` == 0)
{
string $bodySet[] = stringArrayCatenate($boundList,$TAG_BODY);
select $bodySet;
int $totalSize=`size($bodySet)`;
print ("There are " + $totalSize + " bones in this body set");
print "\n";
print "Remember to add J_Neck and J_Head for Multiplayer";
}
if(`gmatch $listBoundList "*J_Cheek_LE*"` == 1 && `gmatch $listBoundList "*J_Spine1*"` == 0)
{
string $headSet[] = stringArrayCatenate($boundList,$TAG_HEAD);
select $headSet;
int $totalSize=`size($headSet)`;
print ("There are " + $totalSize + " bones in this head set");
}
}