I do this all the time.   I use detach() to detach the BG from the live scene, then I add whatever I want, not just other BGs and then reattech the orginal BG using addChild(). 
 
But I do not  "compile" any of the scene graph.
 
Note that the Java 3D documentation for "addChild()" says an exception is thrown "if the appropriate capability is not set and this group node is part of live or compiled scene graph".  Note the "or compiled scene graph" part.   So make sure you are not compiling the scene graph.
 
 
Cheers,
Bob Gray
-----Original Message-----
From: Discussion list for Java 3D API [mailto:[EMAIL PROTECTED]]On Behalf Of Shantz Family
Sent: Thursday, December 05, 2002 2:45 PM
To: [EMAIL PROTECTED]
Subject: [JAVA3D] Editing live scene graphs


I'm doing dynamics and need to edit a live scene graph.  With a live scene graph like this
 
   -> BG->BG1->TG->L->SG->Shape
                           ...
                     ->TG->L--^
 
(BG=BranchGroup, TG=TransformGroup, L=Link, SG=SharedGroup)
 
I can successfully add new instances of Shape by detaching BG1, adding a new TG->L to BG1, and reattaching BG1.  That works fine.
So I thought that if I detached a BG I could add stuff to it but that doesn't work because even after being detached the BG subtree complains that "only BGs may be added". 
 
So how does one edit a detached BG subtree that was once live? 
Do you have to make a new BG and copy the whole thing? 
 
Or perhaps someone can point me to a book that has more to say about editing live scene graphs.  The books (Selman, j3d spec) don't say much about editing live scene graphs.
 
Mike

Reply via email to