Managing numerous and complex MEL scripts and plug-ins can become difficult and inconsistent in production environments. The following steps will ensure that your MEL scripts get sourced and your plug-ins will get loaded without error and with consistency throughout your production environment.
1) Recommended method for MEL scripting:
# Create several local procs in a .mel file.
# At the end of the file write one global proc that connects/calls to all these local procs.
# Name the global proc with the same name as that of the .mel file.
# Put the .mel file in one of the places listed under MAYA_SCRIPT_PATH.
The file testProc.mel should look like:
proc proc1()
{
print ("\n proc1");
}
proc proc2()
{
print ("\n proc2");
}
global proc testProc()
{
print ("\n testProc");
proc1;
proc2;
}
Now keep in mind that the order does matter. If the global proc was at the beginning of the script then this will not work. Notice that the source statement does not appear anywhere yet. This is the way most of the scripts that come with the Maya are written. Adding a new MEL file for every new global proc makes things predictable and reliable.
Comments
You can follow this conversation by subscribing to the comment feed for this post.