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)
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; }