Etape 26

Utiliser le script suivant pour "parenter" chaque locator au joint le plus proche

string $command,$list_loc[] = `ls -sl`;

float $position_locator[3],$position_trunk[3],$dist,$distance_small;

int $l,$j,$joint_sup,$plus_petit_id,$exist=1,$max_loc = size($list_loc);

vector $toto;

for ($l = 0 ; $l < $max_loc ; ++$l)

{

$command = "$position_locator = `xform -q -ws -t locator_"+$l+"`"; eval $command;

$distance_small=1e900000;

for ($j = 0 ; $exist != 0 ; ++$j)

{

$command = "$position_trunk = `xform -q -ws -t trunk_"+$j+"`"; eval $command;

$toto = <<$position_locator[0]-$position_trunk[0] , $position_locator[1]-$position_trunk[1] , $position_locator[2]-$position_trunk[2] >>;

$dist = mag ($toto);

if ( $dist < $distance_small)

{

$distance_small = $dist; $plus_petit_id = $j;

}

$joint_sup = $j +1 ; select -cl ; $command = "$exist = `joint -ex trunk_"+$joint_sup+"`"; eval $command;

}

$exist = 1;

$command = "select -r locat_1_"+$l ; eval $command;

$command = "select -tgl trunk_"+$plus_petit_id; eval $command;

parent;

}