First of all, I'm still sculpting and detailing my human character, though I have the base shape all blocked in and sloidifie
///////////////////////////////////////////////////////////////////////////////////////////////
// Sophie Brennan - Control Rig Setup
//
// How to use this script:
// 1. Make sure your group node containing your joints for exportation is called
// "grp_exportSkeleton"
// 2. Then make sure your group node containing your rig is called "grp_controlRig"
// 3. Make sure each skeleton has the same number of joints in the exact same place.
// 4. When running the rig, please specify whether you are breaking or joining
// connections, i.e. sbControlRig break; or sbControlRig connect;
//
//
/////////////////////////////////////////////////////////////////////////////////////////////////
global proc sbControlRig (string $specifyFunc)
{
string $legSide;
if (($specifyFunc != "break") && ($specifyFunc != "connect"))
{
$doWarning = 1;
warning "Unknown argument. Please specify either break or connect. ie: sbControlRig break; \n";
} else
{
$doWarning = 0;
print "Function specified - continuing with script. \n";
}
string $bones[] = `listRelatives -c -ad -type "joint" "grp_exportSkeleton"`;
string $joints[] = `listRelatives -c -ad -type "joint" "grp_controlRig"`;
int $bonesLength = `size $bones`;
int $jointsLength = `size $joints`;
int $i;
if ($specifyFunc == "connect")
{
for ($i = 0 ; $i < $bonesLength ; $i++ )
{
connectAttr ($joints[$i]+".r") ($bones[$i]+".r");
connectAttr ($joints[$i]+".t") ($bones[$i]+".t");
}
}
else if ($specifyFunc == "break")
{
for ($i = 0 ; $i < $bonesLength ; $i++ )
{
disconnectAttr ($joints[$i]+".r") ($bones[$i]+".r");
disconnectAttr ($joints[$i]+".t") ($bones[$i]+".t");
}
}
else
{
//Do nothing
print "Argument not specified - please specify break or connect. /n";
}
}
No comments:
Post a Comment