Hi Leo,

Is it that the visitor isn't traversing all the scene?  If so then its because you haven't included a traverse(..) calling the the apply() method.   Traversal is your responsibility in either custom NodeVisitor or callbacks.  Have a look at the source code to other NodeVisitors and you'll spot calls to NodeVisitr::traverse(..) or the nodes traverse method.

Robert.

On 10/6/06, Leo Orlandini <[EMAIL PROTECTED]> wrote:
I try to explain better my problem...I've written a simple file defining
only one visitor, which change the filename associated with the first child
of every pagedLOD in the scenegraph... I test it on a model that contain
some pagedlod (exampleModel.osg) but the visitor has no effect.... can
someone explain me the reason of this fact ?

the file I've written is:

#include <osg/Notify>
#include <osgDB/ReadFile>
#include <osgDB/WriteFile>

class ProvaVisitor : public osg::NodeVisitor
{
public:
    ProvaVisitor():
        osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN)
    {
    }

        virtual void apply(osg::PagedLOD& plod)
    {
                plod.setFileName(0,"a");
        }
};

int main( int argc, char **argv )
{
        osg::notify(osg::NOTICE)<<"Charging the model...";
        osg::ref_ptr<osg::Node> root = osgDB::readNodeFile("exampleModel.osg");
        osg::notify(osg::NOTICE)<<"Done"<< std::endl;

        ProvaVisitor v;
        root->accept(v);

    return 0;
}

thanks
Leo


>From: "Leo Orlandini" <[EMAIL PROTECTED]>
>Reply-To: osg users < [email protected]>
>To: [email protected]
>Subject: [osg-users] PagedLOD...problem with setFileName() method
>Date: Thu, 05 Oct 2006 17:41:16 +0000
>
>Hello everybody,
>
>I need to define a visitor which, in certain case, have to change the file
>referred to some children of pagedLOD nodes in the scenegraph...so in my
>visitor I define an apply() method for pagedLOD in which body I made a call
>of setFileName() method...
>
>    virtual void apply(osg::PagedLOD& plod)
>    {
>                        ...................
>                              plod.setFileName(i,sameFile);
>                        ...................
>    }
>
>where "i" is an integer and "sameFile" is a std::string...
>
>after the visitor's traverse there is no change in the name of the file
>associated with the child in question...what I wrong ?
>
>Thanks in advance
>Leo
>
>_________________________________________________________________
>Bolletta del telefono pesante? Risparmia con il nuovo Messenger
>http://imagine-msn.com/messenger/launch80/?locale=it-it
>
>_______________________________________________
>osg-users mailing list
>[email protected]
>http://openscenegraph.net/mailman/listinfo/osg-users
> http://www.openscenegraph.org/

_________________________________________________________________
Personalizza MSN Messenger con sfondi e fotografie!
http://www.ilovemessenger.msn.it/

_______________________________________________
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