mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-20 03:49:31 -06:00
* Harmonize capitalization of action names (closes #2215) * Fix confusion between delta time and simulation time (closes #2536)
215 lines
7.0 KiB
Lua
215 lines
7.0 KiB
Lua
local propertyHelper = asset.require("./property_helper")
|
|
|
|
local toggle_native_ui = {
|
|
Identifier = "os_default.toggle_native_ui",
|
|
Name = "Show native GUI",
|
|
Command = propertyHelper.invert("Modules.ImGUI.Enabled"),
|
|
Documentation = "Shows or hides the native UI",
|
|
GuiPath = "/System/GUI",
|
|
IsLocal = true,
|
|
|
|
Key = "F1"
|
|
}
|
|
|
|
local toggle_shutdown = {
|
|
Identifier = "os_default.toggle_shutdown",
|
|
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",
|
|
GuiPath = "/System",
|
|
IsLocal = true,
|
|
|
|
Key = "ESC"
|
|
}
|
|
|
|
local take_screenshot = {
|
|
Identifier = "os_default.take_screenshot",
|
|
Name = "Take screenshot",
|
|
Command = "openspace.takeScreenshot()",
|
|
Documentation = "Saves the contents of the screen to a file in the ${SCREENSHOTS} directory",
|
|
GuiPath = "/System/Rendering",
|
|
IsLocal = true,
|
|
|
|
Key = "F12"
|
|
}
|
|
|
|
local toggle_pause_interpolated = {
|
|
Identifier = "os_default.toggle_pause_interpolated",
|
|
Name = "Toggle pause (interpolate)",
|
|
Command = "openspace.time.pauseToggleViaKeyboard()",
|
|
Documentation = "Smoothly starts and stops the simulation time",
|
|
GuiPath = "/Time/Simulation Speed",
|
|
IsLocal = true,
|
|
|
|
Key = "SPACE"
|
|
}
|
|
|
|
local toggle_pause_immediate = {
|
|
Identifier = "os_default.toggle_pause_immediate",
|
|
Name = "Toggle pause (immediate)",
|
|
Command = "openspace.time.togglePause()",
|
|
Documentation = "Immediately starts and stops the simulation time",
|
|
GuiPath = "/Time/Simulation Speed",
|
|
IsLocal = true,
|
|
|
|
Key = "Shift+SPACE"
|
|
}
|
|
|
|
local toggle_rotation_friction = {
|
|
Identifier = "os_default.toggle_rotation_friction",
|
|
Name = "Toggle rotation 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",
|
|
IsLocal = false,
|
|
|
|
Key = "f"
|
|
}
|
|
|
|
local toggle_zoom_friction = {
|
|
Identifier = "os_default.toggle_zoom_friction",
|
|
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",
|
|
IsLocal = false,
|
|
|
|
Key = "Shift+f"
|
|
}
|
|
|
|
local toggle_roll_friction = {
|
|
Identifier = "os_default.toggle_roll_friction",
|
|
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",
|
|
IsLocal = false,
|
|
|
|
Key = "Ctrl+f"
|
|
}
|
|
|
|
local fade_to_black = {
|
|
Identifier = "os_default.fade_to_black",
|
|
Name = "Fade to/from black",
|
|
Command = [[
|
|
if openspace.getPropertyValue("RenderEngine.BlackoutFactor") > 0.5 then
|
|
openspace.setPropertyValueSingle("RenderEngine.BlackoutFactor", 0.0, 3)
|
|
else
|
|
openspace.setPropertyValueSingle("RenderEngine.BlackoutFactor", 1.0, 3)
|
|
end
|
|
]],
|
|
Documentation = "Toggles the fade to black within 3 seconds or shows the rendering after 3 seconds",
|
|
GuiPath = "/Rendering",
|
|
IsLocal = false,
|
|
|
|
Key = "w"
|
|
}
|
|
|
|
local toggle_main_gui = {
|
|
Identifier = "os_default.toggle_main_gui",
|
|
Name = "Toggle main GUI",
|
|
Command = propertyHelper.invert("Modules.CefWebGui.Visible"),
|
|
Documentation = "Toggles the main GUI",
|
|
GuiPath = "/System/GUI",
|
|
IsLocal = true,
|
|
|
|
Key = "Tab"
|
|
}
|
|
|
|
local toggle_overlays = {
|
|
Identifier = "os_default.toggle_overlays",
|
|
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 = "/System/GUI",
|
|
IsLocal = true,
|
|
|
|
Key = "Shift+Tab"
|
|
}
|
|
|
|
local toggle_master_rendering = {
|
|
Identifier = "os_default.toggle_master_rendering",
|
|
Name = "Toggle rendering on master",
|
|
Command = propertyHelper.invert("RenderEngine.DisableMasterRendering"),
|
|
Documentation = "Toggles the rendering on master",
|
|
GuiPath = "/System/Rendering",
|
|
IsLocal = true,
|
|
|
|
Key = "Alt+R"
|
|
}
|
|
|
|
local next_delta_step_interpolate = {
|
|
Identifier = "os_default.next_delta_step_interpolate",
|
|
Name = "Next simulation time step (interpolate)",
|
|
Command = "openspace.time.interpolateNextDeltaTimeStep()",
|
|
Documentation = "Smoothly interpolates the simulation speed to the next simulation time step, if one exists",
|
|
GuiPath = "/Time/Simulation Speed",
|
|
IsLocal = true,
|
|
|
|
Key = "Right"
|
|
}
|
|
|
|
local next_delta_step_immediate = {
|
|
Identifier = "os_default.next_delta_step_immediate",
|
|
Name = "Next simulation time step (immediate)",
|
|
Command = "openspace.time.setNextDeltaTimeStep()",
|
|
Documentation = "Immediately set the simulation speed to the next simulation time step, if one exists",
|
|
GuiPath = "/Time/Simulation Speed",
|
|
IsLocal = true,
|
|
|
|
Key = "Shift+Right"
|
|
}
|
|
|
|
local previous_delta_step_interpolate = {
|
|
Identifier = "os_default.previous_delta_step_interpolate",
|
|
Name = "Previous simulation time step (interpolate)",
|
|
Command = "openspace.time.interpolatePreviousDeltaTimeStep()",
|
|
Documentation = "Smoothly interpolates the simulation speed to the previous simulation time step, if one exists",
|
|
GuiPath = "/Time/Simulation Speed",
|
|
IsLocal = true,
|
|
|
|
Key = "Left"
|
|
}
|
|
|
|
local previous_delta_step_immediate = {
|
|
Identifier = "os_default.previous_delta_step_immediate",
|
|
Name = "Previous simulation time step (immediate)",
|
|
Command = "openspace.time.setPreviousDeltaTimeStep()",
|
|
Documentation = "Immediately set the simulation speed to the previous simulation time step, if one exists",
|
|
GuiPath = "/Time/Simulation Speed",
|
|
IsLocal = true,
|
|
|
|
Key = "Shift+Left"
|
|
}
|
|
|
|
local Actions = {
|
|
toggle_native_ui, toggle_shutdown, take_screenshot, toggle_pause_interpolated,
|
|
toggle_pause_immediate, toggle_rotation_friction, toggle_zoom_friction,
|
|
toggle_roll_friction, fade_to_black, toggle_main_gui, toggle_overlays,
|
|
toggle_master_rendering, next_delta_step_interpolate, next_delta_step_immediate,
|
|
previous_delta_step_interpolate, previous_delta_step_immediate
|
|
}
|
|
|
|
asset.onInitialize(function()
|
|
for _, action in ipairs(Actions) do
|
|
openspace.action.registerAction(action)
|
|
openspace.bindKey(action.Key, action.Identifier)
|
|
end
|
|
-- The take screenshot function is a bit special since we want to bind two keys to that action
|
|
openspace.bindKey("PRINT_SCREEN", take_screenshot.Identifier)
|
|
end)
|
|
|
|
asset.onDeinitialize(function ()
|
|
openspace.clearKey("PRINT_SCREEN")
|
|
|
|
for _, action in ipairs(Actions) do
|
|
openspace.action.removeAction(action)
|
|
openspace.clearKey(action.Key)
|
|
end
|
|
end)
|