Jump to content

Recommended Posts

Posted

If you place this script in "C:\Program Files (x86)\Steam\Steamapps\common\Leadwerks\Scripts\Start\CustomShortcuts.lua", this will provide you with one possible way of overriding shortcut keys that are generated dynancally. You can switch between the translate, rotate, and scale tools using T, R, and G.

You can get to the folder faster by selecting the Scripting > Open Scripts Folder menu item.

You could change this to match Blender's keys, if you want, but I did not because we use WASD for camera movement.

Version 5.0.1 beta is required (it will go up today) for the textfield check to work. This will ignore key input when a textfield is selected.

function Callback(event)
    if event.id == EVENT_KEYDOWN then
        if isfunction(program.ui.GetFocus) then
            --[[Requires 5.0.1 for this check to work]]
            local widget = program.ui:GetFocus()
            if widget ~= nil then
                if TextField(widget) then return end
            end
        end
        if event.data == KEY_T then
            local menu = program.menu:FindChild("Translate", true)
            if menu ~= nil then
                EmitEvent(EVENT_WIDGETACTION, menu)
            end
        elseif event.data == KEY_R then
            local menu = program.menu:FindChild("Rotate", true)
            if menu ~= nil then
                EmitEvent(EVENT_WIDGETACTION, menu)
            end
        elseif event.data == KEY_G then
            local menu = program.menu:FindChild("Scale", true)
            if menu ~= nil then
                EmitEvent(EVENT_WIDGETACTION, menu)
            end
        end
    end
end

ListenEvent(EVENT_KEYDOWN, program.window, Callback)

 

Let's build cool stuff and have fun. :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...