Add Lua functions to query keyboard bindings and remove individual keybinds

Add core script file that defines possibility of rebinding keyboard commands to a different key
Enable the execution of global customization scripts
Make `scene_helper.lua` a script automatically included in the ScriptScheduler
This commit is contained in:
Alexander Bock
2017-12-08 14:58:18 -05:00
parent bce8e71d9b
commit c9aedb084b
24 changed files with 258 additions and 44 deletions

View File

@@ -0,0 +1,20 @@
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,4 +1,21 @@
mark_interesting_nodes = function(nodes)
openspace.documentation = {
{
Name = "mark_interating_nodes",
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 = "set_default_gui_sorting",
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"
}
}
openspace.mark_interesting_nodes = function(nodes)
for _, n in pairs(nodes) do
if openspace.hasSceneGraphNode(n) then
openspace.addTag(n, "GUI.Interesting")
@@ -6,7 +23,7 @@ mark_interesting_nodes = function(nodes)
end
end
set_default_gui_sorting = function()
openspace.set_default_gui_sorting = function()
openspace.setPropertyValueSingle(
'Global Properties.ImGUI.Main.Properties.Ordering',
{