THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED
On 23/03/2004 at 01:50, xxxxxxxx wrote:
User Information:
Cinema 4D Version: 8.100
Platform: Windows ; Mac OSX ;
Language(s) : C.O.F.F.E.E ;
---------
Hi,
is there a way to make a loaded document active (and the one actually diaplayed in the editor)?
I want to load an object from a file to the active scene. Here's what I do:
...
var doc = GetActiveDocument();
LoadDocument(my_doc);
var temp_doc = GetActiveDocument();
var temp_op=temp_doc->GetFirstObject()->GetClone(CL_NO_BITS);
KillDocument(temp_doc);
doc->InsertObject(temp_op,NULL,NULL);
now my object is in my scene. The temp document where it came from is closed again. If there is only my scene open, everything is fine, but if there are other scenes open as well, the last one opened becomes the active one in the editor with my scene and the newly inserted object hidden. Now I want to make my scene active again. Here's what I tried:
var active_doc = GetActiveDocument();
while(active_doc)
{
if(active_doc != doc) active_doc->DelBit(BIT_ADOC);
else
{
active_doc->SetBit(BIT_ADOC);
break;
}
active_doc = active_doc->GetNext();
}
GeEventAdd(MSG_UPDATE);
println(GetActiveDocument()->GetFirstObject()->GetName();
Now the name of the first object of my scene (the one I've just inserted) gets printed in the console, indicating that my scene is in fact the 'active document'. Unfortunatly it's still not the one displayed in the editor!
What am I doing wrong? Is there a way of changing the active document?
Many thanks in advance
Fabian