Merge pull request #113415 from Calinou/editor-animation-add-shortcut-in-tooltip

Add shortcuts in tooltips to the animation editor's play/pause buttons
This commit is contained in:
Thaddeus Crews 2025-12-03 11:42:20 -06:00
commit f972ab80ec
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
2 changed files with 13 additions and 5 deletions

View file

@ -151,12 +151,16 @@ void AnimationPlayerEditor::_notification(int p_what) {
EditorNode::get_singleton()->connect("scene_changed", callable_mp(this, &AnimationPlayerEditor::_find_player)); EditorNode::get_singleton()->connect("scene_changed", callable_mp(this, &AnimationPlayerEditor::_find_player));
add_theme_style_override(SceneStringName(panel), EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SceneStringName(panel), SNAME("Panel"))); add_theme_style_override(SceneStringName(panel), EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SceneStringName(panel), SNAME("Panel")));
_update_playback_tooltips();
} break; } break;
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
if (EditorThemeManager::is_generated_theme_outdated()) { if (EditorThemeManager::is_generated_theme_outdated()) {
add_theme_style_override(SceneStringName(panel), EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SceneStringName(panel), SNAME("Panel"))); add_theme_style_override(SceneStringName(panel), EditorNode::get_singleton()->get_editor_theme()->get_stylebox(SceneStringName(panel), SNAME("Panel")));
} }
_update_playback_tooltips();
} break; } break;
case NOTIFICATION_TRANSLATION_CHANGED: case NOTIFICATION_TRANSLATION_CHANGED:
@ -1202,6 +1206,14 @@ void AnimationPlayerEditor::_update_name_dialog_library_dropdown() {
} }
} }
void AnimationPlayerEditor::_update_playback_tooltips() {
stop->set_tooltip_text(TTR("Pause/Stop Animation") + " (" + ED_GET_SHORTCUT("animation_editor/stop_animation")->get_as_text() + ")");
play->set_tooltip_text(TTR("Play Animation from Start") + " (" + ED_GET_SHORTCUT("animation_editor/play_animation_from_start")->get_as_text() + ")");
play_from->set_tooltip_text(TTR("Play Animation") + " (" + ED_GET_SHORTCUT("animation_editor/play_animation")->get_as_text() + ")");
play_bw_from->set_tooltip_text(TTR("Play Animation Backwards") + " (" + ED_GET_SHORTCUT("animation_editor/play_animation_backwards")->get_as_text() + ")");
play_bw->set_tooltip_text(TTR("Play Animation Backwards from End") + " (" + ED_GET_SHORTCUT("animation_editor/play_animation_from_end")->get_as_text() + ")");
}
void AnimationPlayerEditor::_ensure_dummy_player() { void AnimationPlayerEditor::_ensure_dummy_player() {
bool dummy_exists = is_dummy && player && original_node; bool dummy_exists = is_dummy && player && original_node;
if (dummy_exists) { if (dummy_exists) {
@ -2062,27 +2074,22 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug
play_bw_from = memnew(Button); play_bw_from = memnew(Button);
play_bw_from->set_theme_type_variation(SceneStringName(FlatButton)); play_bw_from->set_theme_type_variation(SceneStringName(FlatButton));
play_bw_from->set_tooltip_text(TTR("Play Animation Backwards"));
playback_container->add_child(play_bw_from); playback_container->add_child(play_bw_from);
play_bw = memnew(Button); play_bw = memnew(Button);
play_bw->set_theme_type_variation(SceneStringName(FlatButton)); play_bw->set_theme_type_variation(SceneStringName(FlatButton));
play_bw->set_tooltip_text(TTR("Play Animation Backwards from End"));
playback_container->add_child(play_bw); playback_container->add_child(play_bw);
stop = memnew(Button); stop = memnew(Button);
stop->set_theme_type_variation(SceneStringName(FlatButton)); stop->set_theme_type_variation(SceneStringName(FlatButton));
stop->set_tooltip_text(TTR("Pause/Stop Animation"));
playback_container->add_child(stop); playback_container->add_child(stop);
play = memnew(Button); play = memnew(Button);
play->set_theme_type_variation(SceneStringName(FlatButton)); play->set_theme_type_variation(SceneStringName(FlatButton));
play->set_tooltip_text(TTR("Play Animation from Start"));
playback_container->add_child(play); playback_container->add_child(play);
play_from = memnew(Button); play_from = memnew(Button);
play_from->set_theme_type_variation(SceneStringName(FlatButton)); play_from->set_theme_type_variation(SceneStringName(FlatButton));
play_from->set_tooltip_text(TTR("Play Animation"));
playback_container->add_child(play_from); playback_container->add_child(play_from);
frame = memnew(SpinBox); frame = memnew(SpinBox);

View file

@ -212,6 +212,7 @@ class AnimationPlayerEditor : public EditorDock {
void _set_controls_disabled(bool p_disabled); void _set_controls_disabled(bool p_disabled);
void _update_animation_list_icons(); void _update_animation_list_icons();
void _update_name_dialog_library_dropdown(); void _update_name_dialog_library_dropdown();
void _update_playback_tooltips();
void _blend_edited(); void _blend_edited();
void _animation_player_changed(Object *p_pl); void _animation_player_changed(Object *p_pl);