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
    • Register
    • Login

    Creating InstanceObjects

    Scheduled Pinned Locked Moved SDK Help
    8 Posts 0 Posters 521 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 10/01/2005 at 02:53, xxxxxxxx wrote:

      User Information:
      Cinema 4D Version:   8.100 
      Platform:      
      Language(s) :   C.O.F.F.E.E  ;

      ---------
      Hello,

      I'm trying to create InstanceObjects. The creation is working, but I can't set the Sourceobject. Can anyone please tell me how to do this?

      My code looks like that:
      newinstance = new(InstanceObject);
      newinstance->SetName("blaa");
      container = newinstance->GetContainer();
      container->SetData(INSTANCEOBJECT_SOURCE, "Sat");
      newinstance->SetContainer(container);

      doc->InsertObject(newinstance,NULL,NULL);

      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 10/01/2005 at 04:59, xxxxxxxx wrote:

        new_Object = BaseObject::Alloc( Oinstance );
        if ( !new_Object ) goto Error;
        new_Object->GetDataInstance()->SetLink( INSTANCEOBJECT_LINK, (BaseList2D* ) the_Object );

        Remember the_Obejct has to be an object already in your scene.

        Regards,
        darf

        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 10/01/2005 at 06:56, xxxxxxxx wrote:

          It´s COFFEE Darf.

          But I answered also here in the german forum already. I don´t understand why those people are not asking in here in the first place? Weird...

          Well, once again you have to use
          container->SetObject(INSTANCEOBJECT_SOURCE,obj_pointer);

          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 10/01/2005 at 07:08, xxxxxxxx wrote:

            I don't even think about COFFEE. Just had the code handy and posted it.

            darf

            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 10/01/2005 at 07:36, xxxxxxxx wrote:

              Sorry,
              didn't want to upset you!
              Thanks for the code, but I still get empty instance objects.

              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 10/01/2005 at 07:38, xxxxxxxx wrote:

                maybe this helps:
                instanzen(obj)
                {
                while (obj != NULL)
                {
                     println("Objekt:",obj->GetName());
                     var subobj, objekttyp,newinstance,container;
                     if (strstr(obj->GetName(), "BODY") == 0)
                          {
                          println(strmid(obj->GetName(),10,2));
                          objekttyp = strmid(obj->GetName(),10,2);

                switch(objekttyp)
                          {
                          case "PL":
                          {
                          newinstance = new(InstanceObject);
                          newinstance->SetName("Payload");
                          var sat = doc->FindObject("Sat");
                          println(sat);
                          println(sat->GetName());
                          container = newinstance->GetContainer();
                          container->SetObject(INSTANCEOBJECT_SOURCE,sat);
                          newinstance->SetContainer(container);

                newinstance->Message(MSG_UPDATE);
                                                        
                          doc->InsertObject(newinstance,NULL,NULL);
                                    
                          }
                          case "PM":
                          case "PD":
                          case "RB":
                          case "RM":
                          case "RD":
                          case "UN":
                          }

                }
                     subobj = obj->GetDown();
                     if (subobj != NULL)
                     {
                          instanzen(subobj);
                     }
                          obj = obj->GetNext();
                     }
                println("Fertig!");
                GeEventAdd(DOCUMENT_CHANGED);
                }

                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 10/01/2005 at 07:45, xxxxxxxx wrote:

                  Try 1001 instead of INSTANCEOBJECT_SOURCE

                  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 10/01/2005 at 07:48, xxxxxxxx wrote:

                    YYYYEAAAHH!!!

                    Thanks, you saved my day!

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