-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
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 does not trigger if set to InputEventAction and the action is a Joypad Axis or anything Mouse related. #90516
Comments
Yup as mentioned in another issue I made it seems #62899 partially solved this but the other event types should also be included. Alternatively it should be made impossible to set them at all but that would be super opinionated for no real reason, especially when the fix is super simple. Should definitely add the "Good First Issue" label as the fix is basically as simple as #66750 |
As you said, there's no reason to make it opinionated on what should or shouldn't be allowed in a shortcut. If I don't want a particular input event type to be a shortcut, I can simply not set it. :) Would a potential fix be to remove the if-statement and always call get_tree()->_call_input_pause(shortcut_input_group, SceneTree::CALL_INPUT_TYPE_SHORTCUT_INPUT, p_event, this); |
Since p_event is InputEvent and that's also what Shortcut has... yeah actually. This is so simple I just don't have a dev setup and I wouldn't want to just PR something from the browser. |
I set up the dev environment to give it a look. Removing the code that checks for various As stated above, the example project has a joypad axis and the RMB as bindings to an The scene is set up like this:
Both the Control and ColorRect had the However, this doesn't make sense to me since the button (which had the shortcut) is a child of the Control and sibling of the ColorRect, so the mouse filter shouldn't have applied to it as the button is in front of all of them. Perhaps my understanding of how |
I think in that case it's more about your usage of the shortcut at all - the "shortcut" on buttons is like a independent way of globally (From the Viewport) catching input and correctly responding. The UI mouse events and filters are another thing. Setting a shortcut to RMB doesn't say "You need to press RMB on the button", it says "When RMB is sent, the button should react". If you look at the source, this happens on "unhandled_input" in the viewport ; Sounds to me like your issue was that the button itself was indeed capturing the RMB, which means that event was handled, didn't bubble up to the viewport, and thus the shortcut wasn't executed. If you want to change which mouse button activates the button control's own events, like |
Requires a workaround since button shortcuts currently don't triger on mouse events (see godotengine/godot#90516), but I wanted to keep the visual feedback when triggering the button.
Tested versions
Godot Engine v4.2.1.stable.official.b09f793f5
System information
Godot v4.2.1.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 (NVIDIA; 31.0.15.5123) - Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz (16 Threads)
Issue description
When a button shortcut is set to
InputEventAction
and that action is bound to a joypad axis, it does not trigger. However, if bound to a key or button, it does.I believe it happens because the code below filters out
InputEventJoypadMotion
among others.Steps to reproduce
The MRP has one button that, when pressed, turns the background blue.
The action is bound to four inputs:
To reproduce the bug:
Minimal reproduction project (MRP)
ShortcutBug.zip
The text was updated successfully, but these errors were encountered: