[osg-users] CompositeNodeCallback : useful addition?
jean-sebastien.guay at polymtl.ca
Fri Oct 26 07:18:36 PDT 2007
> You can nested callbacks within each other right now. It's a bit
> awkward but does work for doing multiple callbacks.
Yes, as I said I find the current nested callback mechanism less
intuitive. It would be better if it were transparent to users of the
class, which is what I tried to do with CompositeNodeCallback's static
> 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
OK, I'm totally open to improving the design and implementation... I
haven't used traversal callbacks so I didn't know that was a widely
used case. What is it that should be happening? Would it be something
void CompositeNodeCallback::operator()(osg::Node* node, osg::NodeVisitor* nv)
for (CallbackVector::iterator it = _callbacks.begin();
it != _callbacks.end();
// Call (*it)->operator()(node, nv) on each callback.
(*it)->traverse(node, nv); // added
traverse(node, nv); // added
Or is there more that is needed? As I see it, currently each class
derived from NodeCallback is responsible for calling traverse() in its
operator() anyways, if it needs to, so why do I need to call it in the
composite? There must be something I don't understand.
As I said, my goal was to hide the complexity of managing multiple
callbacks on one node, so if some tweaks are required to the
implementation I'm totally open to doing them.
Jean-Sebastien Guay jean-sebastien.guay at polymtl.ca
This message was sent using IMP, the Internet Messaging Program.
More information about the osg-users