Don't flip playback control buttons in RTL layout

This commit is contained in:
Haoyu Qiu 2024-10-16 16:13:38 +08:00
parent af77100e39
commit 9ed655d0eb
4 changed files with 13 additions and 16 deletions

View File

@ -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;
}

View File

@ -326,11 +326,7 @@ Error EditorExportPlatform::_save_zip_patch_file(void *p_userdata, const String
Ref<ImageTexture> EditorExportPlatform::get_option_icon(int p_index) const {
Ref<Theme> theme = EditorNode::get_singleton()->get_editor_theme();
ERR_FAIL_COND_V(theme.is_null(), Ref<ImageTexture>());
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 {

View File

@ -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);

View File

@ -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);