diff --git a/scene/animation/animation_node_state_machine.cpp b/scene/animation/animation_node_state_machine.cpp index dd5ff7912fce..f4e1b3615c2e 100644 --- a/scene/animation/animation_node_state_machine.cpp +++ b/scene/animation/animation_node_state_machine.cpp @@ -860,7 +860,7 @@ double AnimationNodeStateMachinePlayback::_process(const String &p_base_path, An pi.time = 0; pi.seeked = true; } - fading_from_rem = p_state_machine->blend_node(p_state_machine->states[fading_from].node, fading_from, pi, AnimationNode::FILTER_IGNORE, true); // Blend values must be more than CMP_EPSILON to process discrete keys in edge. + fading_from_rem = p_state_machine->blend_node(p_state_machine->states[fading_from].node, fading_from, pi, AnimationNode::FILTER_IGNORE, true, p_test_only); // Blend values must be more than CMP_EPSILON to process discrete keys in edge. // Guess playback position. if (fading_from_rem > len_fade_from) { /// Weird but ok. @@ -976,7 +976,7 @@ bool AnimationNodeStateMachinePlayback::_transition_to_next_recursive(AnimationT pi.seeked = true; pi.is_external_seeking = false; pi.weight = 0; - p_state_machine->blend_node(p_state_machine->states[current].node, current, pi, AnimationNode::FILTER_IGNORE, true); + p_state_machine->blend_node(p_state_machine->states[current].node, current, pi, AnimationNode::FILTER_IGNORE, true, p_test_only); } // Just get length to find next recursive. diff --git a/scene/animation/animation_tree.cpp b/scene/animation/animation_tree.cpp index bdadc4ecac5e..e24816122cd2 100644 --- a/scene/animation/animation_tree.cpp +++ b/scene/animation/animation_tree.cpp @@ -100,9 +100,9 @@ void AnimationNode::blend_animation(const StringName &p_animation, AnimationMixe process_state->tree->make_animation_instance(p_animation, p_playback_info); } -double AnimationNode::_pre_process(ProcessState *p_process_state, AnimationMixer::PlaybackInfo p_playback_info) { +double AnimationNode::_pre_process(ProcessState *p_process_state, AnimationMixer::PlaybackInfo p_playback_info, bool p_test_only) { process_state = p_process_state; - double t = process(p_playback_info); + double t = process(p_playback_info, p_test_only); process_state = nullptr; return t; } @@ -152,7 +152,7 @@ double AnimationNode::blend_input(int p_input, AnimationMixer::PlaybackInfo p_pl } double AnimationNode::blend_node(Ref p_node, const StringName &p_subpath, AnimationMixer::PlaybackInfo p_playback_info, FilterAction p_filter, bool p_sync, bool p_test_only) { - node_state.connections.clear(); + p_node->node_state.connections.clear(); return _blend_node(p_node, p_subpath, this, p_playback_info, p_filter, p_sync, p_test_only, nullptr); } @@ -269,9 +269,9 @@ double AnimationNode::_blend_node(Ref p_node, const StringName &p p_node->node_state.parent = new_parent; if (!p_playback_info.seeked && !p_sync && !any_valid) { p_playback_info.time = 0.0; - return p_node->_pre_process(process_state, p_playback_info); + return p_node->_pre_process(process_state, p_playback_info, p_test_only); } - return p_node->_pre_process(process_state, p_playback_info); + return p_node->_pre_process(process_state, p_playback_info, p_test_only); } String AnimationNode::get_caption() const { @@ -565,12 +565,12 @@ bool AnimationTree::_blend_pre_process(double p_delta, int p_track_count, const if (started) { // If started, seek. pi.seeked = true; - root_animation_node->_pre_process(&process_state, pi); + root_animation_node->_pre_process(&process_state, pi, false); started = false; - } else { - pi.time = p_delta; - root_animation_node->_pre_process(&process_state, pi); } + pi.seeked = false; + pi.time = p_delta; + root_animation_node->_pre_process(&process_state, pi, false); } if (!process_state.valid) { diff --git a/scene/animation/animation_tree.h b/scene/animation/animation_tree.h index 0be487d3fd3e..87928e4d2075 100644 --- a/scene/animation/animation_tree.h +++ b/scene/animation/animation_tree.h @@ -85,7 +85,7 @@ class AnimationNode : public Resource { void _set_filters(const Array &p_filters); friend class AnimationNodeBlendTree; double _blend_node(Ref p_node, const StringName &p_subpath, AnimationNode *p_new_parent, AnimationMixer::PlaybackInfo p_playback_info, FilterAction p_filter = FILTER_IGNORE, bool p_sync = true, bool p_test_only = false, real_t *r_activity = nullptr); - double _pre_process(ProcessState *p_process_state, AnimationMixer::PlaybackInfo p_playback_info); + double _pre_process(ProcessState *p_process_state, AnimationMixer::PlaybackInfo p_playback_info, bool p_test_only = false); protected: virtual double _process(const AnimationMixer::PlaybackInfo p_playback_info, bool p_test_only = false);