FORUMS TUTORIALS FEATURES VIDEOS PODCASTS EVENTS SERVICES NEWSLETTER NEWS BLOGS
 MAYA: MAYA Forum MAYA Tutorials MAYA

# MEL: curves, pivots, and points

COW Forums : MAYA

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
 MEL: curves, pivots, and points by clear menser on Nov 20, 2002 at 1:51:20 am

Ok,
How do I place the rotate pivot and scale pivot of the curve at the position of the first CV of that Curve????

 Re: MEL: curves, pivots, and pointsby Steve on Nov 20, 2002 at 9:38:34 pm

With the Rotate or Scale tool active, press 'Insert' to get the 'move pivot point' manipulator. Then just hold 'C' (for 'snap to curve') and click on the curve, then slide the pivot along until it sticks to the end. Let go, and hit 'Insert' again. Voila.

-Steve

 Re: MEL: curves, pivots, and pointsby clear menser on Nov 23, 2002 at 4:23:54 am

Uh, yeah, I can do that...
But how do you do it in MEL... Like the subject says. Sorry if I wasn't as Clear as I should have been, my bad.
Just for the record let me restate: How does one, in Maya, with the MEL scripting language, move the pivot point of a curve to the cv[0] point, aka the origin of the curve, i.e. the first CV.

anyone????

sincerely,
Clear

 Re: MEL: curves, pivots, and pointsby Steve on Nov 23, 2002 at 11:40:32 pm

My apologies, Clear.

float \$posx = `getAttr curve1.controlPoints[0].xValue`;
float \$posy = `getAttr curve1.controlPoints[0].yValue`;
float \$posz = `getAttr curve1.controlPoints[0].zValue`;
move -a \$posx \$posy \$posz curve1.scalePivot curve1.rotatePivot;

-Steve

 Re: MEL: curves, pivots, and pointsby clear menser on Dec 3, 2002 at 3:06:18 am

Steve,

Thank you, so close, let me bring it on home, yo!

//-move the pivot point of a curve to it's first CV-//
float \$posx = `getAttr curve1.controlPoints[0].xValue`;
float \$posy = `getAttr curve1.controlPoints[0].yValue`;
float \$posz = `getAttr curve1.controlPoints[0].zValue`;
float \$curvex = `getAttr curve1.tx`;
float \$curvey = `getAttr curve1.ty`;
float \$curvez = `getAttr curve1.tz`;
\$posx += \$curvex;
\$posy += \$curvey;
\$posz += \$curvez;

move -a \$posx \$posy \$posz curve1.scalePivot curve1.rotatePivot;
//-END-//

Those extra 6 lines are if your curve has moved.

-Clear

p.s. extra points for anyone that can do this in less lines.

 Re: MEL: curves, pivots, and pointsby Steve on Dec 3, 2002 at 6:04:55 am

Ooooh. Very nice work!

float \$position[] = `getAttr curve1.controlPoints[0]`;
float \$curvePosition[] = `getAttr curve1.translate`;
\$position[0] += \$curvePosition[0];
\$position[1] += \$curvePosition[1];
\$position[2] += \$curvePosition[2];

move -a \$position[0] \$position[1] \$position[2] curve1.scalePivot curve1.rotatePivot;

...at a svelte six lines.

Anyone want to take it any further? :)

-Steve

 Re: MEL: curves, pivots, and pointsby Chad Briggs on Dec 3, 2002 at 2:01:39 pm

this is the equivalent of a melscript spitting contest :) heheheeh.

 Re: MEL: curves, pivots, and pointsby Steve on Dec 3, 2002 at 6:24:38 pm

:)

Have you ever taken a look at Melbotwars (http://www.melbotwars.com)?

If this is a melscript spitting contest... then that must be the melscript OLYMPICS. ;D

-Steve

 Re: MEL: curves, pivots, and pointsby Chad Briggs on Dec 4, 2002 at 3:22:41 am

Steve-
Yeah, I heard of this thing. These guys make me wish I would have been a doctor or laywer like mom wanted... but nooo...had to be creative :)