-
-
Notifications
You must be signed in to change notification settings - Fork 22k
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
Add fallback default_transition
for travel requests among non-connected states
#102784
base: master
Are you sure you want to change the base?
Conversation
…tion state machine.
Thanks for opening a pull request 🙂 Feature pull requests should be associated to a feature proposal to justify the need for implementing the feature in Godot core. Please open a proposal on the Godot proposals repository (and link to this pull request in the proposal's body). |
Please separate your enhancements into different pull requests and attach Godot improvement proposals. Edited: There is code changes here that is unrelated to Animation Tweaks. |
I merged godotengine/godot/master into iceball457/godot/animation-tweaks on accident and then reverted it. There are no extraneous differences between iceball457/godot/animation-tweaks and godotengine/godot/master as of commit f418603 ("Merge pull request #102749 from timothyqiu/tree-buttons-offset ... Fix TreeItem button tooltip trigger area offset") at the time this branch was forked. @fire Let me know if I should merge master back into my branch, I don't know if that could make the code review easier now that my branch is all sloppy. In the meantime, I'll make a feature proposal |
These code changes have nothing to do with animation.
|
Those changes come from commit d070530. I don't know why changes in 04d7fd2 result in "This merge commit was added into this branch cleanly", but I do see that the sum of the merge and revert show diffs even though the actual files are identical. What I need to know is if I should close this PR and re-open it with a fresh branch. Edit: I may also want to split this PR into "Animation Tree State Machine Teleport Blending" and "Animation Player Force Restart Animation", as the two changes aren't strictly mutual. |
default_transition
for travel requests among non-connected states
Isn't default transition |
Although parameters were removed from the user facing API, they are still accessible internally. Every case that previously resulted in a teleport still results in a teleport EXCEPT for when the user requests a non-connected state with the travel command, which is now processed via That being said, I don't find it hard to imagine users wishing to manually trigger a teleport for one reason or another. It would be possible to allow the user to request a teleport with a |
@AThousandShips Is the "breaks compat" a tag that I should try and fix? Or is it more of a "wait until the next version number to consider this PR" kinda deal |
It's something to discuss, you've changed the parameters of an exposed method which breaks compatibility |
The parameter would no longer do anything. The removed parameter is It could be left as a vestigial parameter without any additional work on my end; however, I think it's best to leave this change for later unless there are other teams who desperately need this change. |
It still breaks compatibility and needs to be handled, you will need to register compatibility methods, see here for instructions |
In my opinion, p_reset_on_teleport is still needed as commented in #102784 (comment) and compatibility is not broken. |
To be clear, I did not modify Edit: I reviewed again, the branch actually can be reached if the user requests a travel while the state machine is sitting in the "/Start" state. This means the parameter is like 99% useless, but not vestigial. Edit 2: Further inspection reveals that the branch that |
For example, when state "N" and "A" are not connected and your current state is "N" (but "N"'s playback is end) with that "A"'s current time is
Since the above 4 are existing behavior, you must keep them. |
Well, if the specification that we are currently discussing and coming to terms with, it may not be necessary to distinguish Start and End from other States. Since it is only important whether they are connected or not. |
Original behavior:
Current behavior:
The behavior in the latest commit uses the default_transition instead of teleporting whenever no path is found. That was the premise of the PR, after all. It is also possible for me to revert the changes to Edit: Accidentally called |
Start and end actually do work properly even without the special case I added for them. |
The state machine for this example is ["A", "B", "C", "D", "E"] connected in order. Playback is currently looping inside A (or at the end, whatever). All other states are waiting at 0.5.
Proposed behavior for the next commit (regarding compatibility): start("E", true) will move to "E" immediately and playback "E" at time 0.0 Now, we wait 10 seconds so that all the machines are at "E". start("A", true) will move to "A" immediately and playback "A" at time 0.0 For the final example, let's imagine the player gave us an input while we were in the middle of start("A", true) will move to "A" immediately and playback "A" at time 0.0 |
travel() should not add “A” to the path. Instead, it should call start(“A”), which is the previous behavior.
Also travel_smooth() is not needed, This is because in the same way that we discussed jump() above, it should be almost equivalent to the following:
|
This is true. The name I may grumble about it but I totally get where you're coming from. You're absolutely certain that exposing fewer members is the higher priority? Currently the only actual difference between all the differently named public members is which flags they set on the internal |
Yes, the addition of APIs should be minimal, and this is Godot's philosophy. If you want to show users how to use path replacement, you can place sample code in the documentation. |
…d from the end of the travel path.
It was pretty simple to replace the existing behavior, but it is proving to be much more difficult to properly swap between both teleporting and jumping. I don't think I will be able to implement this feature the way it was requested with my current skill level I can roll the branch back to "working, but breaks compat", or push my most recent changes which are "the whole queue system got broken". Either way, I will be taking a break from this PR |
Well, if you leave this PR as is, I will try to salvage it when I have time. |
Arbitrary/code-driven animation transitions powered by a state machine are not currently compatible with the complex blending behavior provided by AnimationTree (AnimationPlayer does not accept BlendSpace2d, for example).
AnimationTreeStateMachine is compatible with all the AnimationNode classes to support complex blending, but are not compatible with arbitrary state machines (the only thing missing is smoothing between AnimationNodes).
The latter approach was chosen for being much simpler to implement. It does require the user to add all animations to an AnimationNodeStateMachine, but the user is no longer required to specify n^2 transitions to get reasonable blending between any two states.
Commit bd32776 adds additional functionality to the "default_transition" field that was present but unused in AnimationNodeStateMachinePlayback. It is now located in AnimationNodeStateMachine and used whenever the StateMachine wishes to teleport.
The default value of the AnimationNodeStateMachineTransition as provided by the GUI is identical to the previous teleporting behavior.
Commit cc87b83 is intended as a predecessor to a loop_blend_time field that will allow imperfect animations to loop a little smoother; although being able to restart animations without completely pausing the animator is useful for my projects as well.
Bugsquad edited: