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

Add support for GUI entity creation #1122

Merged
merged 4 commits into from
Oct 22, 2021
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
13 changes: 11 additions & 2 deletions src/gui/GuiRunner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ GuiRunner::GuiRunner(const std::string &_worldName)

this->setProperty("worldName", QString::fromStdString(_worldName));

// Allow for creation of entities on GUI side.
// Note we have to start the entity id at an offset so it does not conflict
// with the ones on the server. The log playback starts at max / 2
// On the gui side, we will start entity id at an offset of max / 4
// todo(anyone) address
// https://github.com/ignitionrobotics/ign-gazebo/issues/1134
// so that an offset is not required
this->dataPtr->ecm.SetEntityCreateOffset(math::MAX_I64 / 4);

auto win = gui::App()->findChild<ignition::gui::MainWindow *>();
auto winWorldNames = win->property("worldNames").toStringList();
winWorldNames.append(QString::fromStdString(_worldName));
Expand Down Expand Up @@ -198,8 +207,6 @@ void GuiRunner::OnStateQt(const msgs::SerializedStepMap &_msg)
// Update all plugins
this->dataPtr->updateInfo = convert<UpdateInfo>(_msg.stats());
this->UpdatePlugins();
this->dataPtr->ecm.ClearNewlyCreatedEntities();
this->dataPtr->ecm.ProcessRemoveEntityRequests();
}

/////////////////////////////////////////////////
Expand All @@ -211,4 +218,6 @@ void GuiRunner::UpdatePlugins()
plugin->Update(this->dataPtr->updateInfo, this->dataPtr->ecm);
}
this->dataPtr->ecm.ClearRemovedComponents();
this->dataPtr->ecm.ClearNewlyCreatedEntities();
this->dataPtr->ecm.ProcessRemoveEntityRequests();
}