Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python 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

    Calling custom plugin methods from another plugin

    Scheduled Pinned Locked Moved PYTHON Development
    3 Posts 0 Posters 671 Views
    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 Offline
      Helper
      last edited by

      On 26/03/2018 at 04:56, xxxxxxxx wrote:

      Hi Everyone!

      Suppose you have a custom point object generator plugin, derived from c4d.plugins.ObjectData. Lets call it MyPlugin. It has some custom data and methods.
      There is also a tool plugin which should operate on MyPlugin. In the tool plugin I would like to receive some internal data (like multiple spline objects) from my object plugin. So, I want to call a custom method like GetSomeCustomData() of MyPlugin. This is not possible from within the tool plugin because the tool operates on the selected object, which will be identified as a c4d.PointObject (which has no GetSomeCustomData() method).
      I'm aware that I can use messages to communicate between objects, but is there a more direct way to access the data of my object plugin from within the tool plugin?

      I tried to cast the c4d.PointObject to MyPlugin with selectedObj.__class__ = MyPlugin, but without success.

      Any ideas?

      Best regards
      Tim

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

        On 27/03/2018 at 02:24, xxxxxxxx wrote:

        Hi Tim,

        yes, there are few ideas.
        First of all, you could simply store information in the BaseContainer of your point object generator. This can then be easily accessed from where ever you want.
        In a similar direction, but without storing additional information, you can override GetDParameter() for your point object generator, allowing access to arbitrary information via GetParameter().

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

          On 28/03/2018 at 07:26, xxxxxxxx wrote:

          Thanks Andreas!

          I will check out both of your helpful suggestions.

          Best regards
          Tim

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