Hi Max,

On 27 March 2013 11:20, Max Ashton <[email protected]> wrote:

> How would one go about finding the level of a node in the tree, i'm
> presuming that the node knows its level.


Nodes don't know there "level", and as they can have multiple parents the
"level" isn't necessarily unique.

One does have to ask what exactly you mean by "level" though as it's not
normally something scene graph users need, you are the first person I
recall ever asking for this.



> Or is it something I would have to work out by traversing the tree and
> then storing it myself??
>

I'm guessing my level you mean how far nested the node is from the root of
the scene graph?  If so then just use a NodeVisitor that has a
TRAVERSE_PARENTS TraversalOrder and just count how long the NodePath that
it accumulates gets.

Just trying to avoid rewriting something that may already be there
>

As it's a very unusual thing to ask for then perhaps you are going about
things in a way that isn't necessarily appropriate.  I think it'd be useful
explain what exactly you mean by "level" and what you need it for.

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

Reply via email to