From af95d9895e2b7c9532947588e50745871c5f4a7a Mon Sep 17 00:00:00 2001 From: Micah Date: Tue, 14 Sep 2021 12:25:05 -0400 Subject: [PATCH 1/7] update slidedeck example for actions --- data/assets/examples/slidedeck.asset | 34 +++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/data/assets/examples/slidedeck.asset b/data/assets/examples/slidedeck.asset index 7d054dd2c1..885dabb3b8 100644 --- a/data/assets/examples/slidedeck.asset +++ b/data/assets/examples/slidedeck.asset @@ -29,9 +29,37 @@ asset.onInitialize(function () end) helper.setCurrentSlide(deck, 1) - openspace.bindKey("KP_6", "nextSlide()", "Next slide", "Next slide", "/Slides") - openspace.bindKey("KP_4", "previousSlide()", "Previous slide", "Previous slide", "/Slides") - openspace.bindKey("KP_0", "toggleSlides()", "Toggle slides", "Toggle slides", "/Slides") + + openspace.action.registerAction({ + Identifier = "slide_deck.prevslide", + Name = "Previous slide", + Command = "previousSlide()", + Documentation = "Previous slide", + GuiPath = "/Slides", + IsLocal = false + }) + openspace.bindKey("KP_4", "slide_deck.prevslide"); + + openspace.action.registerAction({ + Identifier = "slide_deck.nextslide", + Name = "Next slide", + Command = "nextSlide()", + Documentation = "Next slide", + GuiPath = "/Slides", + IsLocal = false + }) + openspace.bindKey("KP_6", "slide_deck.nextslide") + + openspace.action.registerAction({ + Identifier = "slide_deck.toggleslides", + Name = "Toggle slides", + Command = "toggleSlides()", + Documentation = "Toggle slides", + GuiPath = "/Slides", + IsLocal = false + }) + openspace.bindKey("KP_0", "slide_deck.toggleslides") + end) From 550e088d601326e8830ec7a50f3393f98c5b2a9a Mon Sep 17 00:00:00 2001 From: Micah Date: Tue, 14 Sep 2021 12:28:57 -0400 Subject: [PATCH 2/7] changes to shortcut topic for keyboard viewer --- modules/server/src/topics/shortcuttopic.cpp | 2 +- modules/webgui/webguimodule.cpp | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/server/src/topics/shortcuttopic.cpp b/modules/server/src/topics/shortcuttopic.cpp index c40ed6ec25..00a9fc8d0b 100644 --- a/modules/server/src/topics/shortcuttopic.cpp +++ b/modules/server/src/topics/shortcuttopic.cpp @@ -78,7 +78,7 @@ std::vector ShortcutTopic::shortcutsJson() const { { "super" , hasKeyModifier(k.modifier, KeyModifier::Super) } } }, - { "action", action.name }, + { "action", action.identifier }, }; json.push_back(shortcutJson); } diff --git a/modules/webgui/webguimodule.cpp b/modules/webgui/webguimodule.cpp index edd45b9846..5191eb0755 100644 --- a/modules/webgui/webguimodule.cpp +++ b/modules/webgui/webguimodule.cpp @@ -166,7 +166,12 @@ void WebGuiModule::internalInitialize(const ghoul::Dictionary& configuration) { const Parameters p = codegen::bake(configuration); _port = p.port.value_or(_port); - _address = p.address.value_or(_address); + if (p.address.has_value()) { + _address = p.address.value(); + } + else { + _address = "192.168.1.8"; //global::windowDelegate + } _webSocketInterface = p.webSocketInterface.value_or(_webSocketInterface); auto startOrStop = [this]() { From fff66c7855844ca49dfe9df2b7184f28a0ebf60b Mon Sep 17 00:00:00 2001 From: Micah Date: Tue, 14 Sep 2021 12:55:43 -0400 Subject: [PATCH 3/7] update guihash for keyboard viewer --- data/assets/util/webgui.asset | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/assets/util/webgui.asset b/data/assets/util/webgui.asset index b9f1d9be9a..324e301604 100644 --- a/data/assets/util/webgui.asset +++ b/data/assets/util/webgui.asset @@ -3,7 +3,7 @@ asset.require('./static_server') local guiCustomization = asset.require('customization/gui') -- Select which commit hashes to use for the frontend and backend -local frontendHash = "b777c48280801e3b54cf77c1231f949fe6e69ace" +local frontendHash = "913fe364fcd3baa314351dc4e332f9a1bdb340f0" local dataProvider = "data.openspaceproject.com/files/webgui" local frontend = asset.syncedResource({ From 26c131e7bc34acb991befa0b6982a57a0f7051f2 Mon Sep 17 00:00:00 2001 From: Alexander Bock Date: Tue, 14 Sep 2021 21:14:47 +0200 Subject: [PATCH 4/7] Update Ghoul repository to fix case where too many parameters are removed from a Lua state --- ext/ghoul | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ext/ghoul b/ext/ghoul index c7f7c61026..4b64684acd 160000 --- a/ext/ghoul +++ b/ext/ghoul @@ -1 +1 @@ -Subproject commit c7f7c6102609eadb8f8d4c45ab6dc8193740f809 +Subproject commit 4b64684acd728069e80948f9a4767b30baf268a3 From 1c0b7c347a83120db885542cfe843512dcd77652 Mon Sep 17 00:00:00 2001 From: Gene Payne Date: Tue, 14 Sep 2021 15:45:39 -0600 Subject: [PATCH 5/7] String-to-path fix for linux build --- modules/base/rendering/renderablemodel.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/base/rendering/renderablemodel.cpp b/modules/base/rendering/renderablemodel.cpp index cdec42d396..6f00faa4b5 100644 --- a/modules/base/rendering/renderablemodel.cpp +++ b/modules/base/rendering/renderablemodel.cpp @@ -588,11 +588,11 @@ void RenderableModel::initializeGL() { std::filesystem::path vs = _vertexShaderPath.empty() ? absPath("${MODULE_BASE}/shaders/model_vs.glsl") : - _vertexShaderPath; + std::filesystem::path(_vertexShaderPath); std::filesystem::path fs = _fragmentShaderPath.empty() ? absPath("${MODULE_BASE}/shaders/model_fs.glsl") : - _fragmentShaderPath; + std::filesystem::path(_fragmentShaderPath); return global::renderEngine->buildRenderProgram(ProgramName, vs, fs); } From 3b0a2e4c066df82cbc85bbb318a26bb3ea629d3c Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Thu, 16 Sep 2021 13:20:08 +0200 Subject: [PATCH 6/7] Rename 'generatePath' to 'createPath' shorter, better, faster (and I keep writing this by mistake all the time) --- src/navigation/pathnavigator.cpp | 6 +++--- src/navigation/pathnavigator_lua.inl | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/navigation/pathnavigator.cpp b/src/navigation/pathnavigator.cpp index b284c5e840..b48382af9c 100644 --- a/src/navigation/pathnavigator.cpp +++ b/src/navigation/pathnavigator.cpp @@ -436,11 +436,11 @@ scripting::LuaLibrary PathNavigator::luaLibrary() { "parameters can be left out." }, { - "generatePath", - &luascriptfunctions::generatePath, + "createPath", + &luascriptfunctions::createPath, {}, "table", - "Generate the path as described by the lua table input argument" + "Create the path as described by the lua table input argument" }, } }; diff --git a/src/navigation/pathnavigator_lua.inl b/src/navigation/pathnavigator_lua.inl index 2228feac23..134fff4b8c 100644 --- a/src/navigation/pathnavigator_lua.inl +++ b/src/navigation/pathnavigator_lua.inl @@ -170,8 +170,8 @@ int goToHeight(lua_State* L) { return 0; } -int generatePath(lua_State* L) { - ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::generatePath"); +int createPath(lua_State* L) { + ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::createPath"); ghoul::Dictionary dictionary = ghoul::lua::value(L); global::navigationHandler->pathNavigator().createPath(dictionary); From d160ac8bc84fa7f6c8c26e002dc5e6cb875dcf77 Mon Sep 17 00:00:00 2001 From: Emma Broman Date: Thu, 16 Sep 2021 13:58:04 +0200 Subject: [PATCH 7/7] Add Lua function to directly create path to a navigation state Note that paths to navstates still have to be improved, but this makes out life easier when testing --- src/navigation/pathnavigator.cpp | 10 +++++++ src/navigation/pathnavigator_lua.inl | 43 +++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/src/navigation/pathnavigator.cpp b/src/navigation/pathnavigator.cpp index b48382af9c..87edf005e7 100644 --- a/src/navigation/pathnavigator.cpp +++ b/src/navigation/pathnavigator.cpp @@ -434,6 +434,16 @@ scripting::LuaLibrary PathNavigator::luaLibrary() { "motion. If the optional bool is set to true, the target up vector for " "camera is set based on the target node. Either of the optional " "parameters can be left out." + }, + { + "goToNavigationState", + &luascriptfunctions::goToNavigationState, + {}, + "table, [double]", + "Create a path to the navigation state described by the input table. " + "The optional double specifies the target duration of the motion. Note " + "that roll must be included for the target up direction to be taken " + "into account." }, { "createPath", diff --git a/src/navigation/pathnavigator_lua.inl b/src/navigation/pathnavigator_lua.inl index 134fff4b8c..a5a71f1c59 100644 --- a/src/navigation/pathnavigator_lua.inl +++ b/src/navigation/pathnavigator_lua.inl @@ -26,6 +26,7 @@ #include #include #include +#include #include #include #include @@ -124,7 +125,7 @@ int goToHeight(lua_State* L) { ghoul::lua::checkArgumentsAndThrow(L, { 2, 4 }, "lua::goToHeight"); auto [nodeIdentifier, height, useUpFromTargetOrDuration, duration] = ghoul::lua::values< - std::string, double, std::optional>, + std::string, double, std::optional>, std::optional >(L); @@ -170,6 +171,46 @@ int goToHeight(lua_State* L) { return 0; } +int goToNavigationState(lua_State* L) { + ghoul::lua::checkArgumentsAndThrow(L, { 1, 2 }, "lua::goToNavigationState"); + auto [navigationState, duration] = + ghoul::lua::values>(L); + + try { + openspace::documentation::testSpecificationAndThrow( + interaction::NavigationState::Documentation(), + navigationState, + "NavigationState" + ); + } + catch (documentation::SpecificationError& e) { + LERRORC("goToNavigationState", ghoul::to_string(e.result)); + return ghoul::lua::luaError( + L, fmt::format("Unable to create a path: {}", e.what()) + ); + } + + using namespace std::string_literals; + ghoul::Dictionary instruction; + instruction.setValue("TargetType", "NavigationState"s); + instruction.setValue("NavigationState", navigationState); + + if (duration.has_value()) { + double d = *duration; + if (d <= Epsilon) { + return ghoul::lua::luaError(L, "Duration must be larger than zero"); + } + instruction.setValue("Duration", d); + } + + global::navigationHandler->pathNavigator().createPath(instruction); + + if (global::navigationHandler->pathNavigator().hasCurrentPath()) { + global::navigationHandler->pathNavigator().startPath(); + } + return 0; +} + int createPath(lua_State* L) { ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::createPath"); ghoul::Dictionary dictionary = ghoul::lua::value(L);