mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Merge pull request #105835 from bruvzg/edited_scene_direction
Improve edited scene layout direction detection.
This commit is contained in:
commit
e748514112
5 changed files with 14 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue