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

    load object -> loss of instance link

    Scheduled Pinned Locked Moved SDK Help
    5 Posts 0 Posters 470 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 25/03/2009 at 09:59, xxxxxxxx wrote:

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

      ---------
      Hi,

      i made a preset browser that is able to load objects from c4d files and insert them into the current scene.

      i have a preset-scene that contains a null object, which consist of a cube and some instances of the cube.

      when i load this null into my sceen, via the preset browser, the reference link in teh instances is lost, instead of pointing to the cube..

      when i merge the scene by hand via c4d's file menu, the instances keep their reference link to the cube, so it must be sth in my function..

      here's the code snippet:

      > \> .. \> if(!node->file.CheckSuffix("c4d")) return FALSE;                          \> AutoAlloc<BaseDocument> f_doc = LoadDocument(node->file,SCENEFILTER_OBJECTS,NULL); \> if(!f_doc){ return FALSE; } \> // get first obj in the scene. preset scenes always contain 1 obj only. \> AutoAlloc<BaseObject> op = f_doc->GetFirstObject(); \> \> // remember active object \> BaseObject\* active = GetActiveDocument()->GetActiveObject(); \> \> // make a clone of the obj and insert it into the scene \> BaseObject\* clone = (BaseObject\* )op->GetClone(COPY_NO_ANIMATION,NULL); \> if(clone)GetActiveDocument()->InsertObject(clone,NULL,NULL); \> \> // restore active object \> if(active!=NULL) GetActiveDocument()->SetActiveObject(active); \> \> // notify the scene \> EventAdd(); \> .. \>

      does somebody know what may be wrong ?

      thanks,
      Daniel

      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 25/03/2009 at 11:41, xxxxxxxx wrote:

        I guess the link is lost when creating the clone.
        You will have to use the AliasTrans class, which takes care of that, if I'm not mistaken.

        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 25/03/2009 at 13:06, xxxxxxxx wrote:

          yeah i guessing so too, but wasnt aware of the AliasTrans class. Looking at the api, it seems that's indeed the solution.

          thanks for the hint Jack!

          cheers,
          Daniel

          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 25/03/2009 at 13:12, xxxxxxxx wrote:

            alright just to confirm this, it worked indeed!

            thanks again.

            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 26/03/2009 at 01:16, xxxxxxxx wrote:

              You're welcome 😉

              Greetings,
              Jack

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