PDA

View Full Version : set attribute mel help


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

goleafsgo
09-11-2009, 12:58 PM
This part:

setAttr $selected[$i].colorEntryList[0].color"


should probably look like this:

setAttr ($selected[$i] + ".colorEntryList[0].color")

chuckie7413
09-11-2009, 01:18 PM
Great, that does it! :)

Thanks Tim.

CGTalk Moderation
09-11-2009, 01:18 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.