Hi Rafa,

I tried this but it's the same problem. I get also my 12 objects instead 
of the wanted 3. It's the same output as in my version.
Is there an easy way to get the whole objects or do I have to run 
through the graph collecting the names an then adding all objects with 
the same name to one single transform to let them stay together? And 
what if a user give two objects the same name?

Rafa Gaitan schrieb:
> 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
>>
>>     
>
>
>   

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

Reply via email to