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