Skip to content
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

AnimationPlayer negative values of tracks are rounded inconsistently for both update modes #84106

Closed
Tracked by #83401
issork opened this issue Oct 28, 2023 · 8 comments · Fixed by #84815
Closed
Tracked by #83401

Comments

@issork
Copy link
Contributor

issork commented Oct 28, 2023

Godot version

v4.2.beta3.official [e8d57af]

System information

Godot v4.2.beta3 - Windows 10.0.19045 - GLES3 (Compatibility) - NVIDIA GeForce GTX 1060 6GB (NVIDIA; 31.0.15.3699) - AMD Ryzen 5 2600X Six-Core Processor (12 Threads)

Issue description

After updating to 4.2.beta3, some animations in my project using the z_index broke. The z_index is no longer set on nodes if it is negative when the animation is playing.

Further investigation showed that compared to the version I previously used (4.2.dev5), the continuous update mode now rounds values differently, resulting in negative values always being off by 1.

image

Steps to reproduce

I don't have steps to reproduce it from an empty project, as the issue is inconsistent. Animations being added/removed changes the behavior sometimes, which is why these steps assume you are using the MRP below.

  1. Play the 'walk_right' animation of the ArmLPlayer
  • the z_index of the ArmL node does not change to -1 in either update mode
  1. Play the 'walk_left' animation of the ArmRPlayer
  • the z_index of the ArmR node changes to -1 in discrete update mode but not in continuous update mode

Minimal reproduction project

AnimPlayerMRP.zip

Play the animation of the AnimationPlayer, the z_index value of the Sprite does not change.

@jsjtxietian
Copy link
Contributor

jsjtxietian commented Oct 30, 2023

Using the current master will give this error when open the animation tab:

Node not found: "Icon2:z_index" (relative to "/root/@EditorNode@17151/@Panel@13/@VBoxContainer@14/@HSplitContainer@17/@HSplitContainer@25/@HSplitContainer@33/@VBoxContainer@34/@VSplitContainer@36/@VSplitContainer@62/@VBoxContainer@63/@PanelContainer@110/MainScreen/@CanvasItemEditor@9493/@VSplitContainer@9312/@HSplitContainer@9314/@HSplitContainer@9316/@Control@9317/@SubViewportContainer@9318/@SubViewport@9319/Node2D/Icon2").

scene\animation\animation_mixer.cpp:635 - AnimationMixer: 'new_animation', couldn't resolve track:  'Icon2:z_index'.

If I manually change tracks/0/path = NodePath("Icon2:z_index") to tracks/0/path = NodePath("../Icon2:z_index") or NodePath(".:z_index"), the error is gone and z index of icon is correctly set at -1. Or if I delete root_node = NodePath("../Icon2"), the error is gone too.

image

So the real bug here is godot cannot find icon2 based on it's saved path under root node, which seems strange.

@issork
Copy link
Contributor Author

issork commented Oct 30, 2023

So the real bug here is godot cannot find icon2 based on it's saved path under root node, which seems strange.

Oh, that might've been my fault then. I moved the nodes after creating the track to better represent my initial projects tree structure.

Which means I haven't managed to actually recreate the issue I see in my project. All other properties are being updated (like region_rect, position etc.) but not the z_index.

@issork

This comment was marked as outdated.

@issork
Copy link
Contributor Author

issork commented Oct 30, 2023

And now I noticed that if I set the z_index in the MRP to -2, it is actually being set to -1. It always seems to be off by 1 for negative values.

Edit: The continuous update mode seems now round values differently compared to older versions. Using the discrete mode works as expected. Updating the issues title and description.

@issork issork changed the title AnimationPlayer doesn't set negative z_index on node Continuous update mode rounds negative values different compared to 4.2.dev5 and older versions Oct 30, 2023
@AThousandShips
Copy link
Member

Unsure how this should be approached, the continuous mode doesn't seem logical for an int variable, so unsure what to consider this

@issork
Copy link
Contributor Author

issork commented Oct 30, 2023

This definitely needs more testing. After changing the update mode to discrete for every single track, the right arm now does work, but the left arm no longer does. The rounding seems to be very inconsistent for any update mode. For some nodes it works, for others it does not, even with same values.

The right arm animation player only works with discrete update mode, the left arm only works with continuous.

Will try to replicate this in the MRP and update it and the title again.

@akien-mga
Copy link
Member

Part of #83401 (CC @TokageItLab).

@issork
Copy link
Contributor Author

issork commented Oct 30, 2023

AnimPlayerMRP.zip

Here's the MRP, it behaves a little different than in my main project, which means it might behave different for you as well.

Playing the 'walk_right' animation in the ArmLPlayer AnimationPlayer node:

  • z_index of the ArmL node does not change to -1 in either update mode

Playing the 'walk_left' animation in the ArmRPlayer AnimationPlayer node:

  • z_index of the ArmR node changes to -1 in discrete update mode but not in continuous update mode

Deleting some tracks from the animation player changes this behavior as well, which is why I had to leave all animations inside the project.

@issork issork changed the title Continuous update mode rounds negative values different compared to 4.2.dev5 and older versions AnimationPlayer negative values of tracks are rounded inconsistently for both update modes Oct 30, 2023
@akien-mga akien-mga modified the milestones: 4.3, 4.2 Nov 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants