-
-
Notifications
You must be signed in to change notification settings - Fork 21.6k
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
Accumulated input instance sharing regression in Input.parse_input_event() #54066
Comments
I can reproduce the issue with the MRP. The behavior changed between 3.4 beta 3 and 3.4 beta 4, which likely points at #42220. CC @RandomShaper I don't know yet if it's an actual bug or a bugfix, I'll let @RandomShaper assess. To me both behaviors seem non-intuitive when reading the description of |
I think accumulation is done in the OS implementation, and since we are firing events ourselves it's likely those don't get accumulated, but don't quote me on that. |
I guess the description could be a bit more precise. Only "flowing" events like mouse or touch drags can be accumulated. Presses/unpresses of keys, mouse buttons, etc. are kept because they are relevant actions that can't be squashed together without losing important information.
It isn't. It's
In 3.4-beta3, Under the hood, the situation was that in 3.4-beta3 we had Therefore, it's a bit hard to tell if older versions had a bug from the scripting perspective ( Furthermore, if we considered the bug is in the newer implementation, things could get a bit akward:
Final note: it makes sense that a re-used input event with accumulation enabled exhibits that behavior. Accumulation works by queueing references to the events for a later flush at the end of the frame. You are effectively buffering the same object twice. "Fixing" that would involve making copies of every accumulated event, which could harm performance. The guideline would be: once you've sent an input event to the engine, forget about it. (Also, accumulation will modify the last queued event if the next one can be fused to it, so you can't count on having control over it.) |
I don't think such behaviour is necessarily wrong or correct, I'm just saying it's behaving differently. |
So given the above discussion, I think this just requires some better documentation? |
In short, I'd say so. The unfortunate thing here is that an implementation detail can be noticed from the surface and at least a piece of documentation warning about the fact that input events are reference counted and the engine doesn't get an unique view of them once passed the API boundary, or something like that. That said, it would be possible to put some code that detects this kind of usage and duplicates the events under the hood, but I'm already foreseeing some unintended side effects of that can happen as well. So, let's go the docs route. By the way, @EIREXE, ¡Hola! |
This issue has been fixed in Running the MRP now yields the following message:
Closing. |
Godot version
3.x (b7ded89)
System information
Arch Linux
Issue description
Previously, passing a reused instance to parse_input_event even with accumulated input enabled would not cause the event to be shared between emitted events.
Steps to reproduce
Create two input events with input accumulation enabled:
Parse them in another node:
event.action will return test2 in all cases, in an older version it would return test1 and test2 in alternating fashion
Minimal reproduction project
InputBug.zip
The text was updated successfully, but these errors were encountered: