Hello Robert,
> 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
methods.
> 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.
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
like this?
void CompositeNodeCallback::operator()(osg::Node* node, osg::NodeVisitor* nv)
{
for (CallbackVector::iterator it = _callbacks.begin();
it != _callbacks.end();
++it)
{
// Call (*it)->operator()(node, nv) on each callback.
(**it)(node, nv);
(*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.
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