Tuesday, November 6, 2007

Script for parent constraining multiple objects

This is a small script to parent constrain multiple objects at same time

string $sel[] = `ls -sl`;
//The above section will store all the selection to an array
int $count = size($sel);
//The above section will count the number in the first array
int $i;
//an integer variable i is declared
for ($i=1; $i<$count; $i++)
{
//The above section will assign a value for i as 1 and check the condition if its true it follow to incrementation of i value
select -r $sel[0];
//The above section will select the first object in the selection list
select -tgl $sel[$i];
//The above section will select the object according to the i value as the loop continues it will continue as 1, 2, 3 etc.......
parentConstraint -mo -w 1;
}
//The above section will parent constrain the first and second objects

No comments: