zhuliangxi...@hotmail.com wrote:
> Hi there,
> i wrote a class inherit from NodeVistor to remove all the scribe node
> from the scene. However, after the execution leave my apply function,
> the system crashed. I think that's because i changed the structure of
> the scene since i removed nodes from scene when visiting, and that may
> make some iterator unusable.

  I believe you are correct.

> so, is it available to change the structure of scene in a NodeVistor
> ?  If yes, is there anything to take care?

  Before running the NodeVisitor, I would create an vector container of 
ref_ptrs to Nodes.
During the apply/visit, fill the container with pointers to the nodes you wish 
to remove.
After the apply/visit is done, examine the container of Node pointers, and 
remove them all
from the scenegraph then, when there aren't any iterators in progress.

-- 
Chris 'Xenon' Hanson, omo sanza lettere                  Xenon AlphaPixel.com
PixelSense Landsat processing now available! http://www.alphapixel.com/demos/
"There is no Truth. There is only Perception. To Perceive is to Exist." - Xen
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to