string $sel[]=`ls -sl`;
float $T[]=`xform -q -ws -t $sel[0]`;
float $R[]=`xform -q -ws -ro $sel[0]`;
if (`exists ($sel[0]+"_Con")`==0) {
delete ($sel[0]+"_Con");
}
if (`exists ($sel[0]+"_Con_grp")`==0) {
delete ($sel[0]+"_Con_grp");
}
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 1 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1 -n ($sel[0]+"_Con");
group -n ($sel[0]+"_Con_grp");
xform -ws -t $T[0] $T[1] $T[2] ($sel[0]+"_Con_grp");
xform -ws -ro $R[0] $R[1] $R[2] ($sel[0]+"_Con_grp");
================================================
string $sel[]=`ls -sl`;
for($obj in $sel){
float $T[]=`xform -q -ws -t $obj`;
float $R[]=`xform -q -ws -ro $obj`;
circle -c 0 0 0 -nr 0 1 0 -sw 360 -r 1 -d 3 -ut 0 -tol 0.01 -s 8 -ch 1 -n ($obj+"_Con");
group -n ($obj+"_Con_grp");
xform -ws -t $T[0] $T[1] $T[2] ($obj+"_Con_grp");
xform -ws -ro $R[0] $R[1] $R[2] ($obj+"_Con_grp");
parentConstraint -mo -weight 1 ($obj+"_Con") $obj;
}
原文地址:http://www.cnblogs.com/sy88/p/3737047.html