From 8d325c24ff12fce0cb4e80942f974ddc8a1cea3b Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 8 Jul 2004 22:28:15 +0000 Subject: [PATCH] Added new coputeActiveCooridnateSystemNodePath method --- include/osgProducer/Viewer | 2 ++ src/osgProducer/Viewer.cpp | 18 +++++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/include/osgProducer/Viewer b/include/osgProducer/Viewer index 7b9a7980c..efbbc057a 100644 --- a/include/osgProducer/Viewer +++ b/include/osgProducer/Viewer @@ -104,6 +104,8 @@ class OSGPRODUCER_EXPORT Viewer : public OsgCameraGroup, public osgGA::GUIAction typedef std::vector< osg::ref_ptr > RefNodePath; + void computeActiveCoordindateSystemNodePath(); + void setCoordindateSystemNodePath(const RefNodePath& nodePath) { _coordinateSystemNodePath = nodePath; } void setCoordindateSystemNodePath(const osg::NodePath& nodePath); diff --git a/src/osgProducer/Viewer.cpp b/src/osgProducer/Viewer.cpp index 07edc5259..5d4d679cb 100644 --- a/src/osgProducer/Viewer.cpp +++ b/src/osgProducer/Viewer.cpp @@ -142,7 +142,7 @@ class CollectedCoordinateSystemNodesVisitor : public osg::NodeVisitor public: CollectedCoordinateSystemNodesVisitor(): - NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN) {} + NodeVisitor(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN) {} virtual void apply(osg::Node& node) @@ -309,10 +309,8 @@ void Viewer::setCoordindateSystemNodePath(const osg::NodePath& nodePath) std::back_inserter(_coordinateSystemNodePath)); } -void Viewer::updatedSceneData() +void Viewer::computeActiveCoordindateSystemNodePath() { - OsgCameraGroup::updatedSceneData(); - // now search for CoordinateSystemNode's for which we want to track. osg::Node* subgraph = getTopMostSceneData(); @@ -324,8 +322,18 @@ void Viewer::updatedSceneData() if (!ccsnv._pathToCoordinateSystemNode.empty()) { setCoordindateSystemNodePath(ccsnv._pathToCoordinateSystemNode); + return; } - } + } + // otherwise no node path found so reset to empty. + setCoordindateSystemNodePath(osg::NodePath()); +} + +void Viewer::updatedSceneData() +{ + OsgCameraGroup::updatedSceneData(); + + computeActiveCoordindateSystemNodePath(); } void Viewer::setKeyboardMouse(Producer::KeyboardMouse* kbm)