diff --git a/include/osgProducer/Viewer b/include/osgProducer/Viewer index 45ebe982f..ec288b3e1 100644 --- a/include/osgProducer/Viewer +++ b/include/osgProducer/Viewer @@ -18,7 +18,7 @@ #include #include #include -#include +#include #include @@ -225,11 +225,9 @@ class OSGPRODUCER_EXPORT Viewer : public OsgCameraGroup, public osgGA::GUIAction void computeActiveCoordinateSystemNodePath(); - void setCoordinateSystemNodePath(const osg::RefNodePath& nodePath) { _coordinateSystemNodePath = nodePath; } - void setCoordinateSystemNodePath(const osg::NodePath& nodePath); - const osg::RefNodePath& getCoordinateSystemNodePath() const { return _coordinateSystemNodePath; } + osg::NodePath getCoordinateSystemNodePath() const; /** Dispatch the cull and draw for each of the Camera's for this frame.*/ virtual void frame(); @@ -323,7 +321,8 @@ class OSGPRODUCER_EXPORT Viewer : public OsgCameraGroup, public osgGA::GUIAction osg::ref_ptr _eventVisitor; - osg::RefNodePath _coordinateSystemNodePath; + typedef std::vector< osg::observer_ptr > ObserveredNodePath; + ObserveredNodePath _coordinateSystemNodePath; bool _recordingAnimationPath; double _recordingStartTime; diff --git a/src/osg/NodeTrackerCallback.cpp b/src/osg/NodeTrackerCallback.cpp index 56ce5bbdc..6f3813370 100644 --- a/src/osg/NodeTrackerCallback.cpp +++ b/src/osg/NodeTrackerCallback.cpp @@ -114,7 +114,7 @@ void NodeTrackerCallback::update(osg::Node& node) osg::NodePath nodePath; for(ObserveredNodePath::iterator itr = _trackNodePath.begin(); - itr != _trackNodePath.begin(); + itr != _trackNodePath.end(); ++itr) { nodePath.push_back(itr->get()); diff --git a/src/osgProducer/Viewer.cpp b/src/osgProducer/Viewer.cpp index 3cba0364d..167107f85 100644 --- a/src/osgProducer/Viewer.cpp +++ b/src/osgProducer/Viewer.cpp @@ -262,6 +262,18 @@ Viewer::~Viewer() { } +osg::NodePath Viewer::getCoordinateSystemNodePath() const +{ + osg::NodePath nodePath; + for(ObserveredNodePath::const_iterator itr = _coordinateSystemNodePath.begin(); + itr != _coordinateSystemNodePath.end(); + ++itr) + { + nodePath.push_back(const_cast(itr->get())); + } + return nodePath; +} + void Viewer::setWriteImageFileName(const std::string& filename) { _writeImageFileName = filename;