Ultra easy one (I think)

Hello all of the mel gourou,

Here I'm trying to do a little thing in mel My problem is that I'm extra extra beginner...anyway after I read the doc I thought I could come up with what I needed but obviously I missed (damn!!).
Anyway here is what I'm trying to achieve...I have a lot of object and I'd like to just do a mel that scale in a random way on the Y axis all my selected object (meaning each one would have a different height...I do understand the rand fonction but it seems that I'm unable to tell Maya to use it on all the selected object...can someone give me the beginning of the answer ..pleease...

thanks so much for anyone that answers
(It must be obvious but like I say I've never touch mel before so I hope this is not to stupid to ask)

thematt

Heya,

the easiest way to do this is to use a for loop on the selected objects..

first you want to grab all the selected objects:

$objs = ls -sl;

then you want to loop through them
for ($ob in $objs)
{
// now get the current value
float $v = getAttr ($ob + ".scaleY");
// get a random value off of the value with an offset of, say.. .5
float $rand = rand(($v-.5), ($v+.5));

// now set the attribute
setAttr ($ob + ".sy") $rand;
}

there ya go!

-jas


jason schleifer
animator
weta digital

Thx so much,

whah I thought that would be much easier, seems like my way will be long and full of failure..

all right now I'll do that and try to understand it pretty good...

thanks so much anyway..

cheers

thematt