submenu for python plugin



  • Hi Yannick,

    this is a follow up from the old forums thread...

    goal is to get a (single) command plugin to have a submenu

    you mentioned this example
    https://developers.maxon.net/docs/Cinema4DPythonSDK/html/misc/pluginstructure.html#enhancing-the-main-menu

    i got that running in my plugin and it adds a menu in the main menu bar after plugins.
    but isn't it possible to add my menu "normally" under plugins/plugins?

    if i iterate the plugin menu bc i get:
    4 IDS_EDITOR_PLUGINS
    3 IDM_EXECUTE_LAST
    2 1
    3 IDM_PLUGINS
    2 1
    3 PLUGIN_CMD_12302
    3 PLUGIN_CMD_1026375

    so the plugin list is not displayed directly here, they are all joined together under IDM_PLUGINS,
    (which probably corresponds to PLUGIN_CMD_53000 or CMD_53000 ?)

    --> is there a way to add my command plugins menu under IDM_PLUGINS ?
    and how would i get the bc of IDM_PLUGINS to work with it ?

    best, index

    ps. off topic :
    the old forums content will not be ported over? (there was a lot of know how there)
    and to separate python and c++ is not planned?


  • Global Moderator

    Hi,

    Glad to see you here in the new Plugin Cafe.

    The plugins that don't register with PLUGINFLAG_HIDEPLUGINMENU are dynamically inserted into "Plugins" menu at IDM_PLUGINS.
    It doesn't make sense to register a plugin with PLUGINFLAG_HIDEPLUGINMENU and then to add it to the "Plugins" menu.

    But there is an issue with the "Plugins" menu and registering in a plugin only one CommandData that returns a sub-menu structure with GetSubContainer().
    A solution would be to convert each sub-id of your command plugin to an individual command. Then Cinema 4D would generate dynamically the sub-menu structure for your plugin and its registered commands.

    (Note the old PluginCafé platform content is located in the category Legacy Forum.)



  • hm, not giving up, yet...

    to get : plugins/plugins/myplugin (with submenus)
    i thought i could maybe manipulate the bc of plugins/plugins (IDM_PLUGINS)

    it would make sense if you can inject the plugin name with a submenu
    and then process it with GetSubContainer()

    from your answer i dont really get if that would work or not... (but i guess not)

    i tried to test that but couldn't even get the bc of plugins/plugins (IDM_PLUGINS)

    best, index


  • Global Moderator

    Hi,

    The menu container that replaces IDM_PLUGINS is dynamically built by Cinema and there's no way to access it. And it makes no sense to try to change it.

    The problem here is there is an issue with GetSubContainer() in the case there is only one command registered from a plugin.
    Have you tried the solution I explained in my last post?



  • ... you mean adding each submenu item as individual command?
    yes.. and i understand the logic of the thinking.

    but its kind of odd too, because i have a lot of submenu items
    and i'd have to register an id for each of them.

    i must think about if i should go that way or use my popupmenu solution

    with the latter i have my main menu item under plugins/plugins,
    and if i click it i get the popupmenu with all the options.

    best index


  • Global Moderator

    Hi,

    I'm afraid there's a problem with plugins that register a single command and then return a submenu with GetSubContainer(). This issue has been reported.

    I agree it's not the best solution to convert each subid as a command but that's the only workaround.



  • yup.. well..
    i dont expect that to change very soon... so i guess we have to live with it
    still thanks for your patient support :)