Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions editor/settings/editor_autoload_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,31 +95,31 @@ 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;
}

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;
}

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;
}

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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
Loading