Simply Maya User Community

Simply Maya User Community (https://simplymaya.com/forum/index.php)
-   Programming (https://simplymaya.com/forum/forumdisplay.php?f=32)
-   -   MEL headache!! (https://simplymaya.com/forum/showthread.php?t=34701)

happymat27 03-12-2010 11:42 AM

MEL headache!!
 
Hi,

it's been an age since I've posted up here but I need a little help with MEL and I figured that this would be the place to ask.

So...

Imagine a curve with an unknown number of CV's, I have made a script to count the CV's and attach a cluster to each one. I now need to distribute the clusters along the X axis using 0.005 as a base and the sequence 1,2,4,8,16,32,64....etc as the multiplier.

So the first cluster would be at 0.005, the second at 0.010, the third at 0.020, the fourth at 0.040 and so on.

has anyone got an idea how I could achieve this with MEL?

Cheers,

Mat :)

kbrown 03-12-2010 04:41 PM

You are essentially just doubling the X value so a simple for loop should do. Something like this

Code:

int $i;
float $x = 0.005;
for($i = 0; $i < $numberOfCVs; $i++)
{
        $x *= 2;
        // Do whatever needs to be done
}



All times are GMT. The time now is 09:51 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Simply Maya 2018