Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Button shortcut not triggered from gamepad #62899

Closed
SpyrexDE opened this issue Jul 10, 2022 · 3 comments · Fixed by #66750
Closed

Button shortcut not triggered from gamepad #62899

SpyrexDE opened this issue Jul 10, 2022 · 3 comments · Fixed by #66750

Comments

@SpyrexDE
Copy link

Godot version

4.0.alpha.custom_build [6198bd5b8]

System information

Windows 10

Issue description

Same as issue #25741
HUD Button Shortcut does not trigger InputEventAction when the input source is a gamepad.

Steps to reproduce

  • Download and run minimal reproduction project
  • Press escape or the joypad button with the index 0

Further explanation:

  • The counter button's shortcut is bound to an action called "add_to_counter"
  • To this action, two inputs have been added: escape-key the joypad button with the index 0
  • Both should work to increase the counter, however only pressing escape is working

Minimal reproduction project

GamepadBug.zip

@EricEzaM
Copy link
Contributor

EricEzaM commented Sep 24, 2022

Thanks for the report. Your minimum project is way too complex tbh. All you need is a button with the shortcut set, and the counter. 1 scene, 1 script. It also did not work for me when I opened it - the nodes A,B.X,Y were missing, but they were referenced in the main script. Anyway, I was able to reproduce it after deleting some of those references.

@bruvzg
This is happening because the button shortcut handling is happening in shortcut_input but only InputEventKey is allowed:

godot/scene/main/viewport.cpp

Lines 2801 to 2804 in f74491f

// Shortcut Input.
if (Object::cast_to<InputEventKey>(*ev) != nullptr || Object::cast_to<InputEventShortcut>(*ev) != nullptr) {
get_tree()->_call_input_pause(shortcut_input_group, SceneTree::CALL_INPUT_TYPE_SHORTCUT_INPUT, ev, this);
}

Just adding InputEventJoypadButton here is the easy fix. Thoughts?

@EricEzaM EricEzaM moved this to To Assess in 4.x Priority Issues Sep 27, 2022
@akien-mga akien-mga added this to the 4.0 milestone Oct 2, 2022
Repository owner moved this from To Assess to Done in 4.x Priority Issues Oct 3, 2022
@SpyrexDE
Copy link
Author

SpyrexDE commented Oct 3, 2022

@EricEzaM Thanks for fixing the issue! To be honest I didn't make the example project by my self. I just ported the example project from the Godot 3 version of this issue (#25741) to Godot 4.

@EricEzaM
Copy link
Contributor

EricEzaM commented Oct 3, 2022

Ah no worries 🙂 thanks for reporting the issue!

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

Successfully merging a pull request may close this issue.

4 participants