mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-01 17:20:09 -06:00
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:
20
scripts/common_scripts.lua
Normal file
20
scripts/common_scripts.lua
Normal 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
|
||||
Reference in New Issue
Block a user