[StateMachine] Fix play position
Continuation of771fbd282a
(cherry picked from commit0fcbf4da8f
)
This commit is contained in:
parent
be47e0546d
commit
6319d662af
|
@ -874,7 +874,7 @@ void AnimationNodeStateMachineEditor::_state_machine_pos_draw() {
|
||||||
}
|
}
|
||||||
to.y = from.y;
|
to.y = from.y;
|
||||||
|
|
||||||
float len = MAX(0.0001, playback->get_current_length());
|
float len = MAX(0.0001, current_length);
|
||||||
|
|
||||||
float pos = CLAMP(play_pos, 0, len);
|
float pos = CLAMP(play_pos, 0, len);
|
||||||
float c = pos / len;
|
float c = pos / len;
|
||||||
|
@ -1012,6 +1012,7 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) {
|
||||||
StringName current_node;
|
StringName current_node;
|
||||||
StringName blend_from_node;
|
StringName blend_from_node;
|
||||||
play_pos = 0;
|
play_pos = 0;
|
||||||
|
current_length = 0;
|
||||||
|
|
||||||
if (playback.is_valid()) {
|
if (playback.is_valid()) {
|
||||||
tp = playback->get_travel_path();
|
tp = playback->get_travel_path();
|
||||||
|
@ -1019,6 +1020,7 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) {
|
||||||
current_node = playback->get_current_node();
|
current_node = playback->get_current_node();
|
||||||
blend_from_node = playback->get_blend_from_node();
|
blend_from_node = playback->get_blend_from_node();
|
||||||
play_pos = playback->get_current_play_pos();
|
play_pos = playback->get_current_play_pos();
|
||||||
|
current_length = playback->get_current_length();
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1060,8 +1062,10 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// when current_node is a state machine, use playback of current_node to set play_pos
|
// when current_node is a state machine, use playback of current_node to set play_pos
|
||||||
if (current_node_playback.is_valid())
|
if (current_node_playback.is_valid()) {
|
||||||
play_pos = current_node_playback->get_current_play_pos();
|
play_pos = current_node_playback->get_current_play_pos();
|
||||||
|
current_length = current_node_playback->get_current_length();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -161,6 +161,7 @@ class AnimationNodeStateMachineEditor : public AnimationTreeNodeEditorPlugin {
|
||||||
Vector<StringName> last_travel_path;
|
Vector<StringName> last_travel_path;
|
||||||
float last_play_pos;
|
float last_play_pos;
|
||||||
float play_pos;
|
float play_pos;
|
||||||
|
float current_length;
|
||||||
|
|
||||||
float error_time;
|
float error_time;
|
||||||
String error_text;
|
String error_text;
|
||||||
|
|
Loading…
Reference in New Issue