-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Enable InputEvent
-filtering in SubViewportContainer
#78762
Conversation
239de71
to
633107b
Compare
633107b
to
40a02c0
Compare
I have a small nitpick with this PR, namely, that the wording |
InputEvent
-blocking in SubViewportContainer
InputEvent
-filtering in SubViewportContainer
4ffcd1b
to
3c5a6d9
Compare
I wonder if |
I'm not entirely convinced, that these need to be aligned, because |
625d80b
to
a0e23d3
Compare
While this PR does close the mentioned proposal, there are multiple problems that the proposal's author did not cover.
This means that:
That seems quite limited to me. |
Thank you for your thorough review.
The original idea for this PR comes from #78759 (comment)
The event is propagated as usual to SubViewports, so it is possible to use any input-handling function on nodes within SubViewports and not just
The user has the option to include any code into the overwritten
This use-case is covered by the PR. The following overwritten function would handle that case: func _propagate_input_event(event: InputEvent):
if not event is InputEventKey:
return true
var e: InputEventKey = event
if self == $"/root/FocusTest/SubViewportContainerWASD":
return e.keycode < 255 # letters
else:
return e.keycode >= 255 # arrows It sends events, that are based on letters to one SubViewport, and events that are based on arrow keys to the other SubViewport.
Thank you for pointing me to
I agree with this statement. This implementation is based on the concept of using SubViewports for handling events for different Players. It ties nicely with #79480 which allows each player to have a focused Control in their SubViewport.
I hope, that I have addressed most of your concerns. |
a0e23d3
to
c31c085
Compare
Right, what I meant is that you can't use
The whole idea behind the proposal was to use a single action set for every player. If you have multiple action sets, But that's more problem with the proposal itself than the implementation. Not every game will have control rebinding, but as soon as you want to add one, you will run into godotengine/godot-proposals#3555 and the solution proposed here, while it's for a similar problem, it doesn't solve all issues. (also in that proposal I commented with a convenient way to solve pretty much every problem raised here).
It doesn't handle other control schemes like IKJL. Though nowadays they aren't used I think, as most people will just play with controllers.
As a person who always writes input code inside |
Introduce an user overridable function, that allows filtering, if an `InputEvent` should be sent to `SubViewport` children.
c31c085
to
781cecd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the feature itself, but the implementation looks fine.
@KoBeWi If it adds any weight, my game needs this feature as well (which was possible in a different way in 3.*). It's a mini-game collection, and this would be used to dictated when said mini-games would start/stop listening to inputs. |
Thanks! Edit: lol, bad copy paste ;) |
Wait, that seems pretty bad, especially for those of us that are more disability focused as rebinding controllers is one of the most basic of forms of accessibility. It'd suck for a disabled user to be penalized in a split screen game or the non-disabled user having to deal with the whatever esoteric setup the disabled user. |
Using
I don't see any restrictions for rebinding controls per controller while using the functionality of this PR. But as stated above, |
Introduce an user overridable function
_propagate_input_event
, that allows filtering, if anInputEvent
should be sent toSubViewport
children.implements #78759 (comment)
alternative to #78759
implements a more generic approach than the one in godotengine/godot-proposals#1249
related to #62421
MRP to showcase the new functionality: SvcInputEventFilter78762.zip
Updated 2023-08-03: rename
_send_input_event
to_propagate_input_event
in order to adhere to the usual nomenclature. improve docstring. Rebase for CI-changes.