Add Lua function to ask module if a camera path is running

This commit is contained in:
Emma Broman
2020-11-18 13:49:38 +01:00
parent 2c3ec08329
commit 8498b3fd6d
2 changed files with 18 additions and 0 deletions

View File

@@ -73,6 +73,13 @@ scripting::LuaLibrary AutoNavigationModule::luaLibrary() const {
absPath("${MODULE_AUTONAVIGATION}/scripts/rendering.lua")
};
res.functions = {
{
"isFlying",
&autonavigation::luascriptfunctions::isFlying,
{},
"",
"Returns true if a camera path is currently running, and false otherwise."
},
{
"continuePath",
&autonavigation::luascriptfunctions::continuePath,

View File

@@ -43,6 +43,17 @@ namespace openspace::autonavigation::luascriptfunctions {
const double Epsilon = 1e-12;
int isFlying(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::isFlying");
AutoNavigationModule* module = global::moduleEngine->module<AutoNavigationModule>();
bool hasFinished = module->AutoNavigationHandler().hasFinished();
ghoul::lua::push(L, !hasFinished);
ghoul_assert(lua_gettop(L) == 1, "Incorrect number of items left on stack");
return 0;
}
int continuePath(lua_State* L) {
ghoul::lua::checkArgumentsAndThrow(L, 0, "lua::continuePath");