PDA

View Full Version : "Create2.mel" line 22.1: Syntax error....:(


annaleah
09-12-2005, 06:39 AM
Hi...its me still messing around with the main menu....
I had this in the main menu without the scripting.I had a simple menu item like first and had it attached to the main menu which is great...now when I put this script in my script folder and userset up as Create2; it first doesnt allow anything else to load and second gives me an error when i source it from inside maya....Somewhere at the end of the script there is a mistake and im thinking it has to do with me not knowing how to make the menu item select and complete the torus part of the script..

Can anyone spot whats going on?




global proc create2;()

{

source Create2;

global string $gMainWindow;

setParent $gMainWindow;

menu -l "Create2"

-p MayaWindow

-to 1

-aob true

create2Menu;

menuItem -l "Create2-Primative"

-ann "PolyTorus"

-echoCommand true

-c "polyTorus"

polyTorusItem;

}

global proc polyTorus;()

{

polyTorus -r 1 -sr 0.5 -tw 225 -sx 4 -sy 4 -ax 0 0 1 -tx 1 -ch 1;

rotate 0 0 45;

makeIdentity -apply true -t 1 -r 1 -s 1 -n 0;

}

harmless
09-13-2005, 01:13 AM
The syntax for a global proc is:
global proc RETURN_TYPE NAME(ARGS)

In your script you have accidentally added a ";" between the proc name and the arguments.
global proc create2;() //error
global proc create2() //correct

You also try to source the procedure from within the procedure
global proc foo()
{
source foo; //error
}

If you want to source your script, do it before you call the script.
source foo; //read procedure foo into memory
foo; //execute the procedure foo

Paste this modified version into the script editor, it runs correctly:

global proc create2()
{
global string $gMainWindow;
setParent $gMainWindow;
menu -l "Create2"
-p MayaWindow
-to 1
-aob true
create2Menu;
menuItem -l "Create2-Primitive"
-ann "PolyTorus"
-echoCommand true
-c "polyTorus"
polyTorusItem;
}

global proc polyTorus()
{
polyTorus -r 1 -sr 0.5 -tw 225 -sx 4 -sy 4 -ax 0 0 1 -tx 1 -ch 1;
rotate 0 0 45;
makeIdentity -apply true -t 1 -r 1 -s 1 -n 0;
}
create2;

annaleah
09-13-2005, 02:22 AM
Oh thanks....:thumbsup:

CGTalk Moderation
09-13-2005, 02:22 AM
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.