From d3fadcb5fb0fc4c69aa14f332f71fcf411a3bee7 Mon Sep 17 00:00:00 2001 From: Kamil Tokarski Date: Thu, 4 Sep 2025 20:42:07 +0200 Subject: [PATCH] Add name info to EditorAutoloadSettings invalid name message --- editor/settings/editor_autoload_settings.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/editor/settings/editor_autoload_settings.cpp b/editor/settings/editor_autoload_settings.cpp index 66e1c5d6540..37014cecd12 100644 --- a/editor/settings/editor_autoload_settings.cpp +++ b/editor/settings/editor_autoload_settings.cpp @@ -95,7 +95,7 @@ void EditorAutoloadSettings::_notification(int p_what) { bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, String *r_error) { if (!p_name.is_valid_unicode_identifier()) { if (r_error) { - *r_error = TTR("Invalid name.") + " " + TTR("Must be a valid Unicode identifier."); + *r_error = TTR("Must be a valid Unicode identifier."); } return false; @@ -103,7 +103,7 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin if (ClassDB::class_exists(p_name)) { if (r_error) { - *r_error = TTR("Invalid name.") + " " + TTR("Must not collide with an existing engine class name."); + *r_error = TTR("Must not collide with an existing engine class name."); } return false; @@ -111,7 +111,7 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin if (ScriptServer::is_global_class(p_name)) { if (r_error) { - *r_error = TTR("Invalid name.") + "\n" + TTR("Must not collide with an existing global script class name."); + *r_error = TTR("Must not collide with an existing global script class name."); } return false; @@ -119,7 +119,7 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin if (Variant::get_type_by_name(p_name) < Variant::VARIANT_MAX) { if (r_error) { - *r_error = TTR("Invalid name.") + " " + TTR("Must not collide with an existing built-in type name."); + *r_error = TTR("Must not collide with an existing built-in type name."); } return false; @@ -128,7 +128,7 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin for (int i = 0; i < CoreConstants::get_global_constant_count(); i++) { if (CoreConstants::get_global_constant_name(i) == p_name) { if (r_error) { - *r_error = TTR("Invalid name.") + " " + TTR("Must not collide with an existing global constant name."); + *r_error = TTR("Must not collide with an existing global constant name."); } return false; @@ -139,7 +139,7 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin for (const String &keyword : ScriptServer::get_language(i)->get_reserved_words()) { if (keyword == p_name) { if (r_error) { - *r_error = TTR("Invalid name.") + " " + TTR("Keyword cannot be used as an Autoload name."); + *r_error = TTR("Keyword cannot be used as an Autoload name."); } return false; @@ -780,7 +780,7 @@ bool EditorAutoloadSettings::autoload_add(const String &p_name, const String &p_ String error; if (!_autoload_name_is_valid(name, &error)) { - EditorNode::get_singleton()->show_warning(TTR("Can't add Autoload:") + "\n" + error); + EditorNode::get_singleton()->show_warning(TTR("Can't add Autoload:") + "\n" + vformat(TTR("%s is an invalid name."), p_name) + " " + error); return false; }