load object -> loss of instance link

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

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

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

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.

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