Re: [osg-users] Extracting Node Names from NodePath
Hi John, the node path stores all the nodes from the root to the node containing the geometry (a Geode). In your case, if you picked node1, the nodepath will be root;PAT1;node1. You can iterate over them and get the name with node-getName(). The lead node would be nodepath.back() -Nick On Wed, Jun 23, 2010 at 9:54 AM, John Galt manu9ak...@gmail.com wrote: Hi, I have my scene set up as follows: osg::Node* node1; osg::Node* node2; osg::Node* node3; I have loaded node1, node2 and node3 using readNodeFromFile function. Then I have my nodes attached to my root as follows: root-addChild(PAT1); PAT1-addChild(node1); root-addChild(PAT2); PAT1-addChild(node2); root-addChild(PAT3); PAT1-addChild(node3); Then I got a HitList and extracted Hits out of it. For each particular hit, I have extracted the NodePath. What exactly does the NodePath store? How do I extract the names of the Nodes that contain the geometry i.e., how do I use the NodePath to return the bottom most (leaf node?) node (node1, node2 or node3) in my scene graph? Thank you! Cheers, John -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29291#29291 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Extracting Node Names from NodePath
Hi, I did the same thing you suggest but it doesn't work for me. I used node1-setName(Specific Name); for all the 3 nodes and I am looking for the specific name to be returned. However, all I get is empty strings. My node1 = readFromFile(dumptruckosg); node2 = readFromFile(lz.osg); node3 = readFromFile(MyOwnAC3dModel.ac); The code returns only dumptruck.osg as the NodeName when I intersect with dumptruck.osg but it returns an empty string when I intersect with lz.osg and myownac3dmodel.ac. I am positive that the intersections are occuring because the intersection coordinates are perfectly coming through. However, I am unable to get the Specific Name I assigned for the nodes. Thank you! Cheers, John -- Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=29312#29312 ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Extracting Node Names from NodePath
Hi John, On 23/06/10 23:26 , John Galt wrote: I used node1-setName(Specific Name); for all the 3 nodes and I am looking for the specific name to be returned. However, all I get is empty strings. My node1 = readFromFile(dumptruckosg); node2 = readFromFile(lz.osg); node3 = readFromFile(MyOwnAC3dModel.ac); The code returns only dumptruck.osg as the NodeName when I intersect with dumptruck.osg but it returns an empty string when I intersect with lz.osg and myownac3dmodel.ac. I am positive that the intersections are occuring because the intersection coordinates are perfectly coming through. Are you checking the entire node path for the name, or maybe only the last node? Keep in mind that you get the entire node path, but the name is only set for one of them. You'll probably get something like this: root - node1 (name=Specific Name) - node - ... - Geode So the one you're looking for is neither the first nor the last node in the path. HTH, Cheers, /ulrich ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org