PDA

View Full Version : A question regarding to mel


dheeraj
11-20-2004, 11:56 AM
i am newone in scripting. so iwant to ask that when i download some .mel or any script file from highend.con .so i know don't how to execut this . i download it then opens maya nd then open script .and opens script file .but when i execute it it does othing .so plzzzz
tell everything stepwise.thanxxxxxx

westiemad
11-21-2004, 08:08 PM
if you want to get a handle on mel scripting take a look over at 3dcg.co.uk, hopefully they'll get you upto speed.

mark_wilkins
11-22-2004, 08:39 AM
Aside from plugging my book (MEL Scripting for Maya Animators (http://www.melscripting.com/)) :):

A MEL file can either contain a bunch of commands that do something directly:

sphere;
move 0 1 0;

or it can contain definitions for one or more procedures that will do something in the future when the procedure is executed:

global proc makeOffsetSphere() {
sphere;
move 0 1 0;
}

When you use "Source script..." in the script editor window, or when you open the script, select it, and hit enter, the first file above would actually make a sphere and move it to 0 1 0 at that moment. The second would create a collection of commands called a procedure that would run later when someone types makeOffsetSphere() into the script editor window or chooses one of a few other ways (picking a custom menu item and clicking on a shelf button are two of them) to execute, or call the procedure.

Usually, MEL files are meant to be placed in your script path, which is a collection of places that Maya looks for scripts. If a file is named blah.mel and contains a global procedure called blah AND is in the script path at the time Maya is launched, then Maya will find and source the script for you when you type blah() into the script editor window and hit enter to execute it.

If you've put the file somewhere else, like in your My Documents folder (in Windows), you'll have to (1) source the script, then (2) type the name of the main procedure in the file (usually the file name without the .mel at the end) into the script editor window, then (3) hit enter on the numeric keypad to execute it.

How do you find your script path? you can type:

getenv("MAYA_SCRIPT_PATH")

in the script editor window and hit enter. You should then see a list of directories where Maya will look for scripts to source automatically the next time it's launched.

-- Mark

CGTalk Moderation
01-19-2006, 10:00 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.