diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2019-04-25 13:28:58 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-04-25 13:28:58 +0200 |
| commit | cfc6ae8920359744e87d00b1336705a0ad853926 (patch) | |
| tree | 3d73005bccdd9bf208675a223046cc35ea731b93 /editor/plugins/animation_state_machine_editor.cpp | |
| parent | 4ad22f81481c3c721a78dbc96d391a8f873738db (diff) | |
| parent | 0fcbf4da8f1245f4d711fc28914b06f582f93307 (diff) | |
Merge pull request #28336 from guilhermefelipecgs/fix_play_pos
[StateMachine] Fix play position
Diffstat (limited to 'editor/plugins/animation_state_machine_editor.cpp')
| -rw-r--r-- | editor/plugins/animation_state_machine_editor.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/editor/plugins/animation_state_machine_editor.cpp b/editor/plugins/animation_state_machine_editor.cpp index 567c336eff..f06b4b2828 100644 --- a/editor/plugins/animation_state_machine_editor.cpp +++ b/editor/plugins/animation_state_machine_editor.cpp @@ -874,7 +874,7 @@ void AnimationNodeStateMachineEditor::_state_machine_pos_draw() { } 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 c = pos / len; @@ -1012,6 +1012,7 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) { StringName current_node; StringName blend_from_node; play_pos = 0; + current_length = 0; if (playback.is_valid()) { tp = playback->get_travel_path(); @@ -1019,6 +1020,7 @@ void AnimationNodeStateMachineEditor::_notification(int p_what) { current_node = playback->get_current_node(); blend_from_node = playback->get_blend_from_node(); 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 - if (current_node_playback.is_valid()) + if (current_node_playback.is_valid()) { play_pos = current_node_playback->get_current_play_pos(); + current_length = current_node_playback->get_current_length(); + } } } |