Hi Leo,

One of your traverse calls has a node pointer as the parameter, just
put a * before it to dereference it to get the Node& that
traverse(Node&) expects.

On 7/3/06, Leo Orlandini <[EMAIL PROTECTED]> wrote:
I'm not sure I've been undertand how the traverse method works...
If I want to write a simple EditVisitor that only parse the graph and print,
for each node, something like "found a node of this type: ......." and this
way...

I've written this class:

class EditVisitor : public osg::NodeVisitor
{
    public:
       EditVisitor() {}

           virtual void apply(osg::Node& node)
       {
                   osg::notify(osg::NOTICE)<<"...EditVisitor: NODE found '" <<
node.getName() << "'" << std::endl;
                   traverse(node);
       }
       virtual void apply(osg::Geode& node)
       {
                        osg::notify(osg::NOTICE)<<"...EditVisitor: GEODE found '" 
<<
node.getName() << "'" << std::endl;
                        traverse(node);
       }
           virtual void apply(osg::Group& node)
       {
                        osg::notify(osg::NOTICE)<<"...EditVisitor: GROUP found '" 
<<
node.getName() << "'" << " (" << node.getNumChildren () << " figli)" <<
std::endl;

                   for (unsigned int i = 0;i< node.getNumChildren (); i++)
                        {
                                osg::notify(osg::NOTICE)<<"   ..."<< i << "° figlio:" 
 << std::endl;

                                osg::ref_ptr<osg::Node> nd = node.getChild(i);

                                if( nd.valid() )
                                        traverse(nd.get());
                                else
                                        osg::notify(osg::NOTICE) << "Error no valid child 
added." << std::endl;

                        }

                        traverse(node);
       }
};

but, during compilation, it give me this error:

make[1]: Entering directory
`/home/leo/OSG/sources/OpenSceneGraph/applications/osgvisitor/Linux32.Opt'
g++  -O2 -W -Wall -fPIC -pipe -I../../../include  -I/usr/X11R6/include  -c
../osgvisitor.cpp
../osgvisitor.cpp: In member function 'virtual void
EditVisitor::apply(osg::Group&)':
../osgvisitor.cpp:53: error: no matching function for call to
'EditVisitor::traverse(osg::Node*)'
../../../include/osg/NodeVisitor:177: note: candidates are: void
osg::NodeVisitor::traverse(osg::Node&)
make[1]: *** [osgvisitor.o] Error 1
make[1]: Leaving directory
`/home/leo/OSG/sources/OpenSceneGraph/applications/osgvisitor/Linux32.Opt'
make: *** [osgvisitor.opt] Error 2

can anybody explain this error to me?

thanks leo

_________________________________________________________________
Personalizza MSN Messenger con sfondi e fotografie!
http://spaces.msn.com/morespaces.aspx

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to