From 9ed655d0eb8f731cd814a01fdfea428b007c412f Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Wed, 16 Oct 2024 16:13:38 +0800 Subject: [PATCH] Don't flip playback control buttons in RTL layout --- editor/debugger/editor_visual_profiler.cpp | 6 +----- editor/export/editor_export_platform.cpp | 6 +----- editor/plugins/animation_player_editor_plugin.cpp | 14 +++++++++----- editor/plugins/sprite_frames_editor_plugin.cpp | 3 ++- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/editor/debugger/editor_visual_profiler.cpp b/editor/debugger/editor_visual_profiler.cpp index d4859fbe4d9..7b831a1c8bf 100644 --- a/editor/debugger/editor_visual_profiler.cpp +++ b/editor/debugger/editor_visual_profiler.cpp @@ -437,11 +437,7 @@ void EditorVisualProfiler::_notification(int p_what) { case NOTIFICATION_LAYOUT_DIRECTION_CHANGED: case NOTIFICATION_THEME_CHANGED: case NOTIFICATION_TRANSLATION_CHANGED: { - if (is_layout_rtl()) { - activate->set_icon(get_editor_theme_icon(SNAME("PlayBackwards"))); - } else { - activate->set_icon(get_editor_theme_icon(SNAME("Play"))); - } + activate->set_icon(get_editor_theme_icon(SNAME("Play"))); clear_button->set_icon(get_editor_theme_icon(SNAME("Clear"))); } break; } diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp index 58737c53edb..50fa49dc524 100644 --- a/editor/export/editor_export_platform.cpp +++ b/editor/export/editor_export_platform.cpp @@ -326,11 +326,7 @@ Error EditorExportPlatform::_save_zip_patch_file(void *p_userdata, const String Ref EditorExportPlatform::get_option_icon(int p_index) const { Ref theme = EditorNode::get_singleton()->get_editor_theme(); ERR_FAIL_COND_V(theme.is_null(), Ref()); - if (EditorNode::get_singleton()->get_gui_base()->is_layout_rtl()) { - return theme->get_icon(SNAME("PlayBackwards"), EditorStringName(EditorIcons)); - } else { - return theme->get_icon(SNAME("Play"), EditorStringName(EditorIcons)); - } + return theme->get_icon(SNAME("Play"), EditorStringName(EditorIcons)); } String EditorExportPlatform::find_export_template(const String &template_file_name, String *err) const { diff --git a/editor/plugins/animation_player_editor_plugin.cpp b/editor/plugins/animation_player_editor_plugin.cpp index e6afc85e9ee..1581e7cc66c 100644 --- a/editor/plugins/animation_player_editor_plugin.cpp +++ b/editor/plugins/animation_player_editor_plugin.cpp @@ -2006,30 +2006,34 @@ AnimationPlayerEditor::AnimationPlayerEditor(AnimationPlayerEditorPlugin *p_plug HBoxContainer *hb = memnew(HBoxContainer); add_child(hb); + HBoxContainer *playback_container = memnew(HBoxContainer); + playback_container->set_layout_direction(LAYOUT_DIRECTION_LTR); + hb->add_child(playback_container); + play_bw_from = memnew(Button); play_bw_from->set_theme_type_variation("FlatButton"); play_bw_from->set_tooltip_text(TTR("Play Animation Backwards")); - hb->add_child(play_bw_from); + playback_container->add_child(play_bw_from); play_bw = memnew(Button); play_bw->set_theme_type_variation("FlatButton"); play_bw->set_tooltip_text(TTR("Play Animation Backwards from End")); - hb->add_child(play_bw); + playback_container->add_child(play_bw); stop = memnew(Button); stop->set_theme_type_variation("FlatButton"); stop->set_tooltip_text(TTR("Pause/Stop Animation")); - hb->add_child(stop); + playback_container->add_child(stop); play = memnew(Button); play->set_theme_type_variation("FlatButton"); play->set_tooltip_text(TTR("Play Animation from Start")); - hb->add_child(play); + playback_container->add_child(play); play_from = memnew(Button); play_from->set_theme_type_variation("FlatButton"); play_from->set_tooltip_text(TTR("Play Animation")); - hb->add_child(play_from); + playback_container->add_child(play_from); frame = memnew(SpinBox); hb->add_child(frame); diff --git a/editor/plugins/sprite_frames_editor_plugin.cpp b/editor/plugins/sprite_frames_editor_plugin.cpp index 37d5b787eb9..168a3b3ac2b 100644 --- a/editor/plugins/sprite_frames_editor_plugin.cpp +++ b/editor/plugins/sprite_frames_editor_plugin.cpp @@ -1986,6 +1986,7 @@ SpriteFramesEditor::SpriteFramesEditor() { sub_vb->add_child(hfc); playback_container = memnew(HBoxContainer); + playback_container->set_layout_direction(LAYOUT_DIRECTION_LTR); hfc->add_child(playback_container); play_bw_from = memnew(Button); @@ -2013,7 +2014,7 @@ SpriteFramesEditor::SpriteFramesEditor() { play_from->set_tooltip_text(TTR("Play selected animation from current pos. (D)")); playback_container->add_child(play_from); - playback_container->add_child(memnew(VSeparator)); + hfc->add_child(memnew(VSeparator)); autoplay->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_autoplay_pressed)); autoplay->set_toggle_mode(true);