Tuesday, January 12, 2010

autoload ... no, really!

In my experience, about 2/3 of the time, the "autoload" feature of Maya plugins just doesn't seem to work. I load my plugin, check the box for autoload, save and close out Maya normally, re-open Maya, and ... the plugin is not loaded. Grrrr... I would look into it more deeply, except that it's easy to force a plugin to be loaded in each Maya session using userSetup.mel.

First, locate your userSetup.mel file. If it exists, it is located by default in the following directories:

[Windows] Documents and Settings\USERNAME\My Documents\maya\scripts\userSetup.mel
[Mac OS X] USERNAME/Library/Preferences/Alias/maya/scripts/userSetup.mel
[Linux] ~/maya/scripts
/userSetup.mel

If it doesn't exist you can either create it in the appropriate directory above or anywhere in your MAYA_SCRIPTS_PATH. Finally, in the userSetup.mel file, add the following line:

if(!`pluginInfo -q -l -n "PLUGIN_NAME"`) loadPlugin "PLUGIN_NAME";

Mental ray is notorious for not autoloading. Use the following line in userSetup.mel and mental ray and Maya will never forget to load mental ray ever again:

if(!`pluginInfo -q -l -n "Mayatomr"`) loadPlugin "Mayatomr";

You can also use this to autoload mel scripts as well. For example, assuming you have pelting tools installed in your scripts path, add the following line:

source "scripts/peltingToolsSetup.mel"

No comments:

Post a Comment