chuckie7413
09-11-2009, 11:57 AM
Hi all,
Simple question I think. Sorry bit of a noob.
Want to select a couple of ramps and randomly adjust their colour values.
So first I select my ramp nodes in the hypershade and then run this script i wrote.
//Adjust all selected ramps colour values
int $i=0;
string $selected[] = `ls -sl`;
int $size=`size($selected)`;
for ($i=0;$i<$size;$i++)
{
setAttr $selected[$i].colorEntryList[0].color" -type double3 `rand 0 1` `rand 0 1` `rand 0 1`;
};
However I get the error message: // Error: No object matches name: "$selected[$i]".colorEntryList[0].color //
Obviously there is an issue with me using the $selected[$1] within the setAttr command. I tried wrapping it in "" (quotations) but same error.
What am i doing wrong.
Thanks
Rich
Simple question I think. Sorry bit of a noob.
Want to select a couple of ramps and randomly adjust their colour values.
So first I select my ramp nodes in the hypershade and then run this script i wrote.
//Adjust all selected ramps colour values
int $i=0;
string $selected[] = `ls -sl`;
int $size=`size($selected)`;
for ($i=0;$i<$size;$i++)
{
setAttr $selected[$i].colorEntryList[0].color" -type double3 `rand 0 1` `rand 0 1` `rand 0 1`;
};
However I get the error message: // Error: No object matches name: "$selected[$i]".colorEntryList[0].color //
Obviously there is an issue with me using the $selected[$1] within the setAttr command. I tried wrapping it in "" (quotations) but same error.
What am i doing wrong.
Thanks
Rich
