mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 07:53:26 +00:00
Merge pull request #110259 from ktxyz/add-name-to-invalid-name-error-output
Add name info to EditorAutoloadSettings invalid name message
This commit is contained in:
commit
2db6704576
1 changed files with 7 additions and 7 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue