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

Check empty world name in Scene3d #662

Merged
merged 3 commits into from
Mar 5, 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
30 changes: 16 additions & 14 deletions src/gui/plugins/scene3d/Scene3D.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2721,29 +2721,31 @@ void Scene3D::Update(const UpdateInfo &_info,
if (this->dataPtr->worldName.empty())
{
// TODO(anyone) Only one scene is supported for now
Entity worldEntity;
_ecm.Each<components::World, components::Name>(
[&](const Entity &/*_entity*/,
[&](const Entity &_entity,
const components::World * /* _world */ ,
const components::Name *_name)->bool
{
this->dataPtr->worldName = _name->Data();
worldEntity = _entity;
return true;
});

renderWindow->SetWorldName(this->dataPtr->worldName);
auto worldEntity =
_ecm.EntityByComponents(components::Name(this->dataPtr->worldName),
components::World());
auto renderEngineGuiComp =
_ecm.Component<components::RenderEngineGuiPlugin>(worldEntity);
if (renderEngineGuiComp && !renderEngineGuiComp->Data().empty())
if (!this->dataPtr->worldName.empty())
{
this->dataPtr->renderUtil->SetEngineName(renderEngineGuiComp->Data());
}
else
{
igndbg << "RenderEngineGuiPlugin component not found, "
"render engine won't be set from the ECM" << std::endl;
renderWindow->SetWorldName(this->dataPtr->worldName);
auto renderEngineGuiComp =
_ecm.Component<components::RenderEngineGuiPlugin>(worldEntity);
if (renderEngineGuiComp && !renderEngineGuiComp->Data().empty())
{
this->dataPtr->renderUtil->SetEngineName(renderEngineGuiComp->Data());
}
else
{
igndbg << "RenderEngineGuiPlugin component not found, "
"render engine won't be set from the ECM " << std::endl;
}
}
}

Expand Down