Procedures and scripts
 
 
 

Avoid global procedures

Like global variables, global procedures are susceptible to being modified by any other MEL script that tries to use a global procedure with the same name. If you use global procedures, be sure to use a unique name so that you do not overwrite an existing procedure.

Another potential problem with global procedures is memory requirements. Maya stores in memory every global procedure it encounters. The more global procedures you have loaded, the more memory Maya uses to store them.

Limit procedures and command scripts to 50 lines

To keep your procedures and MEL command scripts tractable, limit them to 50 lines. Exclude any comments or blank lines from your 50-line limit. Procedures and MEL scripts may become too complex when they are over 50 lines.

Limit files to 500 lines

Many MEL scripts contain multiple procedures. For these larger script files, it is a good idea to limit their length to 500 lines. If a file exceeds this length, consider splitting it into multiple files. This keeps your MEL script files manageable.