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
    1. Maxon Developers Forum
    2. sogrady
    3. Posts
    S
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 2
    • Best 0
    • Controversial 0
    • Groups 0

    Posts made by sogrady

    • RE: C4D GUI Python Callback

      Hey,

      thank you for the reply.
      I managed to implement the GetSubContainer() and ExecuteSubID() function.

      However what I don’t get to work is; 
How you would you specify the displayed names of the commands ?

      Before when registering multiple commands, the name was specified in the same step
      e.G.
      
```
      c4d.plugins.RegisterCommandPlugin(id=“PLUGIN_CMD_123456”, str=‘New Command’, info=0, icon=None, help="", dat=self.__callBackInstance)

      
      From the docs the [CommandData.GetSubContainer()](https://developers.maxon.net/docs/py/2023_2/modules/c4d.plugins/BaseData/CommandData/index.html#CommandData.GetSubContainer) looks like the `BaseContainer.SetString(id, s) ` function would do something like that.
      

      bc = BaseContainer()
      bc.SetString(1, "Submenu Test")
      bc.SetString(1000, "First Entry")
      submenu.InsData(0, bc)

      
But I am not entirely sure.
What would be the correct way to pass the command to the container and specify their names ?

thanks in advance
and get busy cafe :)
      posted in Cinema 4D SDK
      S
      sogrady
    • C4D GUI Python Callback

      Hi Folks,

      We trying to call a python script from the menu bar.

      From in this example
      https://developers.maxon.net/docs/py/2023_2/misc/pluginstructure.html?highlight=pluginmessage#PluginMessage
      a python script can be attached to a container via

      menu.InsData(c4d.MENURESOURCE_COMMAND, "IDM_NEU")*

      To attach an external python script to a button of the menu I needs to be registered as a plugin
      with a unique plugin ID (e.G. 123456)

      menu.InsData(c4d.MENURESOURCE_COMMAND, "PLUGIN_CMD_123456")

      Does this mean for each button added to the menu bar, you have to register a new plugin with a unique ID in order to attach a callback to it ?
      Or is there a more convenient way of doing this ?

      *e.G. menu.InsData(c4d.MENURESOURCE_COMMAND, callbackFunction(args))

      Thank for your help

      posted in Cinema 4D SDK python
      S
      sogrady