1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-05 12:10:55 +00:00

Disallow class names to be the same as global names

Also forbid autoloads to have the same name as global script class.
This commit is contained in:
George Marques
2021-09-13 10:51:29 -03:00
parent c7455d9d42
commit 2e5fa124f4
2 changed files with 20 additions and 1 deletions

View File

@@ -78,6 +78,14 @@ bool EditorAutoloadSettings::_autoload_name_is_valid(const String &p_name, Strin
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.");
}
return false;
}
for (int i = 0; i < Variant::VARIANT_MAX; i++) {
if (Variant::get_type_name(Variant::Type(i)) == p_name) {
if (r_error) {