Skip to content

Commit

Permalink
Merge pull request #41 from rock-core/remove_viz
Browse files Browse the repository at this point in the history
remove visualization from old frame, when the visualization frame is updated
  • Loading branch information
doudou authored May 16, 2019
2 parents e714abd + d8c2ada commit 405114b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Vizkit3DWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,14 @@ void Vizkit3DWidget::setPluginDataFrameIntern(const QString& frame, QObject* plu
vizkit3d::VizPluginBase* viz= dynamic_cast<vizkit3d::VizPluginBase*>(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<osg::Group> 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);
//add to new frame
TransformerGraph::addFrame(*getRootNode(),frame.toStdString());
registerClickHandler(frame.toStdString());
osg::Group* node = TransformerGraph::getFrameGroup(*getRootNode(),frame.toStdString());
Expand Down

0 comments on commit 405114b

Please sign in to comment.