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

Variable with setter gets set every frame when keyframe of it exists and animation player is linked to a state machine animation tree #98174

Closed
hipturre opened this issue Oct 14, 2024 · 10 comments

Comments

@hipturre
Copy link

Tested versions

  • Reproducible in v4.3.stable.official [77dcf97]

System information

Godot v4.3.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 4070 (NVIDIA; 32.0.15.6094) - 13th Gen Intel(R) Core(TM) i7-13700KF (24 Threads)

Issue description

I originally stumbled across this issue trying to set enums during attack animations in another project. I'm fairly certain this is a bug. If you create a variable with a setter, create an animation with a keyframe of that variable, and link that animation player to an animation tree with root of a state machine, then that variable will be set every frame. Nothing even has to be inside the animation tree, it just happens.

Steps to reproduce

Create a new 3D Scene with Node3D as the root.

Create a script and exported variable of type int for the Node3D.

Add a set(): to the variable and put a print in there.

Add an animation player as a child of the Node3D and create an animation that has a property track for the variable and insert at least one keyframe.

Add an animation tree as a child as the Node3D and set its root to a state machine and set the animation player to the one created.

Run the project, and you will see constant prints in the output, despite the animation not even playing.

Minimal reproduction project (MRP)

Here's the MRP.

anim_tree-test - Copy.zip

@AThousandShips

This comment was marked as outdated.

@AThousandShips AThousandShips closed this as not planned Won't fix, can't repro, duplicate, stale Oct 14, 2024
@hipturre
Copy link
Author

I am on the discrete callback mode;

image

@AThousandShips
Copy link
Member

Okay thank you for clarifying (you didn't mention it) reopening for testing

@hipturre
Copy link
Author

Sorry for not mentioning it, I hadn't considered that part of the issue.

@AThousandShips
Copy link
Member

The animation tree isn't really set up to do anything so it is unclear what is supposed to happen here, but if you change the callback mode in the tree to something other than "Force Discrete" it works correctly

@hipturre
Copy link
Author

My tree does not have a "Force Discrete" rather it has "Force Continous", "Dominant", and "Recessive". Switching off "Force Continous" does fix the issue as you said. However I would like to know if this is intended behavior.

@AThousandShips
Copy link
Member

My bad meant "Force Continuous"

Not sure what's intended here, or how it would be handled when adding a real use case for the tree

@hipturre
Copy link
Author

Well as I said in my issue description, I stumbled across this issue with an actual tree that had state machines and states inside of it. In that case I have three variables that are altered by animations. Setting the tree callback to dominant or recessive causes only one ( the same one) to update constantly. I can attempt to make a MRP of that whole scene but it might take a while finding what breaks the behavior and what doesn't.

@AThousandShips
Copy link
Member

Not sure what is to be expected there, or how to solve it, let's see what the animation team says

CC @TokageItLab

@TokageItLab
Copy link
Member

TokageItLab commented Oct 14, 2024

This is the expected behavior. There are some duplicate issues as #95684, so this is closed. There is a PR in #95711 that makes it warn for the case if it is particularly unsafe setter.

@TokageItLab TokageItLab closed this as not planned Won't fix, can't repro, duplicate, stale Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants