Introduce NodeVisitor::className and libraryName()

This commit is contained in:
Robert Osfield
2008-12-17 12:13:15 +00:00
parent a5c32da4ff
commit 8a6e04b84d
27 changed files with 90 additions and 52 deletions

View File

@@ -20,26 +20,6 @@ using namespace osg;
using namespace osgGA;
class CollectParentPaths : public osg::NodeVisitor
{
public:
CollectParentPaths() :
osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_PARENTS) {}
virtual void apply(osg::Node& node)
{
if (node.getNumParents()==0)
{
_nodePaths.push_back(getNodePath());
}
traverse(node);
}
osg::NodePath _nodePath;
typedef std::vector< osg::NodePath > NodePathList;
NodePathList _nodePaths;
};
NodeTrackerManipulator::NodeTrackerManipulator()
{
_trackerMode = NODE_CENTER_AND_ROTATION;
@@ -120,14 +100,17 @@ void NodeTrackerManipulator::setTrackNode(osg::Node* node)
return;
}
CollectParentPaths cpp;
node->accept(cpp);
if (!cpp._nodePaths.empty())
osg::NodePathList nodePaths = node->getParentalNodePaths();
if (!nodePaths.empty())
{
if (nodePaths.size()>1)
{
osg::notify(osg::NOTICE)<<"osgGA::NodeTrackerManipualtor::setTrackNode(..) taking first parent path, ignoring others."<<std::endl;
}
osg::notify(osg::INFO)<<"NodeTrackerManipulator::setTrackNode(Node*"<<node<<" "<<node->getName()<<"): Path set"<<std::endl;
_trackNodePath.clear();
setTrackNodePath( cpp._nodePaths[0] );
setTrackNodePath( nodePaths.front() );
}
else
{