PDA

View Full Version : Overiridng the color of multiple control curves


nanimator
05-02-2009, 10:32 AM
okay my Mel is very raw and has mosltly been learnt through much hours of reading books and reading other peoples scripts. Currently I'm trying to create a mel script that allows the user to select multiple curves and chage the wireframe color instantly. This problem seems a bit over my head and if anyone can point me in the direction that would be great.

here's the script, its a simple for-in loop. I've checked to see it works just by using a move command (which I have commented out). The problem arises when try to change the overideColor attribute, or any other attribute.

string $selected[] = `ls -sl`;
string $each;

for ($each in $selected)

{
//move 10 0 0 $each;
setAttr $each.overrideEnabled 1;
setAttr $each.overrideColor 11;
}


the error message I get is...

// Error: No attribute was specified. //

If anyone can point out the error of my ways, that would be much appreciated.

thanks

mikelyndon
05-02-2009, 10:59 AM
You weren't too far off...

string $selected[] = `ls -sl`;
string $each;

for ($each in $selected)

{
//move 10 0 0 $each;
setAttr ($each + ".overrideEnabled") 1;
setAttr ($each + ".overrideColor") 11;
}

You need to pass the obj and attribute as a string I think, so I've separated the variable from the attribute.

Mike.

nanimator
05-04-2009, 11:13 AM
it worked!

thanks for that, much appreciated.

CGTalk Moderation
05-04-2009, 11:13 AM
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.