Hi Sven,

Sven Widderich wrote:
> I have a problem to traverse a graph.
> There's an example of how to traverse a graph calling a class method
> at the end of the Traversal tutorial.
> I want to do the same but calling the traverse function within a method of
> the class.
> 
>   // This is some method within the class CLattice:
>   traverse( _root,
>     osgTypedMethodFunctor1ObjPtrCPtrRef
>       <Action::ResultE, CLattice, NodePtr>
>         (this, &CLattice::extendVolume) );
> 
> The difference to the example on opensg.org is the 'this' pointer
> 
>   // Following is the method that should be processed when entering a node:
>   Action::ResultE CLattice::extendVolume( NodePtr& nod )
>   {
>     // this tests if the core is derived from geometry
>     if( nod->getCore()->getType().isDerivedFrom(Geometry::getClassType()) )
>     {
>       //...
>     }
> 
>     return Action::Continue;
>   }
> 
> When testing whether the node has a geometry core, I get a null pointer
> exception.
> 
> Somebody see my mistake?

hm, no sorry. Is it possible that you have a Node without NodeCore in 
your scene? If that's the case the nod->getCore()->getType() call would 
crash. Can you provide a backtrace of the crash, so we have a better 
chance of seeing where exactly you get that null pointer?

        Thanks,
                Carsten

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Opensg-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensg-users

Reply via email to