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
    • Recent
    • Tags
    • Users
    • Login

    insert a custom generator into document

    Scheduled Pinned Locked Moved SDK Help
    4 Posts 0 Posters 331 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

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 09/06/2009 at 10:18, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   11 
      Platform:   Windows  ;   
      Language(s) :     C++  ;

      ---------
      Hello,

      I have built my own custom generator (object plugin derived from ObjectData), registered and working. I can add that generator to my document by clicking on the menu item that was automatically created, but what I want is to insert a new object of that generator type into the currently active document by some other command plugin (i.e. not by user-click, but by function-call).

      So far I have encountered the following problems:
      - Obviously, I can only add objects with baseclass 'BaseObject' to the document by calling
      void InsertCreateObject(BaseDocument* doc, BaseObject* op, BaseObject* activeobj = NULL)
      but unfortunately, my object plugin has to be of baseclass 'ObjectData' which has nothing in common with 'BaseObject', so I can't add my object plugin here.

      - my generator class contains a referenced BaseObject (accessible by the Get() function of NodeData) if it was created by the menu entry, but NOT if I create a new instance with gNew
      i.e.:
      MyGenerator *myGen = (MyGenerator* )(MyGenerator::Alloc());
      BaseObject *object = (BaseObject* )myGen->Get();
      *** object is NULL here ***

      I was searching for hours, but it seems as if noone ever had this problem before. Or maybe I am missing something... ???

      Cheers

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

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 09/06/2009 at 10:19, xxxxxxxx wrote:

        Why don't you just use BaseObject::Alloc(PLUGIN_ID) ?

        Greetings,
        Jack

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

          THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

          On 09/06/2009 at 10:29, xxxxxxxx wrote:

          can you hear that periodical thumping? That's my head trying to crack through the wooden plate of my desk!

          I've seen the parameter of the Alloc function, but I was so sure that it only works with the built-in objects that I didn't even try it.

          Now that I tried, it worked instantly!

          Thanks a lot Jack, you saved my day 🙂

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

            THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

            On 09/06/2009 at 14:19, xxxxxxxx wrote:

            Glad I could help 😉

            Cheers,
            Jack

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