1
0
Fork 0

Canvas: Fully remove Window drawable if destroyed

This commit is contained in:
Thomas Geymayer 2012-08-05 18:06:56 +02:00
parent d6a5a911bc
commit 052d578483
2 changed files with 9 additions and 1 deletions

View file

@ -24,6 +24,8 @@
#include <osg/Texture2D> #include <osg/Texture2D>
#include <osgGA/GUIEventHandler> #include <osgGA/GUIEventHandler>
#include <boost/foreach.hpp>
/** /**
* Callback to enable/disable rendering of canvas displayed inside windows * Callback to enable/disable rendering of canvas displayed inside windows
*/ */
@ -108,7 +110,12 @@ namespace canvas
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
Window::~Window() Window::~Window()
{ {
BOOST_FOREACH(osg::Node* parent, _geometry->getParents())
{
osg::Geode* geode = dynamic_cast<osg::Geode*>(parent);
if( geode )
geode->removeDrawable(_geometry);
}
} }
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------

View file

@ -25,6 +25,7 @@
#include <simgear/props/propertyObject.hxx> #include <simgear/props/propertyObject.hxx>
#include <osg/Geode>
#include <osg/Geometry> #include <osg/Geometry>
namespace canvas namespace canvas