How to add item to a menu created by another plugin
-
Dear all,
I'm trying to test existence of a menu created by another plugin.
The goal is to share same menu from different plugins, and create the menu if not already done by the other plugin, and add items to it.
UI.menu returns id for plugins menu. Can it be used for non Sketchup menus ?
I made some tests but did not succeeded. Has somebody already done this ?
Yours
Pascal -
Unfortunately this is currently not possible due to limitations of how menus are initialized internally in SketchUp.
Can you describe the use case for adding your own menu items to another plugin's menu?
-
Hi Tom,
The goal is to share menus between 2 plugins (for exemple 2 plugins from the same author), but that can be installed separately with no require link from one to the other.
Idealy they (each plugin) even dont need to know the existence of the other, but want to share same submenu to not add too long list to the SU Plugins Menu.
Any idea appreciated.
Yours
pascal -
If one of the plugins store the reference to it's submenu to and instance variable and implement a getter for that then it is possible for another plugin to get that plugin and attach more menus during startup. However, you only get once chance. After SketchUp has loaded the plugins during startup the menu references are useless.
-
I do this with my plugins. They all get installed in a submenu called "CLF Tools" or something. It is possible because I know how to check to see if that submenu object exists. Then add to it if it does exist, or create it if it does not exist.
So if you want to create a generic submenu system that others can use, like "Edge Plugins", you would have to set that up and others would have to implement your same system. In other words, the idea of plugins not knowing about the existence of one another is not likely, since they would have to work together.
-
@chris fullmer said:
I do this with my plugins. They all get installed in a submenu called "CLF Tools" or something.
This is what I would like to achieve.
@chris fullmer said:
It is possible because I know how to check to see if that submenu object exists. Then add to it if it does exist, or create it if it does not exist.
Do not understand how you do this if the other plugin is not installed or not already loaded by SU ?
But I will have a look at Edge to see if I understand how it works.
Thanks for your answer
Pascal
Advertisement