mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-31 00:18:39 -06:00
142 lines
5.7 KiB
Plaintext
142 lines
5.7 KiB
Plaintext
local sceneHelper = asset.require('./scene_helper')
|
|
local propertyHelper = asset.require('./property_helper')
|
|
|
|
local Keybindings = {
|
|
{
|
|
Key = "F1",
|
|
Name = "Show Native GUI",
|
|
Command = propertyHelper.invert('Modules.ImGUI.Main.Enabled'),
|
|
Documentation = "Shows or hides the native UI",
|
|
GuiPath = "/Native GUI",
|
|
Local = true
|
|
},
|
|
{
|
|
Key = "F4",
|
|
Name = "Show Performance Measurements",
|
|
Command = propertyHelper.invert("RenderEngine.PerformanceMeasurements"),
|
|
Documentation = "Toogles performance measurements that shows rendering time informations.",
|
|
GuiPath = "/Native GUI",
|
|
Local = true
|
|
},
|
|
{
|
|
Key = "ESC",
|
|
Name = "Toggle Shutdown",
|
|
Command = "openspace.toggleShutdown()",
|
|
Documentation = "Toggles the shutdown that will stop OpenSpace after a grace period. Press again to cancel the shutdown during this period.",
|
|
Local = true
|
|
},
|
|
{
|
|
Key = "PRINT_SCREEN",
|
|
Name = "Take Screenshot",
|
|
Command = "openspace.setPropertyValueSingle('RenderEngine.TakeScreenshot', nil)",
|
|
Documentation = "Saves the contents of the screen to a file in the working directory.",
|
|
GuiPath = "/Rendering",
|
|
Local = true
|
|
},
|
|
{
|
|
Key = "SPACE",
|
|
Name = "Toggle Pause (Interpolated)",
|
|
Command = "openspace.time.interpolateTogglePause()",
|
|
Documentation = "Smoothly starts and stops the simulation time.",
|
|
GuiPath = "/Simulation Speed",
|
|
Local = true
|
|
},
|
|
{
|
|
Key = "Shift+SPACE",
|
|
Name = "Toggle Pause (Immediate)",
|
|
Command = "openspace.time.togglePause()",
|
|
Documentation = "Immediately starts and stops the simulation time.",
|
|
GuiPath = "/Simulation Speed",
|
|
Local = true
|
|
},
|
|
{
|
|
Key = "f",
|
|
Name = "Toggle roation friction",
|
|
Command = propertyHelper.invert('NavigationHandler.OrbitalNavigator.Friction.RotationalFriction'),
|
|
Documentation = "Toggles the rotational friction of the camera. If it is disabled, the camera rotates around the focus object indefinitely.",
|
|
GuiPath = "/Navigation",
|
|
Local = false
|
|
},
|
|
{
|
|
Key = "Shift+f",
|
|
Name = "Toggle Zoom Friction",
|
|
Command = propertyHelper.invert('NavigationHandler.OrbitalNavigator.Friction.ZoomFriction'),
|
|
Documentation = "Toggles the zoom friction of the camera. If it is disabled, the camera rises up from or closes in towards the focus object indefinitely.",
|
|
GuiPath = "/Navigation",
|
|
Local = false
|
|
},
|
|
{
|
|
Key = "Ctrl+f",
|
|
Name = "Toggle Roll Friction",
|
|
Command = propertyHelper.invert('NavigationHandler.OrbitalNavigator.Friction.RollFriction'),
|
|
Documentation = "Toggles the roll friction of the camera. If it is disabled, the camera rolls around its own axis indefinitely.",
|
|
GuiPath = "/Navigation",
|
|
Local = false
|
|
},
|
|
{
|
|
Key = "w",
|
|
Name = "Fade to/from black",
|
|
Command = "openspace.toggleFade(3)",
|
|
Documentation = "Toggles the fade to black within 3 seconds or shows the rendering after 3 seconds.",
|
|
GuiPath = "/Rendering",
|
|
Local = false
|
|
},
|
|
{
|
|
Key = "Tab",
|
|
Name = "Toggle main GUI",
|
|
Command = propertyHelper.invert('Modules.CefWebGui.Visible'),
|
|
Documentation = "Toggles the main GUI",
|
|
GuiPath = "/GUI",
|
|
Local = false
|
|
},
|
|
{
|
|
Key = "Shift+Tab",
|
|
Name = "Toggle dashboard and overlays",
|
|
Command =
|
|
[[local isEnabled = openspace.getPropertyValue('Dashboard.IsEnabled');
|
|
openspace.setPropertyValueSingle('Dashboard.IsEnabled', not isEnabled);
|
|
openspace.setPropertyValueSingle("RenderEngine.ShowLog", not isEnabled);
|
|
openspace.setPropertyValueSingle("RenderEngine.ShowVersion", not isEnabled);
|
|
openspace.setPropertyValueSingle("RenderEngine.ShowCamera", not isEnabled)]],
|
|
Documentation = "Toggles the dashboard and overlays",
|
|
GuiPath = "/GUI",
|
|
Local = false
|
|
},
|
|
{
|
|
Key = "Alt+R",
|
|
Name = "Toggle rendering on master",
|
|
Command = propertyHelper.invert('RenderEngine.DisableMasterRendering'),
|
|
Documentation = "Toggles the rendering on master",
|
|
GuiPath = "/Rendering",
|
|
Local = false
|
|
}
|
|
}
|
|
|
|
local DeltaTimeKeys
|
|
|
|
asset.onInitialize(function()
|
|
Keys = sceneHelper.bindKeys(Keybindings)
|
|
|
|
DeltaTimeKeys = sceneHelper.setDeltaTimeKeys({
|
|
-- 1 2 3 4 5 6 7 8 9 0
|
|
--------------------------------------------------------------------------------------------------------------------------
|
|
-- 1s 2s 5s 10s 30s 1m 2m 5m 10m 30m
|
|
1, 2, 5, 10, 30, 60, 120, 300, 600, 1800,
|
|
|
|
-- 1h 2h 3h 6h 12h 1d 2d 4d 1w 2w
|
|
3600, 7200, 10800, 21600, 43200, 86400, 172800, 345600, 604800, 1209600,
|
|
|
|
-- 1mo 2mo 3mo 6mo 1yr 2y 5y 10y 20y 50y
|
|
2592000, 5184000, 7776000, 15552000, 31536000, 63072000, 157680000, 315360000, 630720000, 1576800000
|
|
})
|
|
-- OBS: One month (1mo) is approximated by 30 days.
|
|
end)
|
|
|
|
asset.onDeinitialize(function ()
|
|
sceneHelper.unbindKeys(Keybindings)
|
|
sceneHelper.unbindKeys(DeltaTimeKeys)
|
|
end)
|
|
|
|
asset.export("DefaultKeybindings", Keybindings)
|
|
asset.export("DefaultDeltaTimeKeys", DeltaTimeKeys)
|