HI J-S, You can nested callbacks within each other right now. It's a bit awkward but does work for doing multiple callbacks.
The issued you have with your approach is that you call the callbacks in series and don't provide a mechanism for traversal - rather it assumes that each callback would call the traverse on subgraph or not at all. This might be OK for some callbacks types that fall into a pre or post callback style, but not ones that are in effect traversal callbacks. Robert On 10/26/07, Jean-Sébastien Guay <[EMAIL PROTECTED]> wrote: > Hello Robert, > > I was wondering about something. I find the nesting of node callbacks > a bit less intuitive and transparent than it could be, and I was > wondering if there would be interest in a small class I made called > CompositeNodeCallback. It's simply a vector of NodeCallbacks where the > class's operator() calls the operator() of each NodeCallback in the > vector. So in effect it implements the Composite and Decorator > patterns for NodeCallbacks. > > The other useful thing is that it has some static methods that allow > you to add a NodeCallback to either the update, event or cull > callbacks on a node, and it will transparently add a > CompositeNodeCallback if needed, or add the callback to an existing > CompositeNodeCallback if there is one. So in effect, you just replace > any > > node->setUpdateCallback(callback); > > with > > CompositeNodeCallback::addUpdateCallback(node, callback); > > and it takes care of everything for you. > > I know I find it useful, because I have been bitten a few times when > setting a callback on a node that already had one, so it was replaced. > And I find having to manage nested callbacks manually is tedious. So I > appreciate this being automatic. > > My question is, would this be useful in the OSG core. I'm including > the code in case you want to see exactly what it does. If you decide > it could be included, I'll gladly make the changes needed (osg > namespace, comment copyright header, etc.) to make it a valid > submission. > > Thanks, > > J-S > -- > ______________________________________________________ > Jean-Sebastien Guay [EMAIL PROTECTED] > http://whitestar02.webhop.org/ > > ---------------------------------------------------------------- > This message was sent using IMP, the Internet Messaging Program. > > > _______________________________________________ > osg-users mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org > > > _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

