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 1 commit
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
11 changes: 11 additions & 0 deletions src/Vizkit3DWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<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);


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks reasonable. Just remove all the new newlines that just muddy the code please.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed them

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())
Expand Down