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) 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({ 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); } 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]() { diff --git a/src/navigation/pathnavigator.cpp b/src/navigation/pathnavigator.cpp index b284c5e840..87edf005e7 100644 --- a/src/navigation/pathnavigator.cpp +++ b/src/navigation/pathnavigator.cpp @@ -434,13 +434,23 @@ 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." }, { - "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..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,8 +171,48 @@ int goToHeight(lua_State* L) { return 0; } -int generatePath(lua_State* L) { - ghoul::lua::checkArgumentsAndThrow(L, 1, "lua::generatePath"); +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); global::navigationHandler->pathNavigator().createPath(dictionary);