Skip to content

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

@BlackShift

Description

@BlackShift

Tested versions

-Reproducible in 4.4beta4
-Reproducible in 4.3stable

System information

Windows 10 - Vulkan 1.3.280 - Forward+ - Using Device #0: NVIDIA - NVIDIA GeForce RTX 3090

Issue description

The animation_finished is not reliable at high frame rates, and will sometimes miss.
This seems to only occur if a fade-out is enabled on OneShotNode.

The two relevant if statements that I suspect are the culprit:
AnimationNodeAnimation::_process()

// Finished.
if (Animation::is_less_approx(prev_playback_time, anim_size) && Animation::is_greater_or_equal_approx(cur_playback_time, anim_size)) {

AnimationOneShotNode::_process()

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))) {
  	  	set_parameter(internal_active, false);
  	  	set_parameter(active, false);

I suspect that the OneShotNode's test is happening early and in some instances will stop processing. not giving the animation node an opportunity to fire the signal.

I was able to fix it on my local build by adding a field to NodeTimeInfo, A just_ended flag. I don't think that solution will work for all, as this would potentially impact AnimationNodeExtension. Perhaps we just need to make that if statement more restrictive to prevent the One Shot from ending too early?

Steps to reproduce

Run MRP:
Should see Got animation signal null_animation in console output. re-run if you do not.
Disable vsync:
Signal fails to fire - *most of the time.

Minimal reproduction project (MRP)

OneShotNode-MRP.zip

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions