From d123939161025632b95146f9b26d0236ee4d26da Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Wed, 15 May 2019 16:34:58 +0200 Subject: [PATCH 1/2] remove visualization from old frame, when the visualization frame is updated --- src/Vizkit3DWidget.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/Vizkit3DWidget.cpp b/src/Vizkit3DWidget.cpp index 35af2fc..b78d073 100644 --- a/src/Vizkit3DWidget.cpp +++ b/src/Vizkit3DWidget.cpp @@ -846,13 +846,24 @@ void Vizkit3DWidget::setPluginDataFrameIntern(const QString& frame, QObject* plu if(!viz) throw std::runtime_error("setPluginDataFrame called with something that is not a vizkit3d plugin"); + //remove plugin viz from old frame + osg::ref_ptr vizgroup = viz->getRootNode(); + //get old frame + QString oldframe = viz->getVisualizationFrame(); + //remove from old frame + osg::Group* oldgroup = TransformerGraph::getFrameGroup(*getRootNode(),oldframe.toStdString()); + oldgroup->removeChild(vizgroup); + + TransformerGraph::addFrame(*getRootNode(),frame.toStdString()); + registerClickHandler(frame.toStdString()); osg::Group* node = TransformerGraph::getFrameGroup(*getRootNode(),frame.toStdString()); assert(node); PluginMap::iterator it = plugins.find(viz); if (it != plugins.end()) { + (it->second).osg_group_ptr = node; if(viz != env_plugin && viz->isPluginEnabled()) From d8c2ada431c5f5b15d8ae08c0863251063c34418 Mon Sep 17 00:00:00 2001 From: Steffen Planthaber Date: Thu, 16 May 2019 09:55:01 +0200 Subject: [PATCH 2/2] removed newlines --- src/Vizkit3DWidget.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/Vizkit3DWidget.cpp b/src/Vizkit3DWidget.cpp index b78d073..1e39e0f 100644 --- a/src/Vizkit3DWidget.cpp +++ b/src/Vizkit3DWidget.cpp @@ -845,7 +845,6 @@ void Vizkit3DWidget::setPluginDataFrameIntern(const QString& frame, QObject* plu vizkit3d::VizPluginBase* viz= dynamic_cast(plugin); if(!viz) throw std::runtime_error("setPluginDataFrame called with something that is not a vizkit3d plugin"); - //remove plugin viz from old frame osg::ref_ptr vizgroup = viz->getRootNode(); //get old frame @@ -853,17 +852,14 @@ void Vizkit3DWidget::setPluginDataFrameIntern(const QString& frame, QObject* plu //remove from old frame osg::Group* oldgroup = TransformerGraph::getFrameGroup(*getRootNode(),oldframe.toStdString()); oldgroup->removeChild(vizgroup); - - + //add to new frame TransformerGraph::addFrame(*getRootNode(),frame.toStdString()); - registerClickHandler(frame.toStdString()); osg::Group* node = TransformerGraph::getFrameGroup(*getRootNode(),frame.toStdString()); assert(node); PluginMap::iterator it = plugins.find(viz); if (it != plugins.end()) { - (it->second).osg_group_ptr = node; if(viz != env_plugin && viz->isPluginEnabled())