PDA

View Full Version : pointOnCurve my first newbie mel


marckury
09-21-2007, 01:33 AM
well yes at last something worked , well as i said im starting to learn some mel and the first thing I wanted to try has been make a manual motionPath, I got something but not the thing I wanted , so I hope someone can help , this is the thing I wrote to attach a cube on a curve with a slider getting curve parameter then with a button to attach the cube on that x y z of curve parameter ,

window -t attachCubeOnPath;
columnLayout;
// min max are the begining and ending of curve parameter
floatSliderGrp -min 0 -max 3 -l curveParameter -field true parameter;
button -c attach -l attach;

proc attach() {
float $curveParameter=`floatSliderGrp -q -value "parameter"`;
float $attachme[]=`pointOnCurve -pr $curveParameter curve1`;
setAttr pCube1.tx $attachme[0];
setAttr pCube1.ty $attachme[1];
setAttr pCube1.tz $attachme[2];
}
showWindow;

Now , the real thing I wanted was make that but while moving the slider , so dont have to press any button , while moving slider cube goes on the path.... how to do it? please dont laugh at my first mel! :deal:

Segmoria
09-21-2007, 03:41 PM
Well you have done almost all the work, just use the same -cc flag on the floatSliderGrp that you used on the button:
floatSliderGrp -min 0 -max 3 -l curveParameter -cc attach -field true parameter;
so everytime the value of the slider changes, it will call your procedure that will move the cube.

marckury
09-21-2007, 07:33 PM
oh yes! so easy , thanks for that!

CGTalk Moderation
09-21-2007, 07:33 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.