Phlok
12-01-2008, 08:33 PM
Hi,
I am trying to create a MEL script that does the following:
1. Select a nurbs curve
2. Select some points on the curve
3. Create an expression that animates the points selected in Y between position n(max) and n(min) over a given time (something like an oscillation).
Okay...my problem is when coding in MEL I often don't know how to get things done, I did a lot of tutorials though, but as I am an experienced programmer I know what variables are or how to use loops...(that's what most tutorials have been trying to tell me so far). I know how to script some stuff with dynamics and I also know how to create expressions from a MEL script, but I am not into geometry operations.
Here's my point, now:
I selected my curve's EPs doing that:
float $fEpsOfPath [] = `getAttr "curve1.ep
"`;
fine.
But now I am seeking for a way to change the EP's positions. I need to do a local transform on the curve, because I want to be able to place my oscillating curve freely around in the scene when I am done with the script (in fact, that's why am writing this stuff in the first place).
Something like (thinking in an OO- language)
curve1.ep[i].translateLocalX(0.5)
I kept searching all over the documentation but I couldn't make out what to do or what command I need for doing this.
So here's my questions:
1. Should I be using EPs in the first place or would you recommend using knots or CVs? If so- why?
2. Is there something like a best practice on how to do the transformations of the nodes? I mean, is there a command such as the one I posted above or do I need to set up a transform node?
Could you please be so kind an enlighten me?
Any help or hint is very much appreciated!
I am trying to create a MEL script that does the following:
1. Select a nurbs curve
2. Select some points on the curve
3. Create an expression that animates the points selected in Y between position n(max) and n(min) over a given time (something like an oscillation).
Okay...my problem is when coding in MEL I often don't know how to get things done, I did a lot of tutorials though, but as I am an experienced programmer I know what variables are or how to use loops...(that's what most tutorials have been trying to tell me so far). I know how to script some stuff with dynamics and I also know how to create expressions from a MEL script, but I am not into geometry operations.
Here's my point, now:
I selected my curve's EPs doing that:
float $fEpsOfPath [] = `getAttr "curve1.ep
"`;
fine.
But now I am seeking for a way to change the EP's positions. I need to do a local transform on the curve, because I want to be able to place my oscillating curve freely around in the scene when I am done with the script (in fact, that's why am writing this stuff in the first place).
Something like (thinking in an OO- language)
curve1.ep[i].translateLocalX(0.5)
I kept searching all over the documentation but I couldn't make out what to do or what command I need for doing this.
So here's my questions:
1. Should I be using EPs in the first place or would you recommend using knots or CVs? If so- why?
2. Is there something like a best practice on how to do the transformations of the nodes? I mean, is there a command such as the one I posted above or do I need to set up a transform node?
Could you please be so kind an enlighten me?
Any help or hint is very much appreciated!
