Enhance Menu in the Plugin Menu
-
On 21/06/2018 at 14:33, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 14
Platform: Mac ;
Language(s) : C++ ;---------
Hello, I'm trying to get more control of how my plugins look in the Plugins Menu. I want to be able to have different plugins within different folders within the same compile. I was hoping to be able to use the EnhanceMainMenu() example function from the cinema4dsdk examples to achieve this.So I want to create a folder under Plugins, not in the Menu bar. My current issue is that it always adds the folder, named here "At the Bottom", to the bottom of the Plugins Menu, instead of between the separators. I'd want the folder being inserted above or below "Cinema4dsdk" in this example.
Any help would be appreciated!
My current code:
void EnhanceMainMenu(void) { BaseContainer *bc; bc = SearchPluginMenuResource()->GetContainer(); if (SearchMenuResource(bc,String("PLUGIN_CMD_1000472"))) return; //I think this is whats wrong, not sure what to do GeData *last = SearchPluginSubMenuResource(String("IDM_EXECUTE_LAST")); if (last) { BaseContainer sc; sc.InsData(MENURESOURCE_SUBTITLE,String("SDK Test")); sc.InsData(MENURESOURCE_COMMAND,String("IDM_NEU")); // add C4D's new scene command to menu sc.InsData(MENURESOURCE_SEPERATOR,TRUE); sc.InsData(MENURESOURCE_COMMAND,String("PLUGIN_CMD_1000472")); // add ActiveObject dialog to menu bc->InsDataAfter(MENURESOURCE_STRING,sc,last); } else // user killed plugin menu - add as last overall entry { BaseContainer sc; sc.InsData(MENURESOURCE_SUBTITLE,String("At the Bottom"));//To show that it's not working sc.InsData(MENURESOURCE_COMMAND,String("IDM_NEU")); // add C4D's new scene command to menu sc.InsData(MENURESOURCE_SEPERATOR,TRUE); sc.InsData(MENURESOURCE_COMMAND,String("PLUGIN_CMD_1000472")); // add ActiveObject dialog to menu bc->InsData(MENURESOURCE_STRING,sc); } }
-
On 21/06/2018 at 22:45, xxxxxxxx wrote:
I have several plugins that show up with sub menu entries. As far as I remember I didn't use EnhanceMainMenu to achieve this. Just register the different plugins in your PluginStart, and they all should appear as child of the main plugin entry. Additionally, (in my cases) the main plugin entry is exactly where you wish these should appear ... without performing anything specific.
The only thing I did was to add an ordering to the list of the sub menu items.
https://s20.postimg.cc/jlrvfe85p/plugin_sub_menu.png
In case of PolyGnome following are the string entries to sort the 3 plugins, using the "#$xx" prepending to sort them according value.
STRINGTABLE { // sorted entries in the plugin menu IDS_POLYGNOME_SORTED "#$01PolyGnome"; IDS_JUNKYARD_SORTED "#$02Junkyard"; IDS_ASSETIZER_SORTED "#$03Assetizer";
These are the strings used during registering the plugin via RegisterCommandPlugin()
-
On 22/06/2018 at 09:11, xxxxxxxx wrote:
Hi,
in general C4Ds is right, the plugins menu content is dynamically built and four grouping of plugins one does not need to do anything special, except having all plugins in one sub-folder in the plugins folder.
But I read the original question a bit differently. I think it's more about sorting the top level of the Plugins menu and having several plugins implemented in a single executable sorted into multiple sub-menus. That's probably not possible with the Plugins menu due to its dynamic nature.
Instead you could create your own menu in the main menu bar (note though, Cinema 4D knows a plethora of menu bar layouts belonging to different managers and/or window layouts).
I'll post some example code how to add to the main menu next week. -
On 25/06/2018 at 08:53, xxxxxxxx wrote:
Hi Andreas,
I was trying to get the "#$xx" prepending to work in the past but it didn't seem to be doing what I wanted exactly. The second picture you linked is what I'm trying to achieve in a single compile.
FOLDER
PLUGIN 1
PLUGIN 2
SUBSUBFOLDER
PLUGIN 3
PLUGIN 4
PLUGIN 5From my attempts I was only able to get different subsubfolders with a separate compile and then I couldn't order them, the subsubfolders, so they weren't at the top of my folder. Is this layout possible with just the "#$xx" prepending?
-
On 26/06/2018 at 08:13, xxxxxxxx wrote:
Hi,
just to re-assure, C4DS, I guess, the "sub-sub-menus" were done via sub-commands, right?
So, these are basically the options you have in the Plugins menu. All plugins from one folder in the plugins directory, regardless if these are in one or multiple binaries, will appear in a folder in Plugins menu. These can be reordered as shown by C4DS, in you case these would be PLUGIN1, PLUGIN 2 and PLUGIN 5. The SUBSUBFOLDER (also visible in C4DS' screenshot on the right) to my knowledge can only be realized by sub-commands of a CommandData (GetSubContainer() and ExecuteSubID()). For ObjectData plugins for example I don't think this is directly possible. On the other hand you could hide such from the Plugins menu (PLUGINFLAG_HIDEPLUGINMENU) and then have commands creating these...
-
On 26/06/2018 at 10:24, xxxxxxxx wrote:
Ooooh-kay!
I didn't mean to bring up the sub-sub-menu thing by providing the screenshot I made. My only meaning was to show that by default my plugins (multiple plugins in one executable) are listed in the required location between the separators.But OK, let's provide some details for that screenshot.
For the PolyGnome plugin, I simply register the different plugins (all CommandDatas) in the PluginStart of one executable. This gives a single entry in the main plugins folder, with the name that of the single executable.
For the Seamilar plugin, I used a separate CommandData which implements GetSubContainer and ExecuteSubID.
But I am not sure I would ever do that again in a next plugin, as the sub-sub-menu does have some side effects. -
On 27/06/2018 at 08:03, xxxxxxxx wrote:
Thanks for the info, C4DS.
May I ask, which side effects you encountered with sub-commands? So far we aren't aware of any. -
On 27/06/2018 at 11:55, xxxxxxxx wrote:
Sorry Andreas, I don't have the details at hand. All issues were feedback from my plugin customers.
I remember vaguely an issue where undocking the plugin submenu resulted in some confusions to the customer. No more details I am afraid, but I just tried and it all comes back to me now.
With my Seamilar plugin, when I select the main plugin in the Cinema 4D plugins menu, the sub menu is shown, including the (collapsed) sub-sub menus.
If I now click on the "dot-bars"of the sub-menu, actually undocking the sub-menu, I loose the sub-sub menus.
Probably something missing in my code ... I guess.Another point was that the using multi key short-cuts and "#$xx" to sort the plugins did display that sorting number in the short-cut popup window ... I think I mentioned it here at the forum and it was confirmed to be a bug. This might already be resolved, however.
I am trying to perform a search on these topics I but am unlucky in finding back these specific posts.
-
On 28/06/2018 at 09:56, xxxxxxxx wrote:
No need to be sorry. Quite the opposite. Thanks for taking the time and pointing this out to us. Really appreciated.