Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove visualization from old frame, when the visualization frame is updated #41

Merged
merged 2 commits into from
May 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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