Merge pull request #105835 from bruvzg/edited_scene_direction

Improve edited scene layout direction detection.
This commit is contained in:
Thaddeus Crews 2025-07-09 11:33:11 -05:00
commit e748514112
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC
5 changed files with 14 additions and 2 deletions

View file

@ -381,6 +381,10 @@ String TranslationServer::get_locale() const {
return locale;
}
void TranslationServer::set_fallback_locale(const String &p_locale) {
fallback = p_locale;
}
String TranslationServer::get_fallback_locale() const {
return fallback;
}

View file

@ -99,6 +99,7 @@ public:
void set_locale(const String &p_locale);
String get_locale() const;
void set_fallback_locale(const String &p_locale);
String get_fallback_locale() const;
Ref<Translation> get_translation_object(const String &p_locale);

View file

@ -450,6 +450,11 @@ void EditorNode::_update_from_settings() {
Viewport::DefaultCanvasItemTextureRepeat tr = (Viewport::DefaultCanvasItemTextureRepeat)current_repeat;
scene_root->set_default_canvas_item_texture_repeat(tr);
}
String current_fallback_locale = GLOBAL_GET("internationalization/locale/fallback");
if (current_fallback_locale != TranslationServer::get_singleton()->get_fallback_locale()) {
TranslationServer::get_singleton()->set_fallback_locale(current_fallback_locale);
scene_root->propagate_notification(Control::NOTIFICATION_LAYOUT_DIRECTION_CHANGED);
}
RS::DOFBokehShape dof_shape = RS::DOFBokehShape(int(GLOBAL_GET("rendering/camera/depth_of_field/depth_of_field_bokeh_shape")));
RS::get_singleton()->camera_attributes_set_dof_blur_bokeh_shape(dof_shape);

View file

@ -3519,7 +3519,8 @@ bool Control::is_layout_rtl() const {
String locale = OS::get_singleton()->get_locale();
data.is_rtl = TS->is_locale_right_to_left(locale);
} else {
String locale = TranslationServer::get_singleton()->get_tool_locale();
const Ref<Translation> &t = TranslationServer::get_singleton()->get_translation_object(TranslationServer::get_singleton()->get_locale());
String locale = t.is_valid() ? t->get_locale() : TranslationServer::get_singleton()->get_fallback_locale();
data.is_rtl = TS->is_locale_right_to_left(locale);
}
return data.is_rtl;

View file

@ -2883,7 +2883,8 @@ bool Window::is_layout_rtl() const {
String locale = OS::get_singleton()->get_locale();
return TS->is_locale_right_to_left(locale);
} else {
String locale = TranslationServer::get_singleton()->get_tool_locale();
const Ref<Translation> &t = TranslationServer::get_singleton()->get_translation_object(TranslationServer::get_singleton()->get_locale());
String locale = t.is_valid() ? t->get_locale() : TranslationServer::get_singleton()->get_fallback_locale();
return TS->is_locale_right_to_left(locale);
}
}