Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    How to add custom command to menu?

    PYTHON Development
    0
    4
    714
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        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

        1 Reply Last reply Reply Quote 0
        • H
          Helper
          last edited by

          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?

          1 Reply Last reply Reply Quote 0
          • H
            Helper
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • First post
              Last post