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



  • Maxon's Python plugin structure page

    https://developers.maxon.net/docs/Cinema4DPythonSDK/html/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...)



  • This post is deleted!


  • 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



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


Log in to reply