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

    Porting a python command plugin to R21

    Cinema 4D SDK
    3
    4
    776
    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.
    • matniedobaM
      matniedoba
      last edited by

      Hey folks,

      I am currently porting a command plugin to C4D R21, because some users reported that it is not working for them. However, on a Mac it works on R21 but I get this error message in the console:

      Traceback (most recent call last):
        File "/Applications/Maxon Cinema 4D R21/PLugins/SelectionToObject/SeletionToObject.pyp", line 271, in <module>
      okyn = plugins.RegisterCommandPlugin(PLUGIN_ID,"Selection to Object",0,bmp,"Selection to Object",SelectionToObject())
      RuntimeError:The plugin ID '1054093999' collides with another plugin ID in 'SeletionToObject'.
      You have to use a unique ID for registering your plugin!
      You can get a personal number for free from PluginCafe at www.plugincafe.com
      

      I already got a new plugin ID from PluginCafe but it does not solve the problem.

      Here is the main function of the plugin, which throws the error:

      PLUGIN_ID = 1054093
      
      if __name__=='__main__':
          bmp=bitmaps.BaseBitmap()
          path, fn = os.path.split(__file__)
          bmp.InitWith(os.path.join(path,"res","Icon.tif"))
          okyn = plugins.RegisterCommandPlugin(PLUGIN_ID,"Selection to Object",0,bmp,"Selection to Object",SelectionToObject())
          if (okyn):
              print "Selection to Object successfully initialized"
      

      Any help would be appreciated. Thank you 🙂

      1 Reply Last reply Reply Quote 0
      • ferdinandF
        ferdinand
        last edited by ferdinand

        Hi,

        I think the most important question is: What does c4d think is registered under these/this ID(s)? You should run c4d.plugins.FindPlugin(your_id) and print the result to the console. Since you said that you have already registered a new ID, I would assume that somehow something else is reading your plugin id constant and using it. Your error message is hinting at that the other registration does seem to come from the same path (SelectionToObject).

        Cheers
        zipit

        MAXON SDK Specialist
        developers.maxon.net

        1 Reply Last reply Reply Quote 0
        • r_giganteR
          r_gigante
          last edited by

          Hi Matthias, thanks for reaching out us.

          With regard to the issue reported a few notes:

          • since R20 it's possible to install plugins in a different folder than <cinema 4d>/plugins: this makes plugin deployment easy
          • since R21 it's possible to use, beside the plugin path definition in the Preference pane, to set the plugin path by using g_additionalmodulepath=<path to the plugin folder> to have Cinema loading specific plugins

          As already pointed out by @zipit, the same id is used twice when Cinema 4D pointing to the option that either another plugin is using the same ID or that the plugin is loaded twice because the plugin search path has been messed.
          I also confirm that the 1054093 ID is used nowhere in Cinema 4D.

          Looking forward your comments, give best.
          R

          Finally, it's not recommended to store in locations like user-owned folder, which doesn't require elevated rights to operate in those folders (like instead it's required in the /Applications folder)

          1 Reply Last reply Reply Quote 0
          • matniedobaM
            matniedoba
            last edited by

            The problem is solved. It was so trivial :D. I unchecked the plugins folder which I added in the preferences. My plugins folder was in the C4D directory, so as you described, it was loaded twice.
            Leaning for me: Never place a custom plugins folder in the C4D directory!
            Recommendation to the SDK team: Maybe you could adjust the error message in the console, which mentions that plugin folders should not be in the C4D directory. I would assume that many users/ devs will place the folder there, because of a habit from older versions.

            Thank you @r_gigante and @zipit for your quick response!

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