mercoledì 1 dicembre 2010

Shelf buttons for loading and unloading Maya plugins

Shelf buttons for loading and unloading Maya plugins are very useful and, as a matter of fact, I use them every day.  I'd want to clarify that this method is not mine, but I don't remember where I read it, so I cannot give notice of copyright nor the right credits. I hope to correct this post as soon as possible.

Loading the plugin: we can copy (fixing the path to the plugin) the following lines to the Script Editor, select the text and drag it to the Shelf Bar:
{
    string $pluginFile = "c:\\path\\to\\plugin.mll";
    loadPlugin $pluginFile;
}
Unloading the plugin: same as above.
{
     string $pluginFile = "c:\\path\\to\\plugin.mll";
     if ( `pluginInfo -query -loaded $pluginFile` &&!
          `pluginInfo -query -unloadOk $pluginFile` )
         file -f -new;
     unloadPlugin plugin.mll;
}

Best regards.