Introduce NodeVisitor::className and libraryName()
This commit is contained in:
@@ -39,6 +39,8 @@ class TransformVisitor : public NodeVisitor
|
||||
_ignoreCameras(ignoreCameras)
|
||||
{}
|
||||
|
||||
META_NodeVisitor("osg","TransformVisitor")
|
||||
|
||||
virtual void apply(Transform& transform)
|
||||
{
|
||||
if (_coordMode==LOCAL_TO_WORLD)
|
||||
|
||||
@@ -129,6 +129,8 @@ public:
|
||||
|
||||
}
|
||||
|
||||
META_NodeVisitor("osgDB","FindCompileableGLObjectsVisitor")
|
||||
|
||||
virtual void apply(osg::Node& node)
|
||||
{
|
||||
apply(node.getStateSet());
|
||||
@@ -1486,6 +1488,8 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
META_NodeVisitor("osgDB","FindCompileableGLObjectsVisitor")
|
||||
|
||||
virtual void apply(osg::PagedLOD& plod)
|
||||
{
|
||||
if (plod.getName()!=_marker)
|
||||
@@ -1842,6 +1846,8 @@ public:
|
||||
{
|
||||
}
|
||||
|
||||
META_NodeVisitor("osgDB","FindPagedLODsVisitor")
|
||||
|
||||
virtual void apply(osg::PagedLOD& plod)
|
||||
{
|
||||
plod.setFrameNumberOfLastTraversal(_frameNumber);
|
||||
|
||||
@@ -30,6 +30,9 @@ namespace
|
||||
class TsgVisitor: public NodeVisitor {
|
||||
public:
|
||||
TsgVisitor(BumpMapping* bm): NodeVisitor(NodeVisitor::TRAVERSE_ALL_CHILDREN), _bm(bm) {}
|
||||
|
||||
META_NodeVisitor("osgFX","TsgVisitor")
|
||||
|
||||
void apply(osg::Geode& geode)
|
||||
{
|
||||
for (unsigned i=0; i<geode.getNumDrawables(); ++i) {
|
||||
@@ -50,6 +53,9 @@ namespace
|
||||
class TexCoordGenerator: public osg::NodeVisitor {
|
||||
public:
|
||||
TexCoordGenerator(int du, int nu): NodeVisitor(NodeVisitor::TRAVERSE_ALL_CHILDREN), du_(du), nu_(nu) {}
|
||||
|
||||
META_NodeVisitor("osgFX","TexCoordGenerator")
|
||||
|
||||
void apply(osg::Geode& geode)
|
||||
{
|
||||
const osg::BoundingSphere &bsphere = geode.getBound();
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -15,35 +15,26 @@
|
||||
#include <osgManipulator/Selection>
|
||||
#include <osgManipulator/Command>
|
||||
|
||||
#include <osg/Notify>
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
using namespace osgManipulator;
|
||||
|
||||
class FindNodePathToRootVisitor : public osg::NodeVisitor
|
||||
{
|
||||
public:
|
||||
|
||||
osg::NodePath& _nodePathToRoot;
|
||||
|
||||
FindNodePathToRootVisitor(osg::NodePath& np)
|
||||
: osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_PARENTS),
|
||||
_nodePathToRoot(np)
|
||||
{}
|
||||
|
||||
virtual void apply(osg::Node& node)
|
||||
{
|
||||
_nodePathToRoot.push_back(&node);
|
||||
traverse(node);
|
||||
}
|
||||
};
|
||||
|
||||
void osgManipulator::computeNodePathToRoot(osg::Node& node, osg::NodePath& np)
|
||||
{
|
||||
np.clear();
|
||||
osg::ref_ptr<FindNodePathToRootVisitor> visitor = new FindNodePathToRootVisitor(np);
|
||||
node.accept(*visitor);
|
||||
np.pop_back();
|
||||
std::reverse(np.begin(), np.end());
|
||||
|
||||
osg::NodePathList nodePaths = node.getParentalNodePaths();
|
||||
|
||||
if (!nodePaths.empty())
|
||||
{
|
||||
np = nodePaths.front();
|
||||
if (nodePaths.size()>1)
|
||||
{
|
||||
osg::notify(osg::NOTICE)<<"osgManipulator::computeNodePathToRoot(,) taking first parent path, ignoring others."<<std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Selection::Selection()
|
||||
|
||||
@@ -48,6 +48,8 @@ public:
|
||||
if (matrix) pushMatrix(*matrix);
|
||||
}
|
||||
|
||||
META_NodeVisitor("osgShadow","CollectOccludersVisitor")
|
||||
|
||||
void apply(osg::Node& node)
|
||||
{
|
||||
if (node.getStateSet()) pushState(node.getStateSet());
|
||||
|
||||
@@ -1014,6 +1014,8 @@ class PolytopeVisitor : public osg::NodeVisitor
|
||||
_polytopeStack.back().second.setAndTransformProvidingInverse(polytope, _polytopeStack.back().first);
|
||||
}
|
||||
|
||||
META_NodeVisitor("osgSim","PolytopeVisitor")
|
||||
|
||||
void reset()
|
||||
{
|
||||
_polytopeStack.clear();
|
||||
|
||||
@@ -34,7 +34,8 @@ public:
|
||||
CollectedCoordinateSystemNodesVisitor():
|
||||
NodeVisitor(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN) {}
|
||||
|
||||
|
||||
META_NodeVisitor("osgViewer","CollectedCoordinateSystemNodesVisitor")
|
||||
|
||||
virtual void apply(osg::Node& node)
|
||||
{
|
||||
traverse(node);
|
||||
|
||||
Reference in New Issue
Block a user