PDA

View Full Version : float issue. help!


sergioduque
08-31-2008, 11:09 PM
hi people.

So, i'm trying to write a script where i select a bunch of animated objects and based on certain attribute value (.rotateY for this exemple) it set/key the objects visibility ON and OFF while running the timeline.



int $i;
for ($i = 1; $i <= 80; $i++){

string $sel[] = `ls -sl`;

for ($obj in $sel){
float $valor = `getAttr $obj.rotateY`;
if ($valor>1){
setAttr ( $obj + ".visibility") 1;
setKeyframe ( $obj + ".visibility");
}
else{
setAttr ($obj + ".visibility") 0;
setKeyframe ( $obj + ".visibility");
}
}
currentTime $i;

}



i got it to work fine if i select only 1 object.

if i select more than one it wont work, giving me the following error:
// Error: Cannot convert data of type float[] to type float.

I'm guessing the error has something to do with the loop:
for ($obj in $sel){
float $valor = `getAttr $obj.rotateY`;

but cant figure out how to solve this one.

Any ideas?
Any help you can give i will apreciate

thanks
Sérgio

sergioduque
08-31-2008, 11:44 PM
got it.

instead of:

float $valor = `getAttr $obj.rotateY`;

i should have done:
float $valor = `getAttr ($obj + ".rotateY")`;

thanks

CGTalk Moderation
08-31-2008, 11:44 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.