diff options
author | Tomasz Chabora <kobewi4e@gmail.com> | 2019-10-01 18:38:03 +0200 |
---|---|---|
committer | Tomasz Chabora <kobewi4e@gmail.com> | 2019-10-01 18:38:03 +0200 |
commit | d482bd1ef0560fd1a5eef00fa023710088b295f1 (patch) | |
tree | e98e3e1b36c6cc97eb63c1f9fda97887b22845c3 | |
parent | 871a9d5d56ead0b640618762cd945be0fb2cff97 (diff) |
Automatically seek timeline in selected animation
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/animation_player_editor_plugin.h | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index 2d00324c84..60ef88d2e3 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -304,6 +304,7 @@ void AnimationPlayerEditor::_animation_selected(int p_which) { AnimationPlayerEditor::singleton->get_track_editor()->update_keying(); EditorNode::get_singleton()->update_keying(); + _animation_key_editor_seek(timeline_position, false); } void AnimationPlayerEditor::_animation_new() { @@ -1072,6 +1073,8 @@ void AnimationPlayerEditor::_animation_key_editor_anim_len_changed(float p_len) void AnimationPlayerEditor::_animation_key_editor_seek(float p_pos, bool p_drag) { + timeline_position = p_pos; + if (!is_visible_in_tree()) return; if (!player) @@ -1753,6 +1756,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay renaming = false; last_active = false; + timeline_position = 0; set_process_unhandled_key_input(true); diff --git a/editor/plugins/animation_player_editor_plugin.h b/editor/plugins/animation_player_editor_plugin.h index eed7344395..663ffd57f3 100644 --- a/editor/plugins/animation_player_editor_plugin.h +++ b/editor/plugins/animation_player_editor_plugin.h @@ -107,6 +107,7 @@ class AnimationPlayerEditor : public VBoxContainer { UndoRedo *undo_redo; Ref<Texture> autoplay_icon; bool last_active; + float timeline_position; EditorFileDialog *file; AcceptDialog *accept; |