Saturday, January 31, 2009

[Maya] The two shelf button to load and unload the plugin

As developing maya plug-in, we need to load the plug-in to maya to test whether it works well or not. Then we need to refine it in VS. Before unloading the plug-in in maya, it will throw errors because the loaded plug-in is not allowed to access!

Therefore, it's better to have load and unload button to ease our process.

 

Load the plugin:
{
string $pluginFile="D:\\Projects\\Maya\\MayaPlugin\\Posts1\\Debug\\Posts1.mll";
loadPlugin $pluginFile;
}


 



Unload the plugin:


{
string $pluginFile="D:\\Projects\\Maya\\MayaPlugin\\Posts1\\Debug\\Posts1.mll";
if(`pluginInfo -query -loaded $pluginFile` && !`pluginInfo -query -unloadOk $pluginFile`)
file -f -new;
unloadPlugin Posts1.mll;
}




The pluginFile is the plug-in file we developed.

No comments:

Post a Comment

Google+