[osg-users] CompositeNodeCallback : useful addition?

Jean-Sébastien Guay jean-sebastien.guay at polymtl.ca
Fri Oct 26 08:22:33 PDT 2007

Hello Robert,

> All present NodeCallbacks are effectively traversal callbacks - all
> require you to call traverse.

Yes, but most NodeCallbacks will be standalone (i.e. no dependency  
between callbacks), so calling them in series shouldn't be a problem,  
or am I missing something?

Anyways, there's obviously some things I don't understand about  
callbacks or you would have done this a long time ago. Since it works  
for me I'll keep using it. I was just thinking it could be useful to  
others too, but not in its current state it seems.

The whole thing I'm trying to solve is that Node::set*Callback()  
replaces the callback, and if you need to have both the old and the  
new callbacks, you have to do it manually, i.e. with

if (node->getUpdateCallback())

And you have to *remember* to do that if there's any chance that you  
may need more than one callback on a given node. I'm just trying to  
make that more automatic and transparent...

So alternatively, would you accept a method in osg::Node that would  
look like this:

void Node::addUpdateCallback(osg::NodeCallback* callback)
     if (_updateCallback.valid())

That would give an alternative to Node::set*Callback, where if you  
*know* you want to replace the existing callback, you call set, but if  
you might need more than one, you call add.

It's such a simple method, but it would take some variables and some  
possible user error (*cough*) out of the equation...

Anyways, I think I'm done rambling now. :-)

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 mailing list