Thank you for answering so fast, Robert.
I guess I'll try something like "parent->addUpdateCallback(new 
CallbackThatCleansThingsInChildren())", since I'm writing generic code (I don't 
want to change parents' code).

Sukender
PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/


Le Wed, 26 Nov 2008 15:24:38 +0100, Robert Osfield <[EMAIL PROTECTED]> a écrit:

> Hi Sukender,
>
> The approaches I'd used are either:
>
>  1) A top level clean up tool that runs before/after the update
> traversal - like your suggestion of a manager, but in
>      essence it just a list of objects to remove from the list.
>
>  2) Have a callback above the child you want to remove do the removal,
> prior or after the traversal of the subgraph,
>      note Node callbacks are all effectively traversal callbacks so
> have complete control over when traversal happens.
>      This approach doesn't invalidate an iterators.
>
> The invalidation of iterators occurs when you remove self from a
> parent during traversal.
>
> Robert.
>
>
> On Wed, Nov 26, 2008 at 2:11 PM, Sukender <[EMAIL PROTECTED]> wrote:
>> Hello all,
>>
>> "Modifying elements on the scene graph that affect traversal during 
>> traversal is a [...] restriction, simply because doing so invalidates 
>> iterators of the calling methods.", Robert said ( 
>> http://lists.openscenegraph.org/htdig.cgi/osg-users-openscenegraph.org/2007-September/002938.html
>>  ).
>>
>> Question is: according to you, what is the best/simpliest way for a node to 
>> deallocate itself during traversal? Here are my ideas:
>> - Mark the node as to be deleted in a kind of manager that does the job when 
>> the frame has ended.
>> - Create a class derived from Group that gracefully handles the invalidation 
>> of iterators during traverse().
>> - Make a nice memory leak (joking).
>> - Or may Node::accept() return a boolean that says if the node "commited 
>> suicide" (???)
>>
>> I guess ther is a much simpler way, but I can't figure out which one.
>> (Sorry if it has already been discussed, but I can't find answers in the 
>> archive).
>>
>> Thanks.
>>
>> Sukender
>> PVLE - Lightweight cross-platform game engine - http://pvle.sourceforge.net/
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to