I've solved that problem here with a separate plugin.

Related to past discussions, I usually set up my workgroup like this:

Workgroup
                Application
                                Plugins
                                                Commands
                                                Events
                                                Filters
                                                Properties
                                                Operators
                                                Queries
                                                ShaderDefs
                                                Etc...
                                                0_NC_ToolsUpdate.js


I have one plugin which resides in the root of /Plugins whose only job is to 
update plugins in the subfolders of /Plugins (0_NC_ToolsUpdate.js).  Whenever 
the plugin is run, all the subfolders are deleted and replaced with the latest 
version from source control, then UpdatePlugins() is called to refresh the 
Softimage session.  If you want to go more granular to target specific plugins, 
or use different logic to decide what to update, you can do that too inside of 
your update tool.

I just make sure to name the update plugin with a leading zero to ensure it 
gets parsed first in the workgroup upon startup of Softimage.  If you have any 
commands or other plugins which need to be parsed before others, then put them 
in a subfolder called '0_startup' or whatever you like.  I have one plugin 
(command) which defines all global variables for our custom tools and put that 
tool in 0_startup to ensure it's loaded first so other tools requesting 
information will have it available upon initialization.

Just like the issue you're encountering with the menu not being able to update 
itself, the update tools plugin (0_NC_ToolsUpdate.js) is updated periodically 
using an event which is triggered on termination of Softimage.

Matt







From: softimage-boun...@listproc.autodesk.com 
[mailto:softimage-boun...@listproc.autodesk.com] On Behalf Of Bradley Gabe
Sent: Tuesday, February 12, 2013 2:18 PM
To: softimage@listproc.autodesk.com
Subject: Menu with a Callback to rebuild Itself?

In the past, I've been able to reset custom Menus by isolating their init 
callbacks into a Plugin, then running:
Application.UnloadPlugin(MenuPath)
Application.LoadPlugin(MenuPath)

which effectively resets the Menu.

Now I have a situation where I need to be able to rebuild the Menu by running a 
callback item that lives within that same Menu.
Obviously, Softimage doesn't like this, and crashes out to desktop if I try to 
Unload the Plugin from which the Plugin itself is being called.

However, I thought there might be ways around this. I tried creating an Event 
that watches for when a Command has completed. Then I could run a command from 
that Menu, and it would be the Event, and not the Menu callback that does the 
Plugin Unload/Load. Sadly, this is also leading to a crash to desktop.

Does anyone have a strategy for me to try?

-B

Reply via email to