mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-24 04:58:59 -05:00
34985f64a6
* Add action manager to handle actions in replacement of keyboard shortcuts * Implement new Action concept * Remove the shortcutscomponent as it is no longer needed * Update profile version from 1.0 to 1.1 * Add action dialog * Restructure of key specification in keys.h * Remove solid field-of-view keybind from the newhorizons profile as the setting no longer exists
203 lines
6.7 KiB
Lua
203 lines
6.7 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.Main.Enabled'),
|
|
Documentation = "Shows or hides the native UI",
|
|
GuiPath = "/Native 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.",
|
|
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 = "/Rendering",
|
|
IsLocal = true,
|
|
|
|
Key = "F12"
|
|
}
|
|
|
|
local toggle_pause_interpolated = {
|
|
Identifier = "os_default.toggle_pause_interpolated",
|
|
Name = "Toggle Pause (Interpolated)",
|
|
Command = "openspace.time.pauseToggleViaKeyboard()",
|
|
Documentation = "Smoothly starts and stops the simulation time.",
|
|
GuiPath = "/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 = "/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 = "/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 = "/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 = "/Rendering",
|
|
IsLocal = true,
|
|
|
|
Key = "Alt+R"
|
|
}
|
|
|
|
local next_delta_step_interpolate = {
|
|
Identifier = "os_default.next_delta_step_interpolate",
|
|
Name = "Next Delta Time Step (Interpolate)",
|
|
Command = "openspace.time.interpolateNextDeltaTimeStep()",
|
|
Documentation = "Smoothly interpolates the simulation speed to the next delta time step, if one exists.",
|
|
GuiPath = "/Simulation Speed",
|
|
IsLocal = true,
|
|
|
|
Key = "Right"
|
|
}
|
|
|
|
local next_delta_step_immediate = {
|
|
Identifier = "os_default.next_delta_step_immediate",
|
|
Name = "Next Delta Time Step (Immediate)",
|
|
Command = "openspace.time.setNextDeltaTimeStep()",
|
|
Documentation = "Immediately set the simulation speed to the next delta time step, if one exists.",
|
|
GuiPath = "/Simulation Speed",
|
|
IsLocal = true,
|
|
|
|
Key = "Shift+Right"
|
|
}
|
|
|
|
local previous_delta_step_interpolate = {
|
|
Identifier = "os_default.previous_delta_step_interpolate",
|
|
Name = "Previous Delta Time Step (Interpolate)",
|
|
Command = "openspace.time.interpolatePreviousDeltaTimeStep()",
|
|
Documentation = "Smoothly interpolates the simulation speed to the previous delta time step, if one exists.",
|
|
GuiPath = "/Simulation Speed",
|
|
IsLocal = true,
|
|
|
|
Key = "Left"
|
|
}
|
|
|
|
local previous_delta_step_immediate = {
|
|
Identifier = "os_default.previous_delta_step_immediate",
|
|
Name = "Previous Delta Time Step (Immediate)",
|
|
Command = "openspace.time.setPreviousDeltaTimeStep()",
|
|
Documentation = "Immediately set the simulation speed to the previous delta time step, if one exists.",
|
|
GuiPath = "/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
|
|
end)
|
|
|
|
asset.onDeinitialize(function ()
|
|
for _, action in ipairs(Actions) do
|
|
openspace.action.removeAction(action.Identifier)
|
|
openspace.clearKey(action.Key)
|
|
end
|
|
end)
|