You'll want to call removeChild() on the Node's parent. You mentioned calling removeChild() on the root Node, and having OSG support this by walking the tree to find and delete the Node. First, if this is indeed what you want, you can write a NodeVisitor to do this task. Second, be aware that you'll need to handle cases where the Node is multi-parented (more than one parent Node references the child Node). -Paul
_____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steve Smith Sent: Sunday, April 20, 2008 12:09 PM To: [email protected] Subject: Re: [osg-users] Removing an object from the SceneGraph Robert, Thanks for the sanity check. From what I could tell scouring the documentation (and a few google hits) this was the correct way to remove something. I did the usual stepping through code and such before wanting to post on the list to make sure I wasn't doing something real obvious code wise. After my first post, I had one other idea. I called removeChild(), but not on the root of the scene graph, but on the parent node of the node I wanted to remove. This worked as expected. So the followup question is... must removeChild() be called on the immediate parent node instead of the root node (or any node up the chain)? I assumed, perhaps incorrectly, that if I asked the root node to remove a child, it would traverse the tree for me. If this _should_ work, then I will continue to look for the cause on my end... I just want to make sure I have a proper understanding of the expected behavior. I should also have mentioned in the first post, I'm using OSG 2.2 (on OS X if that is important as well). Steve >Hi Steve, > >The line you are using to remove a child is the appropriate one, as to >why it doesn't work in your case, we'll this isn't something I can >answer. To find out why you'll need to do more debugging at your end. >Perhaps a bug in your code is occurring such that pointers are wrong, >or code isn't being executed. > >Robert.
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

