Skip to content

Add keybind functionality - #120

Open
Elliesaur wants to merge 14 commits into
ExpiredPopsicle:mainfrom
Elliesaur:feature-add-keybinds
Open

Add keybind functionality#120
Elliesaur wants to merge 14 commits into
ExpiredPopsicle:mainfrom
Elliesaur:feature-add-keybinds

Conversation

@Elliesaur

Copy link
Copy Markdown
Contributor

This PR adds support for users to create custom keybinds for actions that are used by other mods.

This is a rather complex enhancement and I do admit that there might be a bit of contention on how best to work with keybinds in such programs.
I look forward to constructive feedback on what should be worked in and what should be left to other mod developers.

  • Completely custom setting screen for Keybinds, allowing a user to add/remove their own keybinds and associate them with actions which are tied in with the InputMap singleton in Godot.
  • Default example action is implemented as "ping", the implementation is found in the Keybinds.gd file.
  • A custom prefix for keybind actions to set them apart from other InputMap actions, I find it difficult to properly reload without this as I do not want to accidentally in the future remove all InputMap actions! The prefix is advertised to other mods using global mod messages and a global mod data dictionary.
  • Keybinds for Model Toggles #112 has been implemented in this as an example.

P.S. I also came across an interesting issue that was known given the popular use of the "Resources" folder in other mods. I wonder if we should address this in another issue and instead of picking the first .tscn file as the "mod", look at which extends Mod_Base. Not sure how this works in Godot but might be something else I can explore.

@ExpiredPopsicle

Copy link
Copy Markdown
Owner

Hey I finally got to looking at this.

Could it be adjusted so that the keybinds mod handles the input and then sends out events via the global mod messaging system, instead of the individual mods having to handle the input events? Trying to minimize the API footprint for the mods still.

Appreciate the contribution. Sorry it's taken so long to get to looking at it.

@copygirl

copygirl commented May 21, 2025

Copy link
Copy Markdown
Contributor

What would be the benefit of using the global mod messaging system over Godot's existing (more versatile) input functions?

@Elliesaur

Copy link
Copy Markdown
Contributor Author

Hey I finally got to looking at this.

Could it be adjusted so that the keybinds mod handles the input and then sends out events via the global mod messaging system, instead of the individual mods having to handle the input events? Trying to minimize the API footprint for the mods still.

Appreciate the contribution. Sorry it's taken so long to get to looking at it.

With regards to this, are you referring to not using InputMap and instead an internal representation inside the mod itself?

@Elliesaur

Copy link
Copy Markdown
Contributor Author

As per recent discussion (stream) this feature will be reworked and internally handle the input events, sending via the global mod messaging system. Stay tuned...

@Elliesaur

Copy link
Copy Markdown
Contributor Author

Happy to take comments on this PR and improve it to suit the needs of the project going forward.

@ExpiredPopsicle

Copy link
Copy Markdown
Owner

I'll take another look at it this week. Sorry for the delay.

@leidenwolcloud

Copy link
Copy Markdown

Have you had issues with keybinds not registering after you close and reopen SnekStudio? I'm looking into using keybinds to activate VRM expression toggles (as a separate mod) and this has been bugging me.

I made a mod called Expressions which listens for the keybind mod messages. Then I made a keybind called "surprised" bound to Alt+F5. If I use the keybind right after making it, the global mod message is sent and properly received by other mods. But if I close and restart the program, even though the keybinds are loaded from the settings, the mod messages aren't sent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants