Skip to content

Add check in AnimationNodeOneShot during fade-out to ensure signal fires#103078

Closed
BlackShift wants to merge 1 commit into
godotengine:masterfrom
BlackShift:animation_oneshot_timing
Closed

Add check in AnimationNodeOneShot during fade-out to ensure signal fires#103078
BlackShift wants to merge 1 commit into
godotengine:masterfrom
BlackShift:animation_oneshot_timing

Conversation

@BlackShift
Copy link
Copy Markdown
Contributor

Fixes #103070

I didn't use a floating point comparison here because it should match exactly. Also let me know if there would be any unintended side effects. Animation stuff is not my strong suit.

@BlackShift BlackShift requested a review from a team as a code owner February 20, 2025 15:43
@BlackShift BlackShift changed the title Add check in AnimationNodeOneShot during fade-out to ensure signal fires Add check in AnimationNodeOneShot during fade-out to ensure signal fires Feb 20, 2025
@AThousandShips AThousandShips added bug topic:animation cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release labels Feb 20, 2025
@AThousandShips AThousandShips added this to the 4.5 milestone Feb 20, 2025
@TokageItLab TokageItLab self-requested a review February 20, 2025 23:03
@TokageItLab TokageItLab moved this to Ready for review in Animation Team Issue Triage May 16, 2025

if (!p_seek) {
if (Animation::is_less_or_equal_approx(os_nti.get_remain(break_loop_at_end), 0) || (is_fading_out && Animation::is_less_or_equal_approx(cur_fade_out_remaining, 0))) {
if (Animation::is_less_or_equal_approx(os_nti.get_remain(break_loop_at_end), 0) || (is_fading_out && Animation::is_less_or_equal_approx(cur_fade_out_remaining, 0) && os_nti.length == os_nti.position)) {
Copy link
Copy Markdown
Member

@TokageItLab TokageItLab May 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (Animation::is_less_or_equal_approx(os_nti.get_remain(break_loop_at_end), 0) || (is_fading_out && Animation::is_less_or_equal_approx(cur_fade_out_remaining, 0) && os_nti.length == os_nti.position)) {
if (Animation::is_less_or_equal_approx(os_nti.get_remain(break_loop_at_end), 0)) {

Note that os_nti.length == os_nti.position is (mostly) same with os_nti.get_remain(break_loop_at_end) == 0. This means that there is no need for a special check during fading.

I don't remember what this check is for, but considering the issue, this fix seems to make sense. I suspect there probably won't be any major side effects, so I think we should merge the changes as soon as they are made and see if any new issue arise.

Copy link
Copy Markdown
Member

@TokageItLab TokageItLab May 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait, there is a side effect that Shot's State remains when FadeOut is requested. So I feel that perhaps the timing should be shifted or something.

image

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (Animation::is_less_or_equal_approx(os_nti.get_remain(break_loop_at_end), 0) || (is_fading_out && Animation::is_less_or_equal_approx(cur_fade_out_remaining, 0) && os_nti.length == os_nti.position)) {
if (Animation::is_less_or_equal_approx(os_nti.get_remain(break_loop_at_end), 0) || (is_fading_out && cur_fade_out_remaining <= 0)) {

So this improves accuracy, but it seems insufficient due to problems elsewhere. I will look into it when I have time.

Copy link
Copy Markdown
Member

@TokageItLab TokageItLab May 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright I sent #106567 (diff is 0320305 from #101792), please check it.

@BlackShift
Copy link
Copy Markdown
Contributor Author

Closing in favor of #106567

@BlackShift BlackShift closed this May 19, 2025
@github-project-automation github-project-automation Bot moved this from Ready for review to Done in Animation Team Issue Triage May 19, 2025
@AThousandShips AThousandShips added archived and removed cherrypick:4.3 Considered for cherry-picking into a future 4.3.x release cherrypick:4.4 Considered for cherry-picking into a future 4.4.x release labels May 19, 2025
@AThousandShips AThousandShips removed this from the 4.5 milestone May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

[Animation] AnimationNodeOneShot fails to trigger animation_finished signal at high frame rates.

3 participants