// // addJoint 1.0 // bora dayioglu 2007 // www.borafx.com boradayioglu@gmail.com // ------------------------------------------------------------ // desciption; // Pick the joint you wanted to add joints to and run script as; // addJoint ( numOfJoints) // global proc addJoint(int $num){ string $tmps[],$newj; string $sel[]=`ls -sl`; string $first=$sel[0]; $tmps=`listRelatives -typ "joint" $first`; string $second=$tmps[0]; float $fpos[],$spos[],$npos[]; float $rad=`getAttr ($first+".radius")`; $fpos=`xform -q -ws -t $first`; $spos=`xform -q -ws -t $second`; for($n=0;$n<$num;$n++){ $newj=`insertJoint $first`; $npos[0]=$spos[0]+((($fpos[0]-$spos[0])/($num+1))*($n+1)); $npos[1]=$spos[1]+((($fpos[1]-$spos[1])/($num+1))*($n+1)); $npos[2]=$spos[2]+((($fpos[2]-$spos[2])/($num+1))*($n+1)); joint -e -co -p $npos[0] $npos[1] $npos[2] $newj; setAttr ($newj+".radius") $rad; } }