From a07b4a5afeb4fd933382d45d6885afa6df63f20d Mon Sep 17 00:00:00 2001 From: sylvass Date: Tue, 28 Dec 2021 08:09:31 -0500 Subject: [PATCH] Ensure all nodes in a cluster establish contact with their own instance of the wwt application (needs an updated website version - this update will not work with the current website version on the server) --- modules/skybrowser/skybrowsermodule.cpp | 7 +++++++ modules/skybrowser/skybrowsermodule_lua.inl | 18 ++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/modules/skybrowser/skybrowsermodule.cpp b/modules/skybrowser/skybrowsermodule.cpp index 54304495e9..bbe5e6a34f 100644 --- a/modules/skybrowser/skybrowsermodule.cpp +++ b/modules/skybrowser/skybrowsermodule.cpp @@ -267,6 +267,13 @@ namespace openspace { "Add one or multiple exoplanet systems to the scene, as specified by the " "input. An input string should be the name of the system host star" }, + { + "startSetup", + &skybrowser::luascriptfunctions::startSetup, + "string or list of strings", + "Add one or multiple exoplanet systems to the scene, as specified by the " + "input. An input string should be the name of the system host star" + }, }; return res; diff --git a/modules/skybrowser/skybrowsermodule_lua.inl b/modules/skybrowser/skybrowsermodule_lua.inl index 142836713d..3ede08a758 100644 --- a/modules/skybrowser/skybrowsermodule_lua.inl +++ b/modules/skybrowser/skybrowsermodule_lua.inl @@ -163,6 +163,20 @@ int loadImagesToWWT(lua_State* L) { return 0; } +int startSetup(lua_State* L) { + // This is called when the sky_browser website is connected to OpenSpace + ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::startSetup"); + + // To ensure each node in a cluster calls its own instance of the wwt application + // Do not send this script to the other nodes + openspace::global::scriptEngine->queueScript( + "openspace.skybrowser.sendOutIdsToBrowsers();", + scripting::ScriptEngine::RemoteScripting::No + ); + + return 0; +} + int sendOutIdsToBrowsers(lua_State* L) { // This is called when the sky_browser website is connected to OpenSpace ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::sendOutIdsToBrowsers"); @@ -512,8 +526,8 @@ int createTargetBrowserPair(lua_State* L) { std::string idTarget = "SkyTarget" + std::to_string(noOfPairs); glm::vec3 positionBrowser = { -1.0f, -0.5f, -2.1f }; std::string guiPath = "/SkyBrowser"; - std::string url = "https://data.openspaceproject.com/dist/skybrowser/page/"; - //std::string url = "http://localhost:8000"; // check webgl version + //std::string url = "https://data.openspaceproject.com/dist/skybrowser/page/"; + std::string url = "http://localhost:8000"; // check webgl version //std::string url = "https://get.webgl.org"; glm::ivec3 color = randomBorderColor();