[osg-users] CompositeNodeCallback : useful addition?

Robert Osfield robert.osfield at gmail.com
Fri Oct 26 10:49:41 PDT 2007


Hi J-S,

I'm open to having better support for multiple callbacks, I'm not at
point in dev work where its easy for me to dive in to what can be a
complicated topic, nor review submissiosns.  Once things free up a bit
I get the backlong of submissions merged I'll add a few more comments
on the topic.  If I don't do so in the next few weeks ping me.

Robert.

On 10/26/07, Jean-Sébastien Guay <jean-sebastien.guay at polymtl.ca> wrote:
> 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())
>      node->getUpdateCallback()->addNestedCallback(callback);
> else
>      node->setUpdateCallback(callback);
>
> 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())
>          _updateCallback->addNestedCallback(callback);
>      else
>          setUpdateCallback(callback);
> }
>
> 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. :-)
>
> J-S
> --
> ______________________________________________________
> Jean-Sebastien Guay     jean-sebastien.guay at polymtl.ca
>                          http://whitestar02.webhop.org/
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>



More information about the osg-users mailing list