[osg-submissions] Group::removeChildren fix

Garrett Potts potts at cfl.rr.com
Mon Jan 14 11:20:01 PST 2008


Hello Robert:

Yes,  I forgot the prototype was for position and num elements.  Sorry  
about that.  I guess the confusion is:

         _children.erase(_children.begin()+pos,_children.begin() 
+endOfRemoveRange);

         childRemoved(pos,endOfRemoveRange-pos);

Then we need childRemoving:

         childRemoving(pos,endOfRemoveRange-pos);

         _children.erase(_children.begin()+pos,_children.begin() 
+endOfRemoveRange);

         childRemoved(pos,endOfRemoveRange-pos);

If we want to have access to the actual objects before whacking them  
from the list.


Take care

Garrett

On Jan 14, 2008, at 2:13 PM, Robert Osfield wrote:

> HI Garrett,
>
> On Jan 14, 2008 5:38 PM, Garrett Potts <potts at cfl.rr.com> wrote:
>> Is there a problem with childRemoved taking as an argument a
>> osg::Node* type.  Looking at the code in where childRemoved in the
>> osg::Group node the indices as mentioned can't really be used to
>> access the list in which the node was removed.  Instead, would it be
>> better to just pass the osg::Node* to childRemoved?
>
> The unsigned int position is used because the Nodes themselves have
> been removed and potentially no longer exist, so it'd be very bad
> thing to pass the Node* around.
>
> The concept behind the childInserted and childRemoved is that it
> enables the maintenance of data structures that exist on a one per
> child basis where there is 1:1 correspondance between the lists that
> hold the original child data and the local data.
>
> Robert.
> _______________________________________________
> osg-submissions mailing list
> osg-submissions at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.openscenegraph.org/pipermail/osg-submissions-openscenegraph.org/attachments/20080114/d2f3c153/attachment.html 


More information about the osg-submissions mailing list