How to add custom command to menu?



  • On 03/07/2014 at 10:29, xxxxxxxx wrote:

    Hello, I've followed the C4D example on creating custom menus from within a plugin...

    http://code.vonc.fr/c4d/python/help/misc/pluginstructure.html

    This is great if I want to duplicate menu items that are already available in C4D, but what if I want to have it execute scripts I've written?  I'm doing this in a plugin, and I registered a plugin ID, but I'm not really sure how to get that into the proper syntax, and for whatever reason, it seems to be so poorly implemented that I can't just give it the function or class name to execute, although I'm not sure why it was apparently set up like that?  But maybe I'm just missing something.



  • On 03/07/2014 at 11:29, xxxxxxxx wrote:

    To execute a script from a menu.
    First get the ID# for the script by opening the script log then running the script.
    The script log will show this: CallCommand(your script's ID# here)

    Then in your menu plugin code.
    Replace: "PLUGIN_CMD_5159"  
    with:       "PLUGIN_CMD_your script's ID# here"

    -ScottA



  • On 03/07/2014 at 11:51, xxxxxxxx wrote:

    Well, it's a plugin, so it's not a script I'd ever be manually running.  Also, it seems like that would only give an ID that is useful within the current session, and that it could/would have a different ID number for a new session, or for another user who runs the plugin on another machine...  Right?



  • On 03/07/2014 at 12:22, xxxxxxxx wrote:

    Well...You did ask how to run a script. Not a plugin. 🙂

    Originally posted by xxxxxxxx

    what if I want to have it execute scripts I've written?

    But if you want to execute a plugin.
    Use: "PLUGIN_CMD_Your Plugin ID# here"

    -ScottA


Log in to reply