Hi Gordon,

On Jan 3, 2008 4:43 PM, Gordon Tomlinson <[EMAIL PROTECTED]> wrote:
> You might also want to see if the parent has any children first, as  we know
> has a getChildIndex slight bug in that it returns zero even if there are no
> children which is a valid index ..

I have just reviewed the Group::getChildIndex(const Node*) method can
clarfify that the behaviour is correct, and there isn't a bug.   Why?
0 isn't a valid index when there are 0 children...

You only have a valid index when the index returned is less than the
number of children.  The getChildIndex() method works in a similar way
to std find methods returning the end() when nothing has been found.
Use code should look like:


   unsigned int i = group->getChildIndex(childWeAreLookingFor);
   if (i<group->getNumChildren())
   {
      // we have a valid index
   }
   else
   {
      // we have a invalid index
   }
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to