mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-03-14 01:10:11 -05:00
Add funciton and keybinding to stop playing a path
This commit is contained in:
@@ -69,6 +69,14 @@ local Keybindings = {
|
||||
GuiPath = "/Interaction",
|
||||
Local = false
|
||||
},
|
||||
{
|
||||
Key = "Q",
|
||||
Name = "Stop camera path",
|
||||
Command = "openspace.autonavigation.stopPath()",
|
||||
Documentation = "Stop a camera path.",
|
||||
GuiPath = "/Interaction",
|
||||
Local = false
|
||||
},
|
||||
}
|
||||
|
||||
asset.onInitialize(function ()
|
||||
|
||||
@@ -236,6 +236,10 @@ void AutoNavigationHandler::continuePath() {
|
||||
_isPlaying = true;
|
||||
}
|
||||
|
||||
void AutoNavigationHandler::stopPath() {
|
||||
_isPlaying = false;
|
||||
}
|
||||
|
||||
bool AutoNavigationHandler::handleInstruction(const Instruction& instruction, int index) {
|
||||
bool success = true;
|
||||
switch (instruction.type)
|
||||
|
||||
@@ -62,6 +62,7 @@ public:
|
||||
void startPath();
|
||||
void pausePath();
|
||||
void continuePath();
|
||||
void stopPath();
|
||||
|
||||
private:
|
||||
bool handleInstruction(const Instruction& instruction, int index);
|
||||
|
||||
@@ -59,6 +59,13 @@ scripting::LuaLibrary AutoNavigationModule::luaLibrary() const {
|
||||
"",
|
||||
"Continue playing a paused camera path."
|
||||
},
|
||||
{
|
||||
"stopPath",
|
||||
&autonavigation::luascriptfunctions::stopPath,
|
||||
{},
|
||||
"",
|
||||
"Stops a path, if one is being played."
|
||||
},
|
||||
{
|
||||
"goTo",
|
||||
&autonavigation::luascriptfunctions::goTo,
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace openspace::autonavigation::luascriptfunctions {
|
||||
const double EPSILON = 1e-12;
|
||||
|
||||
int continuePath(lua_State* L) {
|
||||
int nArguments = ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::continuePath");
|
||||
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::continuePath");
|
||||
|
||||
AutoNavigationModule* module = global::moduleEngine.module<AutoNavigationModule>();
|
||||
AutoNavigationHandler& handler = module->AutoNavigationHandler();
|
||||
@@ -51,6 +51,16 @@ namespace openspace::autonavigation::luascriptfunctions {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int stopPath(lua_State* L) {
|
||||
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::stopPath");
|
||||
|
||||
AutoNavigationModule* module = global::moduleEngine.module<AutoNavigationModule>();
|
||||
AutoNavigationHandler& handler = module->AutoNavigationHandler();
|
||||
handler.stopPath();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int goTo(lua_State* L) {
|
||||
int nArguments = ghoul::lua::checkArgumentsAndThrow(L, { 1, 2 }, "lua::goTo");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user