EnchanceMenu Questions
-
hi,
well it's not really possible. The pluginMenu (Extension menu since S22) is dynamic.
It is possible to insert your plugin before the plugin list like so.
But if you pop out the menu, it will appear like so:
you have to search for a command that have the following stringIDM_PLUGINS
auto GetLastItem = [&pluginTitle, &GetTileFromContainer](const BaseContainer* bc) -> GeData* { iferr_scope_handler { return nullptr; }; Int32 id; GeData* dat; GeData* res = nullptr; BrowseContainer browse(bc); // Int32 countToThree = 0; while (browse.GetNext(&id, &dat)) { if (id == MENURESOURCE_COMMAND) { const String commandString = dat->GetString(); if (commandString.Compare("IDM_PLUGINS"_s) == maxon::COMPARERESULT::EQUAL) return res; } else { res = dat; } } return nullptr; };
Cheers,
Manuel -
Hi @m_magalhaes, I think I understand that part, but the limitation seems to harsh.
To go back to a more clear example, there is the Arnold plugin folder.
So just so I completely understand I have two questions. How is this structure done? I know if you have multiple plugins than the top level folder is created, but if this isn't being done in EnhanceMainMenu fashion I don't get it.
Second, would it be possible to do this same sort of layout, but across multiple complies. Imagine if the Arnold Light tools came out later. Would it be possible to put it in this layout?
Thanks for sticking through this so far!
Dan
-
hi,
I don't have the code of how they are doing it, but it seems those are CommandData using GetSubcontainer and ExecuteSubID to execute the proper command. This will create a menu for each entry that you define in the GetSubcontainer function. (note that this doesn't work currently in python)
You could maybe use the Message function to react and build an private data stored in your command. But it seems not possible to send a message to a CommandData.
If you want your user to "group" your plugins, they can just create a parent directory for all of them.
plugins>parent>plugin1Folder
plugins>parent>plugin2FolderThat will Create a submenu called "parent" to the Extension menu.
I don't think what you are trying to do is possible.
Cheers,
Manuel -
Hi @m_magalhaes, I was running a bunch of different tests and trying to figure some stuff out on my own, but I'm back with what I think are my last three questions on this topic.
I was able to create this, and it seems to be working pretty well, but I have to have two plugins registered.
Bool PluginStart() { if(!RegisterCommandTest1())//empty, not doing anything return FALSE; if(!RegisterCommandTest2())// making the menu return FALSE; return TRUE; }
Even though the RegisterCommandTest1() plugin is doing nothing if I doubt register two plugins in the complile the menu isn't created. Even if I use PLUGINFLAG_HIDE on RegisterCommandTest1() the menu still isn't created.
Is there a way to create the menu with only one plugin being registered?
My other question is with how I'm making the Cube entry in the first picture using
bc.InsData(Ocube, "CMD");
This seems like the easiest way to create entries for plugins, but if the plugin is hidden with PLUGINFLAG_HIDE, it also doesn't sure up in this menu, is there a way around this?
And if not, how is an icon attached to an entry? I find some posts about the issue and some information in the Python SDK, but I wasn't able to get any of it working in C++.
Thank you so much for the help through this!
Dan -
I was doing more testing and I realized I should be using PLUGINFLAG_HIDEPLUGINMENU not PLUGINFLAG_HIDE, so ignore the part about that, sorry!
-
hi,
Is there a way to create the menu with only one plugin being registered?
no, you need to register two plugins to be sure to have the folder in the menu and none have to be hidden of course. The "problem" you will not be able to detach this submenu. (by clicking the doted line on the top of the menu)
And if not, how is an icon attached to an entry?
The icon will be the icon registered when you register the plugin itself, it's automatic. This is the way you add it to your menu
bc.InsData(MENURESOURCE_COMMAND, maxon::String("PLUGIN_CMD_1021433")); // character bc.InsData(MENURESOURCE_COMMAND, maxon::String("PLUGIN_CMD_5159")); // cube
Do you want to display another icon than the one you register your plugin with ?
yes, use PLUGINFLAG_HIDEPLUGINMENU
Cheers,
Manuel -
Do you want to display another icon than the one you register your plugin with ?
I was mostly just curious to how you would do it.
Although would the case be that if you want an icon you do it as a command and make a plugin?
And if you don't want an icon you could just react to it via ExecuteSubID?
Dan
-
hi,
in both case you need to add an action in ExecuteSubID. If you register the command you will just call it, otherwise you have to execute some code.
I would say that it's better to register your own CommandData, it will be icon ready and easier if you want to move it to another plugins package.
Cheers,
Manuel -
Hello @d_schmidt,
without any further questions, we will consider this topic as solved by Monday and flag it accordingly.
Thank you for your understanding,
Ferdinand -
Hi! Sorry about not replying and closing the topic. This has been solved. Thank you for all the help!