mll plugin unload -> compile -> reload without Maya restart


#1

Hi,
as the title suggests I have bumped into this “problem” when developing a C++ plugin for Maya. I would very much like if it wasn’t necessary to restart Maya when I need to recompile and reload a plugin that has already been loaded into Maya. Is this possible?
I remember that when I was starting with Maya plugin development and I used DeclareSimpleCommand macro to make a very simple command, I didn’t have this problem: I was able to unload the plugin in Plug-in Manager, recompile the plugin in Visual Studio and then reload the plugin back. Now I have a little bit more complicated plugin (that declares 3 commands and one custom node). I can unload this plugin without a problem (the checkbox in Plug-in Manager in unchecked) but when I try to compile I get “Cannot open *.mll for writing” error (and when I try to delete the mll I get the Windows message that some program is still using this file).
Am I doing something wrong or is Maya restart with every recompilation a part of the development workflow?

Thank you very much for any help,
David.


#2

I dont do this alot, but usually as long as I flush the undo queue (ie new scene) before unloading the plugin, then I can overwrite the mll and reload it to test a new iteration.

David


#3

Check out this:

http://forums.cgsociety.org/showthread.php?f=89&t=1055175&page=1&pp=15

While currently I’m using something simpler:

http://forums.cgsociety.org/showthread.php?f=89&t=1353747

and my post-build.bat is

commandPort.exe source "SpaceDeformation2D.mel"; loadMostRecentModelAndPlugin();
echo commandPort.exe source "SpaceDeformation2D.mel"; loadMostRecentModelAndPlugin();

where

global proc loadMostRecentModelAndPlugin()
{
	string $RecentFiles[] = `optionVar -query "RecentFilesList"`;
	int $nNumItems = size($RecentFiles);
	string $lastFile = $RecentFiles[$nNumItems-1];
	file -open -force $lastFile;

	loadPluginIfNotLoaded();
}


global proc loadPluginIfNotLoaded()
{
	int $isLoaded = `pluginInfo - q - loaded "SpaceDeformation2D.mll"`;

	if(!$isLoaded)
	{
		loadPlugin "SpaceDeformation2D.mll";
	}
}


#4

Thanks! This looks promising. I tried some of it and it looks like it might work for me - I installed cygwin and the “rm” command indeed deletes the file even if Maya still “holds it”. Which is good for my case…

However, I don’t know what “commandPort.exe” is. I can’t google to any official documentation about this and all the links that I find on google is what you wrote when helping people in other threads. Would you mind guiding me a little bit to what this program is, what is it part of?

djx: I tried using the flushUndo command but it doesn’t help me, I still can’t overwrite or delete the mll file…


#5

Hi all

Haven’t been on win for years but for nix/osx it seems to be enough to just make a new scene, unload the plugin and flushUndo.

EDIT: just like David suggested.

That’s about it.

Of course if you’re doing something fancy like MS NET - stuff then I’m way off the table :slight_smile:

/Risto


#6

The commandPort is an external util that sends commands to maya from the command line. I can put it somewhere, but maybe you give a try first to my python script

http://svn.code.sf.net/p/mymayaplugins/code-0/trunk/standalone-scripts/commandPort.py