JumpToNode: apply the jump before returning so player state isn't stale#11
Open
Infinitegameworks wants to merge 1 commit into
Open
Conversation
JumpToNode previously only set the state machine state; the graph was not re-evaluated until the next tick, so reads immediately after a jump (current sequence, animation length) returned the previous animation. A successful jump now runs one zero-delta-time graph pass before returning. During that pass transition rules are suppressed, notifies are skipped (including the deferred-notify reconcile, so active notify states are not aborted), and overrides are re-published without being ticked. CacheAnimation nodes dedupe by a per-instance graph update id instead of GFrameNumber so a second same-frame traversal is not served stale cached data. Jumps requested from inside callbacks are queued and applied when the active pass finishes, with a bounded flush to stop jump/callback cycles. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Calling
JumpToNodeonly sets the state machine's new state — the graph isn't re-evaluated until the next tick. So for a frame or more, theAnimPlayerstill reports the previous animation. Anything that reads the player right after jumping (e.g. getting the new animation's length for timing windows) gets stale data and has to work around it by waiting a tick.Fix
JumpToNodenow commits the jump before returning: a successful jump runs one zero-delta-time graph pass (update -> evaluate -> play), so the player and render component reflect the new state immediately.CacheAnimationnodes deduped updates byGFrameNumber, which would serve stale cached data on a second traversal in the same frame. They now use a per-instance graph update counter instead.JumpToNodecalls made from inside a callback (notify, state enter/exit, sequence-changed) are queued and applied when the current pass finishes, instead of mutating the state machine mid-update. A safety cap stops infinite jump->callback->jump cycles.Notes for reviewers
OnPlaybackSequenceChangednow fires inside theJumpToNodecall when the jump changes the rendered sequence. Graphs that bind to it after jumping should bind first (or just read the player directly, since it's now current on return).FPaperZDAnimNode_StateMachine::JumpToNodereturnsbool(found and applied), and the cache node'sLastUpdateFrameNumberfield was renamed toLastGraphUpdateId— modules compiled against the old headers need a rebuild.Testing
JumpToNode; active notify states are not interrupted by the extra pass; jumps requested from inside notify callbacks defer correctly without recursion.🤖 Generated with Claude Code