Hello.
I've been trying to learn MEL. But the way it works is driving me crazy.
So I have a particle system. It is emitting through a Mesh. And I added a "per point emission rates" to my mesh. So that I can adjust the emission rates individually. The attribute looks like this:
pPlaneShape1.emitter1RatePP[0]
Because my mesh is large I want to write a script that assigns random numbers between 0 and 1 to every vertex emitter1RatePP position.
My question is;
When I write this it assigns a random number to position 0. So it works fine.
$min = 0;
$max = 1;
$random = rand($min, $max);
setAttr"pPlaneShape1.emitter1RatePP[0]" $random;
But when I use a variable as the position it won't work:
$min = 0;
$max = 1;
$var = 0;
$random = rand($min, $max);
setAttr"pPlaneShape1.emitter1RatePP[$var]" $random;
The error I am getting is this:
// Error: line 6: setAttr: Invalid attribute name: pPlaneShape1.emitter1RatePP[$var] //
// Error: line 0: An execution error occured in the expression randomEmmision_Attr. //
// Result: randomEmmision_Attr //
If I can figure this out than I'll write a for loop and use the iterator as a position.
I'd really appreciate any help. Thanks:)