From 3cab051abf01a35ed352e4a51e01a120ccf35673 Mon Sep 17 00:00:00 2001
From: Tobias Jacob <tobias.jacob@kit.edu>
Date: Fri, 18 Nov 2022 09:23:04 +0100
Subject: [PATCH 1/2] Generate application data on scenario start

---
 .../ScenarioManager/ScenarioManagerWidgetController.cpp    | 3 ---
 .../ScenarioManager/controller/ScenarioListController.cpp  | 7 +++++++
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/source/ArmarXGui/gui-plugins/ScenarioManager/ScenarioManagerWidgetController.cpp b/source/ArmarXGui/gui-plugins/ScenarioManager/ScenarioManagerWidgetController.cpp
index 2ffa4536..5f1c7f25 100644
--- a/source/ArmarXGui/gui-plugins/ScenarioManager/ScenarioManagerWidgetController.cpp
+++ b/source/ArmarXGui/gui-plugins/ScenarioManager/ScenarioManagerWidgetController.cpp
@@ -144,9 +144,6 @@ void ScenarioManagerWidgetController::init()
     QObject::connect(&scenarioListController, SIGNAL(scenarioClicked(Data_Structure::ScenarioPtr)),
                      &detailedApplicationController, SLOT(showScenario(Data_Structure::ScenarioPtr)));
 
-    QObject::connect(&scenarioListController, SIGNAL(scenarioClicked(Data_Structure::ScenarioPtr)),
-                     &detailedApplicationController, SLOT(showScenario(Data_Structure::ScenarioPtr)));
-
     QObject::connect(&scenarioListController, SIGNAL(statusUpdated()),
                      widget.detailedApplicationView, SLOT(updateStatus()));
 
diff --git a/source/ArmarXGui/gui-plugins/ScenarioManager/controller/ScenarioListController.cpp b/source/ArmarXGui/gui-plugins/ScenarioManager/controller/ScenarioListController.cpp
index 936b2ba9..2a8d92e7 100644
--- a/source/ArmarXGui/gui-plugins/ScenarioManager/controller/ScenarioListController.cpp
+++ b/source/ArmarXGui/gui-plugins/ScenarioManager/controller/ScenarioListController.cpp
@@ -860,6 +860,13 @@ bool ScenarioListController::StartScenario(ScenarioPtr scenario, ScenarioStartMo
 
     if (mode == LocalStart)
     {
+        // Make sure all required data files are generated when launching scenario
+        const ApplicationInstanceVectorPtr applications = scenario->getApplications();
+        for (ApplicationInstancePtr applicationInstance : *applications) {
+            executor->loadAndSetCachedProperties(applicationInstance, Parser::IceParser::getCacheDir(), false, false);
+            applicationInstance->load();
+        }
+
         if (statusManager.isIceScenario(scenario) && scenario->getStatus() != ApplicationStatus::Stopped)
         {
             QMessageBox::StandardButton reply;
-- 
GitLab


From 7c3fd51eb6eec508554f515479ebaa750e0ec42a Mon Sep 17 00:00:00 2001
From: Tobias Jacob <tobias.jacob@kit.edu>
Date: Mon, 21 Nov 2022 10:16:13 +0100
Subject: [PATCH 2/2] check application not null and fix braces

---
 .../ScenarioManager/controller/ScenarioListController.cpp     | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/source/ArmarXGui/gui-plugins/ScenarioManager/controller/ScenarioListController.cpp b/source/ArmarXGui/gui-plugins/ScenarioManager/controller/ScenarioListController.cpp
index 2a8d92e7..3321884f 100644
--- a/source/ArmarXGui/gui-plugins/ScenarioManager/controller/ScenarioListController.cpp
+++ b/source/ArmarXGui/gui-plugins/ScenarioManager/controller/ScenarioListController.cpp
@@ -862,7 +862,9 @@ bool ScenarioListController::StartScenario(ScenarioPtr scenario, ScenarioStartMo
     {
         // Make sure all required data files are generated when launching scenario
         const ApplicationInstanceVectorPtr applications = scenario->getApplications();
-        for (ApplicationInstancePtr applicationInstance : *applications) {
+        ARMARX_CHECK_NOT_NULL(applications);
+        for (ApplicationInstancePtr applicationInstance : *applications)
+        {
             executor->loadAndSetCachedProperties(applicationInstance, Parser::IceParser::getCacheDir(), false, false);
             applicationInstance->load();
         }
-- 
GitLab