Files
OpenSpace/data/assets/util/screenshots_endpoint.asset
Alexander Bock 57fafe48f4 Rename Lua function to bring them more in line with the function naming in C++ (#2840)
* Rename Lua function to bring them more in line with the function naming in C++
2023-08-05 19:20:08 +02:00

22 lines
1.0 KiB
Lua

asset.onInitialize(function()
-- Disable the server, add production gui endpoint, and restart server.
-- The temporary disabling avoids restarting the server on each property change.
-- TODO: Add a trigger property to the module to restart the server "manually" and
-- remove automatic restart on each property change, since frequent restarting seems to
-- be unstable on MacOS.
local enabled = openspace.propertyValue("Modules.WebGui.ServerProcessEnabled")
openspace.setPropertyValueSingle("Modules.WebGui.ServerProcessEnabled", false)
local directories = openspace.propertyValue("Modules.WebGui.Directories")
directories[#directories + 1] = "screenshots"
directories[#directories + 1] = "${SCREENSHOTS}"
openspace.setPropertyValueSingle("Modules.WebGui.Directories", directories)
openspace.setPropertyValueSingle("Modules.WebGui.ServerProcessEnabled", enabled)
end)
asset.onDeinitialize(function()
-- TODO: Remove endpoints. As of 2019-10-29, OpenSpace sometimes
-- crashes when endpoints are removed while the application is closing.
end)