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
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
