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

    Are PluginStart() and PluginEnd() only for C++ plugins?

    General Talk
    python r21
    3
    4
    762
    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
      heilei
      last edited by heilei

      Maxon's Python plugin structure page

      https://developers.maxon.net/docs/py/2023_2/misc/pluginstructure.html#plugin-messages

      mentions three different API calls PluginStart(), PluginEnd() and PluginMessage() in the message ID section. However, all the Python examples that I've found only implement PluginMessage(). Does this mean, that only PluginMessage() applies to Python plugins, and the other two are for C++ plugins only? I wrote a small Python test plugin with all three functions, and only PluginMessage() was ever called (with different message IDs).

      I have tried to find some verification for this in Maxon's SDK documentation but haven't found anything so far (but I'm pretty new with this, so I might have missed something relevant...)

      1 Reply Last reply Reply Quote 0
      • M
        mp5gosu
        last edited by mp5gosu

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • r_giganteR
          r_gigante
          last edited by

          Hi @hellei, thanks for reaching out us.

          With regard to your question, although the documentation mentions PluginStart() and PluginEnd() respectively with regard to C4DPL_INIT and C4DPL_END, both functions and messages are not supported on Python due to design of the Python implementation on Cinema which is - in the end - itself a plugin.

          I instead suggest - in PluginMessage() - intercepting C4DPL_INIT_SYS, C4DPL_STARTACTIVITY and C4DPL_ENDACTIVITY which are indeed supported and fired across the lifecycle of the plugin.

          Finally please note that to you have to register your plugin in the main python function rather than in the PluginStart as done in C++

          ...
          if __name__ == "__main__":
              c4d.plugins.RegisterCommandPlugin(..., ..., ..., ..., ..., ...)
          ...
          

          Cheers, R

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

            Ok, got it. Thank you for your reply and clear explanation, r_gigante, much appreciated!

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