PDA

View Full Version : rules re: global procs and script naming


supersteve3d
12-13-2006, 07:54 AM
Hi all,

I am making a few short macro scripts. They are enclosed by a single global procedure. Are there rules where the name of the .mel file itself *MUST* be the same as the global procedure name?

ie. global proc abc()

must reside in a file of the same name abc.mel. I wouldn't think so, but I have noticed some scripts are able to get away with different names in both. Is this a rule?

I should also add that this is meant to be bound to a hotkey where I call the proc by its name - eg. abc;

Allpeace
12-13-2006, 09:15 AM
No, the file doesn't have to have the same name as the global procedure. You can for example have several different global procedures in one .mel file.

But, if your procedure is named different than the .mel file, Maya won't be able to find it unless you source your .mel file first.

If you still want them to use different names, you can let your hotkey source the .mel file first, and then call the procedure:

source myMacro.mel;
abc;


If you have several different global procedures i a .mel file, and one of them is named the same as the .mel file itself, calling this procedure will also source the other global procedures in that file. Hope it makes sense...

//Alfred

supersteve3d
12-13-2006, 11:43 PM
Thanks Alfred! That is very clear.

Cheers,
Steve.

tbaypaul
12-14-2006, 09:10 PM
you can also create this type of "library" by amending the file name with the procedure name...ala library.mel contains library_procedure1(), library_procedure2()....etc....which offers a more organized naming approach for later on, once you forget about where you put that small bit you want to copy. The call being the specific procedure ie. library_procedure2;

CGTalk Moderation
12-14-2006, 09:10 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.