diff --git a/editor/animation/animation_player_editor_plugin.cpp b/editor/animation/animation_player_editor_plugin.cpp index 68f883481d8..ff9dd6738a9 100644 --- a/editor/animation/animation_player_editor_plugin.cpp +++ b/editor/animation/animation_player_editor_plugin.cpp @@ -246,7 +246,7 @@ void AnimationPlayerEditor::_autoplay_pressed() { } } -void AnimationPlayerEditor::_go_to_nearest_keyframe(bool p_backward) { +void AnimationPlayerEditor::go_to_nearest_keyframe(bool p_backward) { if (_get_current().is_empty()) { return; } @@ -1667,10 +1667,10 @@ void AnimationPlayerEditor::shortcut_input(const Ref &p_ev) { _play_bw_pressed(); accept_event(); } else if (ED_IS_SHORTCUT("animation_editor/go_to_next_keyframe", p_ev)) { - _go_to_nearest_keyframe(false); + go_to_nearest_keyframe(false); accept_event(); } else if (ED_IS_SHORTCUT("animation_editor/go_to_previous_keyframe", p_ev)) { - _go_to_nearest_keyframe(true); + go_to_nearest_keyframe(true); accept_event(); } } @@ -2298,8 +2298,6 @@ void fragment() { ED_SHORTCUT("animation_editor/play_animation_backwards", TTRC("Play Animation Backwards"), Key::A); ED_SHORTCUT("animation_editor/play_animation_from_start", TTRC("Play Animation from Start"), KeyModifierMask::SHIFT + Key::D); ED_SHORTCUT("animation_editor/play_animation_from_end", TTRC("Play Animation Backwards from End"), KeyModifierMask::SHIFT + Key::A); - ED_SHORTCUT("animation_editor/go_to_next_keyframe", TTRC("Go to Next Keyframe"), KeyModifierMask::SHIFT + KeyModifierMask::ALT + Key::D); - ED_SHORTCUT("animation_editor/go_to_previous_keyframe", TTRC("Go to Previous Keyframe"), KeyModifierMask::SHIFT + KeyModifierMask::ALT + Key::A); } AnimationPlayerEditor::~AnimationPlayerEditor() { diff --git a/editor/animation/animation_player_editor_plugin.h b/editor/animation/animation_player_editor_plugin.h index a31e00e8951..1ac91c80914 100644 --- a/editor/animation/animation_player_editor_plugin.h +++ b/editor/animation/animation_player_editor_plugin.h @@ -179,7 +179,6 @@ class AnimationPlayerEditor : public VBoxContainer { void _select_anim_by_name(const String &p_anim); float _get_editor_step() const; - void _go_to_nearest_keyframe(bool p_backward); void _play_pressed(); void _play_from_pressed(); void _play_bw_pressed(); @@ -271,6 +270,7 @@ public: void clear(); void ensure_visibility(); + void go_to_nearest_keyframe(bool p_backward); void edit(AnimationMixer *p_node, AnimationPlayer *p_player, bool p_is_dummy); void forward_force_draw_over_viewport(Control *p_overlay); diff --git a/editor/animation/animation_track_editor.cpp b/editor/animation/animation_track_editor.cpp index 23e0dc4fe49..e618cf1ddb0 100644 --- a/editor/animation/animation_track_editor.cpp +++ b/editor/animation/animation_track_editor.cpp @@ -7322,6 +7322,13 @@ void AnimationTrackEditor::_edit_menu_pressed(int p_option) { goto_prev_step(false); } break; + case EDIT_GOTO_NEXT_KEYFRAME: { + AnimationPlayerEditor::get_singleton()->go_to_nearest_keyframe(false); + } break; + case EDIT_GOTO_PREV_KEYFRAME: { + AnimationPlayerEditor::get_singleton()->go_to_nearest_keyframe(true); + } break; + case EDIT_APPLY_RESET: { AnimationPlayerEditor::get_singleton()->get_player()->apply_reset(true); } break; @@ -8152,6 +8159,9 @@ AnimationTrackEditor::AnimationTrackEditor() { edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/goto_next_step", TTRC("Go to Next Step"), KeyModifierMask::CMD_OR_CTRL | Key::RIGHT), EDIT_GOTO_NEXT_STEP); edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/goto_prev_step", TTRC("Go to Previous Step"), KeyModifierMask::CMD_OR_CTRL | Key::LEFT), EDIT_GOTO_PREV_STEP); edit->get_popup()->add_separator(); + edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/go_to_next_keyframe", TTRC("Go to Next Keyframe"), KeyModifierMask::SHIFT | KeyModifierMask::ALT | Key::D), EDIT_GOTO_NEXT_KEYFRAME); + edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/go_to_previous_keyframe", TTRC("Go to Previous Keyframe"), KeyModifierMask::SHIFT | KeyModifierMask::ALT | Key::A), EDIT_GOTO_PREV_KEYFRAME); + edit->get_popup()->add_separator(); edit->get_popup()->add_shortcut(ED_SHORTCUT("animation_editor/apply_reset", TTRC("Apply Reset")), EDIT_APPLY_RESET); edit->get_popup()->add_separator(); edit->get_popup()->add_item(TTR("Bake Animation..."), EDIT_BAKE_ANIMATION); diff --git a/editor/animation/animation_track_editor.h b/editor/animation/animation_track_editor.h index fe877170583..59de3fbed9a 100644 --- a/editor/animation/animation_track_editor.h +++ b/editor/animation/animation_track_editor.h @@ -925,7 +925,9 @@ public: EDIT_OPTIMIZE_ANIMATION, EDIT_OPTIMIZE_ANIMATION_CONFIRM, EDIT_CLEAN_UP_ANIMATION, - EDIT_CLEAN_UP_ANIMATION_CONFIRM + EDIT_CLEAN_UP_ANIMATION_CONFIRM, + EDIT_GOTO_NEXT_KEYFRAME, + EDIT_GOTO_PREV_KEYFRAME, }; void add_track_edit_plugin(const Ref &p_plugin);