From 284118e83bc0b11f20d8e01b1b9b22db5accb1a4 Mon Sep 17 00:00:00 2001 From: Rhys Mainwaring Date: Sat, 13 Aug 2022 13:37:19 +0100 Subject: [PATCH] Partial revert #1352 - GzSceneManager Signed-off-by: Rhys Mainwaring --- .../plugins/scene_manager/GzSceneManager.cc | 40 ++++++------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/src/gui/plugins/scene_manager/GzSceneManager.cc b/src/gui/plugins/scene_manager/GzSceneManager.cc index 9bc10078760..cb7ca69d109 100644 --- a/src/gui/plugins/scene_manager/GzSceneManager.cc +++ b/src/gui/plugins/scene_manager/GzSceneManager.cc @@ -36,7 +36,6 @@ #include "gz/sim/EntityComponentManager.hh" #include "gz/sim/components/Name.hh" -#include "gz/sim/components/SystemPluginInfo.hh" #include "gz/sim/components/Visual.hh" #include "gz/sim/components/World.hh" #include "gz/sim/gui/GuiEvents.hh" @@ -144,54 +143,39 @@ void GzSceneManager::Update(const UpdateInfo &_info, this->dataPtr->renderUtil.UpdateFromECM(_info, _ecm); // load visual plugin on gui side - std::map plugins; + std::map pluginElems; if (!this->dataPtr->initializedVisualPlugins) { - _ecm.Each( + _ecm.Each( [&](const Entity &_entity, const components::Visual *, - const components::SystemPluginInfo *_plugins)->bool + const components::VisualPlugin *_plugin)->bool { - sdf::Plugins convertedPlugins = convert(_plugins->Data()); - plugins[_entity].insert(plugins[_entity].end(), - convertedPlugins.begin(), convertedPlugins.end()); + sdf::ElementPtr pluginElem = _plugin->Data(); + pluginElems[_entity] = _plugin->Data(); return true; }); this->dataPtr->initializedVisualPlugins = true; } else { - _ecm.EachNew( + _ecm.EachNew( [&](const Entity &_entity, const components::Visual *, - const components::SystemPluginInfo *_plugins)->bool + const components::VisualPlugin *_plugin)->bool { - sdf::Plugins convertedPlugins = convert(_plugins->Data()); - plugins[_entity].insert(plugins[_entity].end(), - convertedPlugins.begin(), convertedPlugins.end()); + sdf::ElementPtr pluginElem = _plugin->Data(); + pluginElems[_entity] = _plugin->Data(); return true; }); } - for (const auto &it : plugins) + for (const auto &it : pluginElems) { - // Send the new VisualPlugins event - gz::sim::gui::events::VisualPlugins visualPluginsEvent( + gz::sim::gui::events::VisualPlugin visualPluginEvent( it.first, it.second); gz::gui::App()->sendEvent( gz::gui::App()->findChild(), - &visualPluginsEvent); - - // Send the old VisualPlugin event - for (const sdf::Plugin &plugin : it.second) - { - GZ_UTILS_WARN_IGNORE__DEPRECATED_DECLARATION - gz::sim::gui::events::VisualPlugin visualPluginEvent( - it.first, plugin.ToElement()); - GZ_UTILS_WARN_RESUME__DEPRECATED_DECLARATION - gz::gui::App()->sendEvent( - gz::gui::App()->findChild(), - &visualPluginEvent); - } + &visualPluginEvent); } // Emit entities created / removed event for gui::Plugins which don't have