Hi Robert,

The best you can use is a NodeVisitor. Inside osgsimulation example
there is a FindNamedNodeVisitor that could help you in the task.

Rafa.

On 11/16/07, Robert Borchers <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I want to read in nodes from a .obj or .3ds file.
>
> For doing this I use
> osg::ref_ptr<osg::Node> osgNode = osgDB::readNodeFile(snode.filename);
>
> Now I want to get the objects from this file. This shall be a Square, a
> Sphere and a Pyramid. I tried to do this by using:
>
> osg::ref_ptr<osg::Group> myOsgGroup;
> myOsgGroup = osgNode->asGroup(); // returns NULL if not a group.
>
> for (unsigned int i = 0 ; i < myOsgGroup->getNumChildren(); i ++) {
>       osg::ref_ptr<osg::Node> myTempNode = myOsgGroup->getChild(i);
>      cout << "nodename = " << myTempNode->getName() << endl;
> }
>
>
> But the result of this operation is that I get 12 Objects instead of the
> 3. 6 for the square, 5 for the pyramid and 1 for the sphere.
> What have I to do to get just the 3 Objects so I can play around with them ?
>
> Thanks
> Robert
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>


-- 
Rafael Gaitán Linares
Instituto de Automática e Informática Industrial  http://www.ai2.upv.es
Ciudad Politécnica de la Innovación
Universidad Politécnica de Valencia
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to