-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Improved way of getting MethodTrack keys #61885
Conversation
In this method, it seems that the animation status check is placed in each track. Are there inspection conditions (stop/end) that could be applied to each track? Could we avoid entering the loop that iterates over each track? |
Since this is not the place to decide whether or not to stop the animation, the stopping condition is not relevant here, nor is it necessary to change that. What is needed now is to correct the incorrect seek method and remove unnecessary checks. The animation itself is stopped by clamping at the end. At this time, it depends on So, what was actually needed was neither However, there is another problem when seeking, so it fixed partially that by matching the behavior with AudioTrack and AnimationTrack. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
b42fc14
to
e203d93
Compare
e203d93
to
dedc471
Compare
Seems a bit hacky but I guess its ok |
Thanks! |
Fixed #61766. Fixed partially #61853.
Supersede #61836.
MethodTrack kept the old checking algorithm. In the past,
delta == 0
was used as a flag for having done a seek, but this is not necessary sinceseeked
can be used. So remove it and this will be fixed #61766.Instead, MethodTrack should get a key to not consider delta when seeking, as the same way with AudioTrack.
For example in ValueTrack:
However, this fix prevents the behavior of "firing the end key at restart" in #61853, but it does not prevent the behavior of "firing the first key twice".
To be exact, it is fired in two frames, "the seek frame" and "the playbacked next frame"; if nothing is done in the seek frame, there could be a delay if there is user input. In the past, that delay was a problem with ValueTrack's Discrete mode, so I fixed it in #52518.
This double firing is not as much of a problem for AudioTrack and AnimationTrack, since they are checked for double insertion into the queue by
HashSet::insert()
. For ValueTrack, even if a value is set twice, it is not a problem unless there is a signal to subscribe to it. However with MethodTrack, it is enough of a problem.Since MethodTrack calls are only fire in one frame, and it is impossible to determine how many frames will be processed by a call, so it is not possible to create a queue. At least at both ends of pingpong, it is possible to check for duplicates in one frame so it can be avoided, but it does not solve the problem in Seek.
At the moment, a compromise is to add a check such as
if (is_processing)
to the GDScript side of the MethodTrack call to prevent multiple processing.