-
-
Notifications
You must be signed in to change notification settings - Fork 21k
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
Add signals for InputEventAction to the Input singleton #75971
base: master
Are you sure you want to change the base?
Conversation
Your code has invalid formatting, it needs to be indented with tabs and match indentation, it's good to always use You also need to run This feature should probably also be documented in |
|
That approach would also negate any issue with consent of the copied code etc. |
addb8b4
to
0c3ba91
Compare
0c3ba91
to
4564c5d
Compare
Adding signals that aren't actually in the class won't work with documentation and will cause a ci error |
I'm assuming you mean that they should be removed, so I will do that. |
It should be documented in the description of |
4564c5d
to
2fd384d
Compare
You're going to think I'm quite dense for not figuring that out, lol, but it's very practically a core component of why I enjoy programming. I often think in very literal terms, and could not see past 'signals go in the signal section'. |
I fully understand, I tend to be very literal at times, and I'm sorry for not communicating that clearly, it's easy to become used to what you yourself know and it can be hard to realize the things that are not obvious if someone isn't experienced with a thing |
2fd384d
to
b93cd13
Compare
039af26
to
58b9749
Compare
I should probably get some kind of moniker that says 'frequent force pusher', because yes, all of my PR's are like this, it's a curse. |
void Input::_notification(int p_what) { | ||
switch (p_what) { | ||
case NOTIFICATION_POSTINITIALIZE: { | ||
for (const KeyValue<StringName, InputMap::Action> &E : InputMap::get_singleton()->get_action_map()) { |
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.
You need to check that the InputMap is created, it isn't always, it isn't when running tests for example, so you need to check that InputMap::get_singleton()
returns non-null
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.
Thank-you for providing that fix information. I for sure would not have figured that out on my own
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.
No problem! I had to dig a little before I realised why this could happen myself
58b9749
to
44e671c
Compare
each InputEventAction of the InputMap will add an *_pressed and *_released signal that can be connected to. additionally an action_toggled signal was added that will fire for all actions that are triggered by an InputEvent
44e671c
to
5ce0f8b
Compare
each InputEventAction of the InputMap will add an
*_pressed
and*_released
signal that can be connected to.additionally an
action_toggled
signal was added that will fire for all actions that are triggered by an InputEventImplements such usability:
This PR is made to solve this proposal:
Closes godotengine/godot-proposals#1853
This PR essentially updates the work from this closed PR to bring it into alignment with master:
#43646
That is to say that superficial changes have been made to get it working but the underlying implementation remains the same, and it is in my opinion that the solution constitutes essentially atomic work that could not be significantly changed without causing needless obfuscation.
I am of course, just one person with a biased sense of coding principles and a limited knowledge of all the methods available in the Godot source project, therefore I open this PR in the hopes that it will be merged for the greater benefit of the community, but also to further the discussion about what may need to be changed in order to satisfy the stigma that surrounds the original work.
Some conversation was already had on the dev chat:
https://chat.godotengine.org/channel/devel?msg=n2RaX48Nre7x3CpZC
The general consensus was that the original PR constituted a public distribution in good faith at the time it was authored under the MIT license, and it is thus fair to use. However the question regarding the ship of Theseus does remain unanswered.