From 743ed07ac7ae8c0276d423ae63219618c11f6c2f Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 27 Jun 2020 15:33:50 +0100 Subject: [PATCH] Always load patchbay connections when importing a carla project This ignores SM, as it should for this specific case Signed-off-by: falkTX --- source/backend/CarlaEngine.hpp | 2 +- source/backend/engine/CarlaEngine.cpp | 27 +++++++++++++-------- source/backend/engine/CarlaEngineNative.cpp | 2 +- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/source/backend/CarlaEngine.hpp b/source/backend/CarlaEngine.hpp index 95d873c4b..0e0eab07e 100644 --- a/source/backend/CarlaEngine.hpp +++ b/source/backend/CarlaEngine.hpp @@ -1345,7 +1345,7 @@ protected: /*! * Common load project function for main engine and plugin. */ - bool loadProjectInternal(water::XmlDocument& xmlDoc); + bool loadProjectInternal(water::XmlDocument& xmlDoc, bool alwaysLoadConnections); // ------------------------------------------------------------------- // Helper functions diff --git a/source/backend/engine/CarlaEngine.cpp b/source/backend/engine/CarlaEngine.cpp index 29a09e3a5..341e2db10 100644 --- a/source/backend/engine/CarlaEngine.cpp +++ b/source/backend/engine/CarlaEngine.cpp @@ -1281,7 +1281,7 @@ bool CarlaEngine::loadProject(const char* const filename, const bool setAsCurren } XmlDocument xml(file); - return loadProjectInternal(xml); + return loadProjectInternal(xml, !setAsCurrentProject); } bool CarlaEngine::saveProject(const char* const filename, const bool setAsCurrentProject) @@ -2499,7 +2499,7 @@ static String findBinaryInCustomPath(const char* const searchPath, const char* c return String(); } -bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) +bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc, const bool alwaysLoadConnections) { CarlaScopedPointer xmlElement(xmlDoc.getDocumentElement(true)); CARLA_SAFE_ASSERT_RETURN_ERR(xmlElement != nullptr, "Failed to parse project file"); @@ -3003,16 +3003,23 @@ bool CarlaEngine::loadProjectInternal(water::XmlDocument& xmlDoc) // if we're running inside some session-manager (and using JACK), let them handle the external connections bool loadExternalConnections; - /**/ if (std::strcmp(getCurrentDriverName(), "JACK") != 0) + if (alwaysLoadConnections) + { loadExternalConnections = true; - else if (std::getenv("CARLA_DONT_MANAGE_CONNECTIONS") != nullptr) - loadExternalConnections = false; - else if (std::getenv("LADISH_APP_NAME") != nullptr) - loadExternalConnections = false; - else if (std::getenv("NSM_URL") != nullptr) - loadExternalConnections = false; + } else - loadExternalConnections = true; + { + /**/ if (std::strcmp(getCurrentDriverName(), "JACK") != 0) + loadExternalConnections = true; + else if (std::getenv("CARLA_DONT_MANAGE_CONNECTIONS") != nullptr) + loadExternalConnections = false; + else if (std::getenv("LADISH_APP_NAME") != nullptr) + loadExternalConnections = false; + else if (std::getenv("NSM_URL") != nullptr) + loadExternalConnections = false; + else + loadExternalConnections = true; + } // plus external connections too if (loadExternalConnections) diff --git a/source/backend/engine/CarlaEngineNative.cpp b/source/backend/engine/CarlaEngineNative.cpp index 9ffc47b82..5638ff508 100644 --- a/source/backend/engine/CarlaEngineNative.cpp +++ b/source/backend/engine/CarlaEngineNative.cpp @@ -1536,7 +1536,7 @@ protected: fOptionsForced = true; const String state(data); XmlDocument xml(state); - loadProjectInternal(xml); + loadProjectInternal(xml, true); reloadFromUI(); }