Search DLab 1.0

Tuesday, August 31, 2010

Mel question

Aj Moe

I went through all the code we did and have some question
Please look at this code:

proc loop1(){
string $sel[] = `ls -sl`;
int $count = (size($sel));
int $i;
float $sy = getAttr ($sel[0]+".sy");
for ($i = 0; $i<$sy; $i++){
//by number of obj selected
string $tmpS[] = `polyCube`;
setAttr ($tmpS[0]+".ty") ($i*2);

};
}

loop1();

I get what it does, but I don't understand these two lines;

for ($i = 0; $i<$sy; $i++)

and

setAttr ($tmpS[0]+".ty") ($i*2);

the function create "sy from select object" number of polycubes
and space them out in the y direction, but what do i variables do?

1 comment:

  1. Krist, This is Art, AJ Moe's Brother,

    He told me that
    "$i variable is only for loop counting"

    Good luck with your code.

    ReplyDelete