Stephane Lamoliatte wrote on Wednesday, December 19, 2007 11:32 AM:
> Hello,
> 
> I created a new node, MyGroup, which extends osg::Group.
> I want to visit it in the scene graph with a NodeVisitor. So, I wrote
> MyNodeVisitor which extends osg::NodeVisitor. MyVisitor contains an
> apply function which takes MyGroup in parameter :
> MyVisitor::apply(osg::MyGroup &).
> 
> The problem is that this function is never called : The application
> call MyVisitor::apply(osg::Group&) instead.
> 
> Does somebdy know why ?

It's because of the way C++ works; the only visitor apply() functions
that can be called are the ones defined in osg::NodeVisitor.

Unfortunately, the only way to handle your node specially is to check
for it in apply(osg::Group):

MyVisitor::apply(osg::Group& group)
{
  ...
  MyGroup* mgrp = dynamic_cast<MyGroup*>(&group);
  if (mgrp)
  {
    // do your special stuff here
  }
  ...
}


-- 
Bryan Thrall
FlightSafety International
[EMAIL PROTECTED]
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to