Add keyboard shortcuts to Actions

What would you like to see in future versions of the editor?
Post Reply
yulan6248
Posts: 12
Joined: Wed Jul 10, 2013 9:10 am

Add keyboard shortcuts to Actions

Post by yulan6248 » Wed Jul 10, 2013 9:17 am

Just as I put in the subject, I'd like to have full control via keyboard.

I think it should pretty easy feature to implement.

iforce2d
Site Admin
Posts: 860
Joined: Sat Dec 22, 2012 7:20 pm

Re: Add keyboard shortcuts to Actions

Post by iforce2d » Wed Jul 10, 2013 10:47 am

If you are talking about menu navigation shortcuts, this is already possible. In the layout.json file, you can put an ampersand in front of the letter you want to be the shortcut key for each menu entry. As an example:
menuShortcuts.png
menuShortcuts.png (37.78 KiB) Viewed 12162 times
With this setup, you can do A, B, B to add a body, A, B, S to add a body with square fixture etc. See the help topic under "Action menu" -> "Customizing the action menu" for details on setting up this menu.

Am I understanding you correctly?

The next update will allow you to bind key presses to scripts, if that is what you mean. Specifically, you will be able to select scripts to run when a number key is pressed. Here is a screenshot:
scriptHooksDialog.png
scriptHooksDialog.png (72.92 KiB) Viewed 12162 times

yulan6248
Posts: 12
Joined: Wed Jul 10, 2013 9:10 am

Re: Add keyboard shortcuts to Actions

Post by yulan6248 » Sat Jul 13, 2013 12:22 pm

Hi, thanks for your reply. I was more thinking of the later approach you mentioned (binding a key to a script), but the current approach seems decent to me as well; however, after trying it out on my system (Arch Linux) the default keybindings don't seem to work -- after I press Spacebar, 'a' and then 'b' to get the body actions, the menu will stuck at the second level and pressing the shortcut key for the third level won't work unless I press right arrow to activate it. What I did in the end is to condense the menus into two levels only, and that worked out perfectly for me.

Post Reply