blackears / cyclopsLevelBuilder

A Godot plugin to let you block in levels inside the Godot editor.
MIT License
1.05k stars 42 forks source link

Add tool shortcuts #25

Open NathanLovato opened 1 year ago

NathanLovato commented 1 year ago

Currently, you have to go click the tools to select them. It'd be nice to have keyboard shortcuts.


The simplest way to go about that is using the _input() function, which is the first function to receive inputs. It lets you consume input events by calling Viewport.set_input_as_handled().

You can use Shortcut resources or plain input event checks, either works.

Then, you mentioned the issue of keys clashing with the editor keys.

As far as I know, the plugin API doesn't let you register customizable shortcuts to the shortcut editor.

Until it does, you have workarounds like this one from a teammate to register to the project settings instead, which allows users to customize shortcuts in case there's a conflict with one of their shortcuts: https://github.com/godotengine/godot-proposals/issues/2024#issuecomment-1378782833

The code example uses serialized Shortcut resources but it works the same if you do it 100% in code.

diklor commented 4 months ago

I recently made an extension for this. You can test it here https://github.com/diklor/cyclopsLevelBuilder-Keys

keys