summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2023-01-03 12:41:35 +0100
committerRémi Verschelde <rverschelde@gmail.com>2023-01-03 12:41:35 +0100
commitc5279420c8fb239f812ea23e3c6f7e7610d31a4d (patch)
tree897bb2cbf189960cb3d1d431cecb9f2d82052b49
parent55ef81547215e00b2f90ec91cc11071d21e60239 (diff)
parent74e0903bb8117215acaef45c627101d49961c489 (diff)
Merge pull request #70572 from TokageItLab/fix-statemachine-fade
Fix wrong `AnimationStateMachine` process for end of fading
-rw-r--r--scene/animation/animation_node_state_machine.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp
index d54740e9b0..4c677b6a9f 100644
--- a/scene/animation/animation_node_state_machine.cpp
+++ b/scene/animation/animation_node_state_machine.cpp
@@ -415,9 +415,6 @@ double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_s
fading_pos += p_time;
}
fade_blend = MIN(1.0, fading_pos / fading_time);
- if (fade_blend > 1.0) {
- fading_from = StringName();
- }
}
}
@@ -426,9 +423,12 @@ double AnimationNodeStateMachinePlayback::process(AnimationNodeStateMachine *p_s
}
double rem = p_state_machine->blend_node(current, p_state_machine->states[current].node, p_time, p_seek, p_is_external_seeking, Math::is_zero_approx(fade_blend) ? CMP_EPSILON : fade_blend, AnimationNode::FILTER_IGNORE, true); // Blend values must be more than CMP_EPSILON to process discrete keys in edge.
- double fade_blend_inv = 1.0 - fade_blend;
if (fading_from != StringName()) {
+ double fade_blend_inv = 1.0 - fade_blend;
p_state_machine->blend_node(fading_from, p_state_machine->states[fading_from].node, p_time, p_seek, p_is_external_seeking, Math::is_zero_approx(fade_blend_inv) ? CMP_EPSILON : fade_blend_inv, AnimationNode::FILTER_IGNORE, true); // Blend values must be more than CMP_EPSILON to process discrete keys in edge.
+ if (fade_blend >= 1.0) {
+ fading_from = StringName();
+ }
}
//guess playback position