Browse Source

Merge pull request #34022 from nekomatata/animation-player-stop-errors

Fixed errors in AnimationPlayerEditor when switching current_animation in the inspector
Rémi Verschelde 5 years ago
parent
commit
d42ff4c2ae
1 changed files with 3 additions and 0 deletions
  1. 3 0
      editor/plugins/animation_player_editor_plugin.cpp

+ 3 - 0
editor/plugins/animation_player_editor_plugin.cpp

@@ -85,6 +85,9 @@ void AnimationPlayerEditor::_notification(int p_what) {
 				track_editor->set_anim_pos(player->get_current_animation_position());
 				track_editor->set_anim_pos(player->get_current_animation_position());
 				EditorNode::get_singleton()->get_inspector()->refresh();
 				EditorNode::get_singleton()->get_inspector()->refresh();
 
 
+			} else if (!player->is_valid()) {
+				// Reset timeline when the player has been stopped externally
+				frame->set_value(0);
 			} else if (last_active) {
 			} else if (last_active) {
 				// Need the last frame after it stopped.
 				// Need the last frame after it stopped.
 				frame->set_value(player->get_current_animation_position());
 				frame->set_value(player->get_current_animation_position());