Maya Training

Introduction to Hard Surface Modeling

Maya Training

Interiors and Furniture Vol 1 & 2 - Modeling & Cloth

Maya Training

Shading, Lighting and Rendering the Bedroom in MR

Maya Training

Robot volume one - Modeling with animation in mind

Maya Training

Spach-Alspaugh House the complete courseware

Maya Training

Burt The Cartoon Dinosaur Vol 01 - Modeling

New Maya Training

Robot Volume 02 - Hybrid Rigging
You are here > Home > SimplyMaya Community Forums
Loading

Welcome to Simply Maya

Please Sign in or Sign up for an account

Member Login

Lost your password?

Not a member yet? Sign Up!

Old 25-10-2004, 07:33 AM   #1
Lifire
Registered User
 
Lifire's Avatar
 
Join Date: Oct 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Default MEL script help

I downloaded a reference plane script...

"Description: this script creates polygon planes with reference images for top, side and front views. Leave the image file name blank if you don't wish to create that plane.

Installation: Extract the zip in your "My Documents/maya/scripts" folder and type "refplanes;" in the command line (or make a shelf button)."

I was attempting to create a shelf button, but after I select the input section and save to shelf, the script doesn't work. When it is clicked it doesn't bring up the dialog box. The only way I can get it to work is through the command line. Any ideas?

Thanks.
__________________
"We don't actually need to know that the main character has a past. All we need to know is that he has an objective and a lot of people are going to die and a lot of innocent inanimate objects are going to be destroyed and blown up before he can complete that objective."
Lifire is offline   Reply With Quote
Old 25-10-2004, 11:10 AM   #2
Alan
Moderator
 
Alan's Avatar
 
Join Date: Oct 2002
Location: London, UK
Posts: 2,800
Thanks: 0
Thanked 5 Times in 5 Posts
Default

you probably dont have it sourced properly try this in your shelf button:

source "/path/to/your/script.mel/"
name_of_the_function

Then drag that to the shelf and try that.

Alan
__________________
Technical Director - Framestore

Currently working on: Your Highness

IMDB
Alan is offline   Reply With Quote
Old 25-10-2004, 11:28 AM   #3
Lifire
Registered User
 
Lifire's Avatar
 
Join Date: Oct 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm not sure exactly what you mean, but I tried variations of what you gave me, and they lead to errors every time. I read in the Maya help that to create a shelf icon for the script you slect the input text (bottom of script editor) then save to shelf.

So, I open the script through the script editor and it displays the code in the input section, and I select that text and save to shelf. The icon doesn't work, and it's odd because it doesn't execute from the script editor either. The only way I have gotten it to work so far is through the command line.

Thanks again.
__________________
"We don't actually need to know that the main character has a past. All we need to know is that he has an objective and a lot of people are going to die and a lot of innocent inanimate objects are going to be destroyed and blown up before he can complete that objective."
Lifire is offline   Reply With Quote
Old 25-10-2004, 03:21 PM   #4
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

You don't put the whole mel script on the shelf. Just save the script in your scripts folder. Open up the script editor. Type these lines in:

source refplanes.mel;
refplanes;

Select the two lines and MMB drag drop them on to your shelf.

(As a matter of fact the first line there is optional...)
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 25-10-2004, 08:38 PM   #5
Lifire
Registered User
 
Lifire's Avatar
 
Join Date: Oct 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks! I just assumed that it was all of the code because, for example if you create a sphere, and copy the code from the script history and save to shelf that's what it will do.

Edit: That method worked for the refplanes script, but I tried that for an X-Ray script and it says, "error cannot find xray.mel for source statement." But if I select all of the code from the script editor and save to shelf it works like that. The two scirpts seem opposite.

Also, there are 2 folders for scripts, one in the 6.0 folder and another in the default my documents maya folder, which would I put the scripts in?
__________________
"We don't actually need to know that the main character has a past. All we need to know is that he has an objective and a lot of people are going to die and a lot of innocent inanimate objects are going to be destroyed and blown up before he can complete that objective."

Last edited by Lifire : 25-10-2004 at 09:59 PM.
Lifire is offline   Reply With Quote
Old 01-11-2004, 05:20 AM   #6
Lifire
Registered User
 
Lifire's Avatar
 
Join Date: Oct 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Anyone know why one script would work like this:

source refplanes.mel;
refplanes;

but not work when saving all of the code to shelf, and another script would work by saving the code to shelf but not by saving the command name to shelf? Why would they be opposite and how can I make the latter of these work by just saving the command name to the shelf?

See example above. The xray.mel script gives me an error when trying to use the command name (script name?).
__________________
"We don't actually need to know that the main character has a past. All we need to know is that he has an objective and a lot of people are going to die and a lot of innocent inanimate objects are going to be destroyed and blown up before he can complete that objective."
Lifire is offline   Reply With Quote
Old 01-11-2004, 07:21 PM   #7
kbrown
Moderator
 
kbrown's Avatar
 
Join Date: Sep 2002
Location: London, UK
Posts: 3,198
Thanks: 0
Thanked 8 Times in 8 Posts
Default

It is because a more complex script is written in procedures and simple shelf buttons are just a list of mel commands or calls to other mel scripts.

In the refplanes.mel case there is a procedure which creates the graphical user interface (GUI) for the script. Then there are several other procedures which carries out the required tasks when the user clicks a button for example.

This is why you save only the refplanes; command to the shelf. It simply calls the entry point of the script (which creates the GUI). The GUI itself knows how to call the other procedures in the script.

A simple shelf button which only prints "Hello world" or toggles x-ray view on and off does not require this kind of procedural structure so it's easier to save it all inside the shelf button itself...

About your folder question. In general, if you know a script works with all versions of Maya, then you should put it in the My Documents/Maya/Scripts folder. If the script only works in Maya 6, you should put it in the other (version specific) folder...
__________________
Kari
- My Website
- My IMDB

Do a lot, Fail a lot and Learn a lot!
kbrown is offline   Reply With Quote
Old 01-11-2004, 07:40 PM   #8
Lifire
Registered User
 
Lifire's Avatar
 
Join Date: Oct 2004
Posts: 68
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks kbrown.
__________________
"We don't actually need to know that the main character has a past. All we need to know is that he has an objective and a lot of people are going to die and a lot of innocent inanimate objects are going to be destroyed and blown up before he can complete that objective."
Lifire is offline   Reply With Quote
Reply


Similar Threads
Thread Thread Starter Forum Replies Last Post
MEL headache! happymat27 Members Lounge 5 05-12-2010 09:43 AM
MEL headache!! happymat27 Mel Scripts & Programming 1 03-12-2010 04:41 PM

Thread Tools





A little bit about who we are
Links you might find useful
Catch up with SimplyMaya
SimplyMaya specialises in Maya tutorials. We offer over 1,000 individual Maya training videos, ranging from basic Maya tutorials through to intermediate Maya tutorials. Our tutorials are created by instructors with industry experience and are designed to get you up and running in Maya quickly without making it seem like hard work.

Copyright © 1999-2015 SimplyMaya - vBulletin® Copyright © 2000-2015, Jelsoft Enterprises Ltd.