Cleanup core script extensions

Cleanup default scripts
This commit is contained in:
Alexander Bock
2017-12-31 23:26:38 -05:00
parent 51551bc291
commit edc250deb8
13 changed files with 57 additions and 81 deletions

View File

@@ -1,20 +0,0 @@
--[[ OpenSpace keybinding script ]]--
-- Load the common helper functions
dofile(openspace.absPath('${SCRIPTS}/common.lua'))
openspace.clearKeys()
helper.setCommonKeys()
helper.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.

View File

@@ -1,20 +0,0 @@
openspace.documentation = {
{
Name = "rebindKey",
Arguments = "string, string",
Documentation = "Rebinds all scripts from the old key (first argument) to the " ..
"new key (second argument)."
}
}
openspace.rebindKey = function(old_key, new_key)
local t = openspace.getKeyBinding(old_key)
openspace.clearKey(old_key)
for _, v in pairs(t) do
if v["Remote"] then
openspace.bindKey(new_key, v["Command"])
else
openspace.bindKeyLocal(new_key, v["Command"])
end
end
end

View File

@@ -1,36 +1,42 @@
openspace.documentation = {
{
Name = "mark_interating_nodes",
Name = "markInteratingNodes",
Arguments = "List of nodes",
Documentation = "This function marks the scene graph nodes identified by name " ..
"as interesting, which will provide shortcut access to focus buttons and " ..
"featured properties."
},
{
Name = "remove_interesting_nodes",
Name = "removeInterestingNodes",
Arguments = "List of nodes",
Documentation = "This function removes unmarks the scene graph nodes " ..
"identified by name as interesting, thus removing the shortcuts from the " ..
"features properties list."
},
{
Name = "set_default_gui_sorting",
Name = "setDefaultGuiSorting",
Arguments = "",
Documentation = "This function sets the default GUI sorting for the space " ..
"environment to increasing size, from solar system, through Milky Way, " ..
"Universe and finishing with other elements"
},
{
Name = "set_default_dashboard",
Name = "setDefaultDashboard",
Arguments = "",
Documentation = "This function sets the default values for the dashboard " ..
"consisting of 'DashboardItemDate', 'DashboardItemSimulationIncrement', " ..
"'DashboardItemDistance', 'DashboardItemFramerate', and " ..
"'DashboardItemParallelConnection'."
},
{
Name = "rebindKey",
Arguments = "string, string",
Documentation = "Rebinds all scripts from the old key (first argument) to the " ..
"new key (second argument)."
}
}
openspace.mark_interesting_nodes = function(nodes)
openspace.markInterestingNodes = function(nodes)
for _, n in pairs(nodes) do
if openspace.hasSceneGraphNode(n) then
openspace.addTag(n, "GUI.Interesting")
@@ -38,7 +44,7 @@ openspace.mark_interesting_nodes = function(nodes)
end
end
openspace.remove_interesting_nodes = function(nodes)
openspace.removeInterestingNodes = function(nodes)
for _, n in pairs(nodes) do
if openspace.hasSceneGraphNode(n) then
openspace.removeTag(n, "GUI.Interesting")
@@ -46,7 +52,7 @@ openspace.remove_interesting_nodes = function(nodes)
end
end
openspace.set_default_dashboard = function()
openspace.setDefaultDashboard = function()
openspace.dashboard.addDashboardItem({
Type = "DashboardItemDate"
})
@@ -68,7 +74,7 @@ openspace.set_default_dashboard = function()
})
end
openspace.set_default_gui_sorting = function()
openspace.setDefaultGuiSorting = function()
openspace.setPropertyValueSingle(
'Global Properties.ImGUI.Main.Properties.Ordering',
{
@@ -76,3 +82,15 @@ openspace.set_default_gui_sorting = function()
}
)
end
openspace.rebindKey = function(oldKey, newKey)
local t = openspace.getKeyBinding(oldKey)
openspace.clearKey(oldKey)
for _, v in pairs(t) do
if v["Remote"] then
openspace.bindKey(newKey, v["Command"])
else
openspace.bindKeyLocal(newKey, v["Command"])
end
end
end