diff --git a/config/two_nodes.xml b/config/two_nodes.xml
index b4ae20f8c0..caa62075ea 100644
--- a/config/two_nodes.xml
+++ b/config/two_nodes.xml
@@ -33,4 +33,9 @@
-
\ No newline at end of file
+
+
diff --git a/include/openspace/documentation/documentationgenerator.h b/include/openspace/documentation/documentationgenerator.h
index 92fd1cd910..ad255aaaed 100644
--- a/include/openspace/documentation/documentationgenerator.h
+++ b/include/openspace/documentation/documentationgenerator.h
@@ -82,7 +82,6 @@ public:
*/
void writeDocumentation(const std::string& filename);
-protected:
/**
* This abstract method is used by concrete subclasses to provide the actual data that
* is used in the documentation written by this DocumentationGenerator class. The JSON
diff --git a/include/openspace/engine/globals.h b/include/openspace/engine/globals.h
index 9d55621446..81b5210534 100644
--- a/include/openspace/engine/globals.h
+++ b/include/openspace/engine/globals.h
@@ -39,7 +39,6 @@ class DownloadManager;
class LuaConsole;
class MissionManager;
class ModuleEngine;
-class NetworkEngine;
class OpenSpaceEngine;
class ParallelPeer;
class RaycasterManager;
@@ -75,7 +74,6 @@ DownloadManager& gDownloadManager();
LuaConsole& gLuaConsole();
MissionManager& gMissionManager();
ModuleEngine& gModuleEngine();
-NetworkEngine& gNetworkEngine();
OpenSpaceEngine& gOpenSpaceEngine();
ParallelPeer& gParallelPeer();
RaycasterManager& gRaycasterManager();
@@ -106,7 +104,6 @@ static DownloadManager& downloadManager = detail::gDownloadManager();
static LuaConsole& luaConsole = detail::gLuaConsole();
static MissionManager& missionManager = detail::gMissionManager();
static ModuleEngine& moduleEngine = detail::gModuleEngine();
-static NetworkEngine& networkEngine = detail::gNetworkEngine();
static OpenSpaceEngine& openSpaceEngine = detail::gOpenSpaceEngine();
static ParallelPeer& parallelPeer = detail::gParallelPeer();
static RaycasterManager& raycasterManager = detail::gRaycasterManager();
diff --git a/include/openspace/interaction/keybindingmanager.h b/include/openspace/interaction/keybindingmanager.h
index 967f2c0f2e..acaa00df91 100644
--- a/include/openspace/interaction/keybindingmanager.h
+++ b/include/openspace/interaction/keybindingmanager.h
@@ -69,11 +69,12 @@ public:
static scripting::LuaLibrary luaLibrary();
void keyboardCallback(Key key, KeyModifier modifier, KeyAction action);
+
+ std::string generateJson() const override;
const std::multimap& keyBindings() const;
private:
- std::string generateJson() const override;
std::multimap _keyLua;
};
diff --git a/include/openspace/rendering/renderengine.h b/include/openspace/rendering/renderengine.h
index b1a5d0c878..fd71f3880d 100644
--- a/include/openspace/rendering/renderengine.h
+++ b/include/openspace/rendering/renderengine.h
@@ -53,8 +53,6 @@ class SceneManager;
class ScreenLog;
class ScreenSpaceRenderable;
struct ShutdownInformation;
-class Syncable;
-class SyncBuffer;
class RenderEngine : public properties::PropertyOwner {
public:
diff --git a/include/openspace/scripting/scriptengine.h b/include/openspace/scripting/scriptengine.h
index 5f3f4fce9f..26d750ecfd 100644
--- a/include/openspace/scripting/scriptengine.h
+++ b/include/openspace/scripting/scriptengine.h
@@ -32,6 +32,9 @@
#include
#include
#include
+#include
+#include
+#include
namespace openspace { class SyncBuffer; }
@@ -47,8 +50,15 @@ namespace openspace::scripting {
*/
class ScriptEngine : public Syncable, public DocumentationGenerator {
public:
+ using ScriptCallback = std::optional>;
BooleanType(RemoteScripting);
+ struct QueueItem {
+ std::string script;
+ RemoteScripting remoteScripting;
+ ScriptCallback callback;
+ };
+
static constexpr const char* OpenSpaceLibraryName = "openspace";
ScriptEngine();
@@ -71,7 +81,7 @@ public:
void addLibrary(LuaLibrary library);
bool hasLibrary(const std::string& name);
- bool runScript(const std::string& script);
+ bool runScript(const std::string& script, ScriptCallback callback = ScriptCallback());
bool runScriptFile(const std::string& filename);
bool writeLog(const std::string& script);
@@ -81,13 +91,12 @@ public:
virtual void decode(SyncBuffer* syncBuffer) override;
virtual void postSync(bool isMaster) override;
- void queueScript(const std::string &script, RemoteScripting remoteScripting);
-
- void setLogFile(const std::string& filename, const std::string& type);
-
- std::vector cachedScripts();
+ void queueScript(const std::string& script, RemoteScripting remoteScripting,
+ ScriptCallback cb = ScriptCallback());
std::vector allLuaFunctions() const;
+
+ std::string generateJson() const override;
private:
BooleanType(Replace);
@@ -100,23 +109,20 @@ private:
void addBaseLibrary();
void remapPrintFunction();
- std::string generateJson() const override;
-
ghoul::lua::LuaState _state;
std::vector _registeredLibraries;
+ std::queue _incomingScripts;
- //sync variables
- std::mutex _mutex;
- std::vector> _queuedScripts;
- std::vector _receivedScripts;
- std::string _currentSyncedScript;
+ // Slave scripts are mutex protected since decode and rendering may
+ // happen asynchronously.
+ std::mutex _slaveScriptsMutex;
+ std::queue _slaveScriptQueue;
+ std::queue _masterScriptQueue;
- //parallel variables
- //std::map> _cachedScripts;
- //std::mutex _cachedScriptsMutex;
+ std::vector _scriptsToSync;
- //logging variables
+ // Logging variables
bool _logFileExists = false;
bool _logScripts = true;
std::string _logType;
diff --git a/include/openspace/util/camera.h b/include/openspace/util/camera.h
index fb78c1becd..da511165f1 100644
--- a/include/openspace/util/camera.h
+++ b/include/openspace/util/camera.h
@@ -33,7 +33,6 @@
namespace openspace {
class SceneGraphNode;
-class SyncBuffer;
/**
* This class still needs some more love. Suggested improvements:
diff --git a/include/openspace/util/factorymanager.h b/include/openspace/util/factorymanager.h
index 1bdc5202c2..1f3dad0941 100644
--- a/include/openspace/util/factorymanager.h
+++ b/include/openspace/util/factorymanager.h
@@ -110,9 +110,9 @@ public:
*/
template
ghoul::TemplateFactory* factory() const;
-
-private:
+
std::string generateJson() const override;
+private:
/// Singleton member for the Factory Manager
static FactoryManager* _manager;
diff --git a/modules/server/CMakeLists.txt b/modules/server/CMakeLists.txt
index ca749b3885..5b0a61fc70 100644
--- a/modules/server/CMakeLists.txt
+++ b/modules/server/CMakeLists.txt
@@ -33,6 +33,7 @@ set(HEADER_FILES
include/serverinterface.h
include/topics/authorizationtopic.h
include/topics/bouncetopic.h
+ include/topics/documentationtopic.h
include/topics/getpropertytopic.h
include/topics/luascripttopic.h
include/topics/setpropertytopic.h
@@ -53,6 +54,7 @@ set(SOURCE_FILES
src/serverinterface.cpp
src/topics/authorizationtopic.cpp
src/topics/bouncetopic.cpp
+ src/topics/documentationtopic.cpp
src/topics/getpropertytopic.cpp
src/topics/luascripttopic.cpp
src/topics/setpropertytopic.cpp
diff --git a/modules/server/include/jsonconverters.h b/modules/server/include/jsonconverters.h
index 72cce8d49a..75286a3d35 100644
--- a/modules/server/include/jsonconverters.h
+++ b/modules/server/include/jsonconverters.h
@@ -27,6 +27,7 @@
#include
#include
+#include
namespace openspace::properties {
@@ -53,6 +54,13 @@ void to_json(nlohmann::json& j, const Renderable* pR);
} // namespace openspace
+namespace ghoul {
+
+void to_json(nlohmann::json& j, const Dictionary& d);
+void to_json(nlohmann::json& j, const Dictionary* d);
+
+} // namespace ghoul
+
namespace glm {
void to_json(nlohmann::json& j, const dvec3& v);
diff --git a/include/openspace/network/networkengine.h b/modules/server/include/topics/documentationtopic.h
similarity index 61%
rename from include/openspace/network/networkengine.h
rename to modules/server/include/topics/documentationtopic.h
index 1e0d774760..0733cad4eb 100644
--- a/include/openspace/network/networkengine.h
+++ b/modules/server/include/topics/documentationtopic.h
@@ -22,58 +22,22 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
-#ifndef __OPENSPACE_CORE___NETWORKENGINE___H__
-#define __OPENSPACE_CORE___NETWORKENGINE___H__
+#ifndef __OPENSPACE_MODULE_SERVER___DOCUMENTATION_TOPIC___H__
+#define __OPENSPACE_MODULE_SERVER___DOCUMENTATION_TOPIC___H__
-#include
-#include