mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-23 20:50:59 -05:00
8b74493d96
- Remove the asset_helper file and call the onInitialize and onDeinitialize functions directly - Small compile fix on Windows - Removes the need for the registerIdentifierWithMeta function by automatically doing that for all asset.export statements - Allow the passing of either identifiers (as before) or entire tables to the removeSceneGraphNode, removeScreenSpaceRenderable, deleteLayer, removeAction, and export methods. In that case, the Identifier key from the table is extracted and used instead
67 lines
2.2 KiB
Lua
67 lines
2.2 KiB
Lua
-- This is a blank scene that that just sets up the default menus/dasboard/keys, etc.
|
|
|
|
local propertyHelper = asset.require("util/property_helper")
|
|
|
|
-- Specifying which other assets should be loaded in this scene
|
|
asset.require("spice/base")
|
|
|
|
-- Load default key bindings applicable to most scenes
|
|
asset.require("dashboard/default_dashboard")
|
|
asset.require("util/default_keybindings")
|
|
|
|
-- Load web gui
|
|
local webGui = asset.require("util/webgui")
|
|
|
|
local toggle_trails = {
|
|
Identifier = "os_default.toggle_trails",
|
|
Name = "Toggle Trails",
|
|
Command = [[
|
|
local list = openspace.getProperty("{planetTrail_solarSystem}.Renderable.Enabled");
|
|
for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end
|
|
|
|
local moonlist = openspace.getProperty("{moonTrail_solarSystem}.Renderable.Enabled");
|
|
for _,v in pairs(moonlist) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end
|
|
]],
|
|
Documentation = "Toggles the visibility of planet and moon trails",
|
|
GuiPath = "/Rendering",
|
|
IsLocal = false,
|
|
|
|
Key = "h"
|
|
}
|
|
|
|
local toggle_planet_labels = {
|
|
Identifier = "os_default.toggle_planet_labels",
|
|
Name = "Toggle planet labels",
|
|
Command = [[
|
|
local list = openspace.getProperty("{solarsystem_labels}.Renderable.Enabled");
|
|
for _,v in pairs(list) do openspace.setPropertyValueSingle(v, not openspace.getPropertyValue(v)) end
|
|
]],
|
|
Documentation = "Turns on visibility for all solar system labels",
|
|
GuiPath = "/Rendering",
|
|
IsLocal = false,
|
|
|
|
Key = "l"
|
|
}
|
|
|
|
asset.onInitialize(function ()
|
|
webGui.setCefRoute("onscreen")
|
|
|
|
openspace.action.registerAction(toggle_trails)
|
|
openspace.bindKey(toggle_trails.Key, toggle_trails.Identifier)
|
|
|
|
openspace.action.registerAction(toggle_planet_labels)
|
|
openspace.bindKey(toggle_planet_labels.Key, toggle_planet_labels.Identifier)
|
|
|
|
openspace.setDefaultGuiSorting()
|
|
|
|
openspace.setPropertyValueSingle("RenderEngine.VerticalLogOffset", 0.100000)
|
|
end)
|
|
|
|
asset.onDeinitialize(function ()
|
|
openspace.action.removeAction(toggle_trails)
|
|
openspace.clearKey(toggle_trails.Key)
|
|
|
|
openspace.action.removeAction(toggle_planet_labels)
|
|
openspace.clearKey(toggle_planet_labels.Key)
|
|
end)
|