Hi Robert I suppose it how you look at
But to me the getChildIndex is supposed to return the index of the child so, if it returns zero for the first child and zero for no children this is wrong to me, having zero returned for 2 different conditions is just wrong to me, and again if the node has 1 child but I pass in a node that is not a child it returns 1 , which again is confusing ( well to me ) To me getChildIndex should return the index of the child if found otherwise if there are no children it should return a known indicator to say the node was not a child of this node such as -1 ( thats what all other Scenegraphs I have used have done ), but thats me, I do not see why it need to return size() thats just confusing and misleading to me and certainly not what I would expect Thats my take not trying to upset any one, just seems wrong for me.. __________________________________________________________ Gordon Tomlinson Email : [EMAIL PROTECTED] Website : www.vis-sim.com www.gordontomlinson.com __________________________________________________________ "Self defence is not a function of learning tricks but is a function of how quickly and intensely one can arouse one's instinct for survival" -Master Tambo Tetsura -----Original Message----- From: Robert Osfield [mailto:[EMAIL PROTECTED] Sent: 03 January 2008 16:53 To: [EMAIL PROTECTED]; OpenSceneGraph Users Subject: Re: [osg-users] Error: 'Debug Assertion Failure!' 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

