From 2a7fa46110aa3ae1283c1403c8618344690cd07e Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Sun, 15 Jun 2025 00:15:32 +0800 Subject: [PATCH] Fix root node auto translation settings affecting editor root --- scene/main/scene_tree.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scene/main/scene_tree.cpp b/scene/main/scene_tree.cpp index 543e0d9ee18..8216a28ec2d 100644 --- a/scene/main/scene_tree.cpp +++ b/scene/main/scene_tree.cpp @@ -2018,14 +2018,18 @@ SceneTree::SceneTree() { root = memnew(Window); root->set_min_size(Size2i(64, 64)); // Define a very small minimum window size to prevent bugs such as GH-37242. root->set_process_mode(Node::PROCESS_MODE_PAUSABLE); - root->set_auto_translate_mode(GLOBAL_GET("internationalization/rendering/root_node_auto_translate") ? Node::AUTO_TRANSLATE_MODE_ALWAYS : Node::AUTO_TRANSLATE_MODE_DISABLED); root->set_name("root"); - root->set_title(GLOBAL_GET("application/config/name")); if (Engine::get_singleton()->is_editor_hint()) { root->set_wrap_controls(true); + root->set_auto_translate_mode(Node::AUTO_TRANSLATE_MODE_ALWAYS); + } else { + root->set_auto_translate_mode(GLOBAL_GET("internationalization/rendering/root_node_auto_translate") ? Node::AUTO_TRANSLATE_MODE_ALWAYS : Node::AUTO_TRANSLATE_MODE_DISABLED); } + // Set after auto translate mode to avoid changing the displayed title back and forth. + root->set_title(GLOBAL_GET("application/config/name")); + #ifndef _3D_DISABLED if (root->get_world_3d().is_null()) { root->set_world_3d(Ref(memnew(World3D)));