Merge pull request #98222 from timothyqiu/media-control-rtl

Don't flip playback control buttons in RTL layout
This commit is contained in:
Clay John 2024-10-17 16:58:23 -07:00 committed by GitHub
commit 1435247de0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
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_LAYOUT_DIRECTION_CHANGED:
case NOTIFICATION_THEME_CHANGED: case NOTIFICATION_THEME_CHANGED:
case NOTIFICATION_TRANSLATION_CHANGED: { case NOTIFICATION_TRANSLATION_CHANGED: {
if (is_layout_rtl()) { activate->set_icon(get_editor_theme_icon(SNAME("Play")));
activate->set_icon(get_editor_theme_icon(SNAME("PlayBackwards")));
} else {
activate->set_icon(get_editor_theme_icon(SNAME("Play")));
}
clear_button->set_icon(get_editor_theme_icon(SNAME("Clear"))); clear_button->set_icon(get_editor_theme_icon(SNAME("Clear")));
} break; } 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<ImageTexture> EditorExportPlatform::get_option_icon(int p_index) const {
Ref<Theme> theme = EditorNode::get_singleton()->get_editor_theme(); Ref<Theme> theme = EditorNode::get_singleton()->get_editor_theme();
ERR_FAIL_COND_V(theme.is_null(), Ref<ImageTexture>()); ERR_FAIL_COND_V(theme.is_null(), Ref<ImageTexture>());
if (EditorNode::get_singleton()->get_gui_base()->is_layout_rtl()) { return theme->get_icon(SNAME("Play"), EditorStringName(EditorIcons));
return theme->get_icon(SNAME("PlayBackwards"), EditorStringName(EditorIcons));
} else {
return theme->get_icon(SNAME("Play"), EditorStringName(EditorIcons));
}
} }
String EditorExportPlatform::find_export_template(const String &template_file_name, String *err) const { 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); HBoxContainer *hb = memnew(HBoxContainer);
add_child(hb); 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 = memnew(Button);
play_bw_from->set_theme_type_variation("FlatButton"); play_bw_from->set_theme_type_variation("FlatButton");
play_bw_from->set_tooltip_text(TTR("Play Animation Backwards")); 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 = memnew(Button);
play_bw->set_theme_type_variation("FlatButton"); play_bw->set_theme_type_variation("FlatButton");
play_bw->set_tooltip_text(TTR("Play Animation Backwards from End")); 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 = memnew(Button);
stop->set_theme_type_variation("FlatButton"); stop->set_theme_type_variation("FlatButton");
stop->set_tooltip_text(TTR("Pause/Stop Animation")); stop->set_tooltip_text(TTR("Pause/Stop Animation"));
hb->add_child(stop); playback_container->add_child(stop);
play = memnew(Button); play = memnew(Button);
play->set_theme_type_variation("FlatButton"); play->set_theme_type_variation("FlatButton");
play->set_tooltip_text(TTR("Play Animation from Start")); play->set_tooltip_text(TTR("Play Animation from Start"));
hb->add_child(play); playback_container->add_child(play);
play_from = memnew(Button); play_from = memnew(Button);
play_from->set_theme_type_variation("FlatButton"); play_from->set_theme_type_variation("FlatButton");
play_from->set_tooltip_text(TTR("Play Animation")); play_from->set_tooltip_text(TTR("Play Animation"));
hb->add_child(play_from); playback_container->add_child(play_from);
frame = memnew(SpinBox); frame = memnew(SpinBox);
hb->add_child(frame); hb->add_child(frame);

View file

@ -1986,6 +1986,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
sub_vb->add_child(hfc); sub_vb->add_child(hfc);
playback_container = memnew(HBoxContainer); playback_container = memnew(HBoxContainer);
playback_container->set_layout_direction(LAYOUT_DIRECTION_LTR);
hfc->add_child(playback_container); hfc->add_child(playback_container);
play_bw_from = memnew(Button); play_bw_from = memnew(Button);
@ -2013,7 +2014,7 @@ SpriteFramesEditor::SpriteFramesEditor() {
play_from->set_tooltip_text(TTR("Play selected animation from current pos. (D)")); play_from->set_tooltip_text(TTR("Play selected animation from current pos. (D)"));
playback_container->add_child(play_from); 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->connect(SceneStringName(pressed), callable_mp(this, &SpriteFramesEditor::_autoplay_pressed));
autoplay->set_toggle_mode(true); autoplay->set_toggle_mode(true);