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

AnimationNodeTransition's current_state is unset after #72450 #72637

Closed
maiself opened this issue Feb 2, 2023 · 7 comments · Fixed by #72722
Closed

AnimationNodeTransition's current_state is unset after #72450 #72637

maiself opened this issue Feb 2, 2023 · 7 comments · Fixed by #72722

Comments

@maiself
Copy link
Contributor

maiself commented Feb 2, 2023

Godot version

afe3b94

System information

arch linux

Issue description

AnimationNodeTransition's current_state is unset after #72450

The line here https://github.com/godotengine/godot/pull/72450/files#diff-5f60b407f682f667ff4662bba3f1540fbe42dd854480db702ae445b5d56a281aL831 was moved up into the block above, and is now not called.

This is happening in my project when the first transition is to the first state.

Steps to reproduce

Try to retrieve AnimationNodeTransition's current_state after transitioning to the first state, current_state is unset.

Minimal reproduction project

None

@TokageItLab
Copy link
Member

TokageItLab commented Feb 3, 2023

The current_state is now read-only. You can set only transition_request.

@maiself
Copy link
Contributor Author

maiself commented Feb 3, 2023

Right, this is about not being able to read current_state after setting transition_request because current_state wasn't set internally.

@TokageItLab
Copy link
Member

TokageItLab commented Feb 3, 2023

The current_state is set in the _process() after the transition_request is set. If you need to retrieve the animation immediately after setting (during the time it takes to _process()), read the transition_request directly. This is the same with other requests and is not a bug.

@maiself
Copy link
Contributor Author

maiself commented Feb 3, 2023

The current_state is set in the _process() after the transition_request is set.

Currently that statement doesn't hold if current_index == 0 when transition_request is set to the state in position 0. Many _process() may have happened and current_state will still not be set.

@TokageItLab
Copy link
Member

Are you trying to transition to the same state? Caused by the side-effects of #72450?

@maiself
Copy link
Contributor Author

maiself commented Feb 3, 2023

Yes and no... my code is checking current_state to know what state to request next, but current_state isn't valid and so it tries to transition to what it should be. I hope that sentience made any sense...

I think the problem is that current_state is not set initially. current_index starts out at 0, but current_state starts as nothing at all, when it should be the name of the initial state.

@TokageItLab
Copy link
Member

Maybe the initial value should be -1 or something, but I don't know if it can be done, because I remember that not blending was not allowed. I'll look at it later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment