Skip to content

Commit 1ee77fc

Browse files
committed
Fix log playback GUI display (#2611)
Loading the logging playback plugin before `SceneBroadcaster` prevents playback from being displayed on the GUI. --------- Signed-off-by: Addisu Z. Taddese <[email protected]> Co-authored-by: Arjo Chakravarty <[email protected]> (cherry picked from commit ca40c1d) # Conflicts: # src/SimulationRunner.cc
1 parent 6f1f867 commit 1ee77fc

File tree

1 file changed

+40
-2
lines changed

1 file changed

+40
-2
lines changed

src/SimulationRunner.cc

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1587,8 +1587,6 @@ void SimulationRunner::CreateEntities(const sdf::World &_world)
15871587
this->entityCompMgr.ProcessRemoveEntityRequests();
15881588
this->entityCompMgr.ClearRemovedComponents();
15891589

1590-
this->LoadLoggingPlugins(this->serverConfig);
1591-
15921590
// Load any additional plugins from the Server Configuration
15931591
this->LoadServerPlugins(this->serverConfig.Plugins());
15941592

@@ -1598,9 +1596,49 @@ void SimulationRunner::CreateEntities(const sdf::World &_world)
15981596
{
15991597
gzmsg << "No systems loaded from SDF, loading defaults" << std::endl;
16001598
bool isPlayback = !this->serverConfig.LogPlaybackPath().empty();
1599+
<<<<<<< HEAD
16011600
auto plugins = gz::sim::loadPluginInfo(isPlayback);
16021601
this->LoadServerPlugins(plugins);
16031602
}
1603+
=======
1604+
auto defaultPlugins = gz::sim::loadPluginInfo(isPlayback);
1605+
if (loadedWorldPlugins.empty())
1606+
{
1607+
gzmsg << "No systems loaded from SDF, loading defaults" << std::endl;
1608+
}
1609+
else
1610+
{
1611+
std::unordered_set<std::string> loadedWorldPluginFileNames;
1612+
for (const auto &pl : loadedWorldPlugins)
1613+
{
1614+
loadedWorldPluginFileNames.insert(pl.fname);
1615+
}
1616+
auto isPluginLoaded =
1617+
[&loadedWorldPluginFileNames](const ServerConfig::PluginInfo &_pl)
1618+
{
1619+
return loadedWorldPluginFileNames.count(_pl.Plugin().Filename()) != 0;
1620+
};
1621+
1622+
// Remove plugin if it's already loaded so as to not duplicate world
1623+
// plugins.
1624+
defaultPlugins.remove_if(isPluginLoaded);
1625+
1626+
gzdbg << "Additional plugins to load:\n";
1627+
for (const auto &plugin : defaultPlugins)
1628+
{
1629+
gzdbg << plugin.Plugin().Name() << " " << plugin.Plugin().Filename()
1630+
<< "\n";
1631+
}
1632+
}
1633+
1634+
this->LoadServerPlugins(defaultPlugins);
1635+
// Load logging plugins after all server plugins so that necessary
1636+
// plugins such as SceneBroadcaster are loaded first. This might be
1637+
// a bug or an assumption made in the logging plugins.
1638+
this->LoadLoggingPlugins(this->serverConfig);
1639+
1640+
};
1641+
>>>>>>> ca40c1db (Fix log playback GUI display (#2611))
16041642

16051643
// Store the initial state of the ECM;
16061644
this->initialEntityCompMgr.CopyFrom(this->entityCompMgr);

0 commit comments

Comments
 (0)