1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Fix Global Class names cache not saved with upgrade to 4.4.

Co-authored-by: Hilderin <81109165+Hilderin@users.noreply.github.com>
This commit is contained in:
Agustín Marsero
2025-02-10 19:44:36 -05:00
parent f418603522
commit 2ba64a57c5
7 changed files with 50 additions and 40 deletions

View File

@@ -319,7 +319,12 @@ void EditorFileSystem::_first_scan_filesystem() {
_first_scan_process_scripts(first_scan_root_dir, gdextension_extensions, existing_class_names, extensions);
// Removing invalid global class to prevent having invalid paths in ScriptServer.
_remove_invalid_global_class_names(existing_class_names);
bool save_scripts = _remove_invalid_global_class_names(existing_class_names);
// If a global class is found or removed, we sync global_script_class_cache.cfg with the ScriptServer
if (!existing_class_names.is_empty() || save_scripts) {
EditorNode::get_editor_data().script_class_save_global_classes();
}
// Processing extensions to add new extensions or remove invalid ones.
// Important to do it in the first scan so custom types, new class names, custom importers, etc...
@@ -1618,7 +1623,7 @@ void EditorFileSystem::_thread_func_sources(void *_userdata) {
efs->scanning_changes_done.set();
}
void EditorFileSystem::_remove_invalid_global_class_names(const HashSet<String> &p_existing_class_names) {
bool EditorFileSystem::_remove_invalid_global_class_names(const HashSet<String> &p_existing_class_names) {
List<StringName> global_classes;
bool must_save = false;
ScriptServer::get_global_class_list(&global_classes);
@@ -1628,9 +1633,7 @@ void EditorFileSystem::_remove_invalid_global_class_names(const HashSet<String>
must_save = true;
}
}
if (must_save) {
ScriptServer::save_global_classes();
}
return must_save;
}
String EditorFileSystem::_get_file_by_class_name(EditorFileSystemDirectory *p_dir, const String &p_class_name, EditorFileSystemDirectory::FileInfo *&r_file_info) {
@@ -2043,6 +2046,7 @@ EditorFileSystem::ScriptClassInfo EditorFileSystem::_get_global_script_class(con
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
if (ScriptServer::get_language(i)->handles_global_class_type(p_type)) {
info.name = ScriptServer::get_language(i)->get_global_class_name(p_path, &info.extends, &info.icon_path, &info.is_abstract, &info.is_tool);
break;
}
}
return info;
@@ -2130,8 +2134,7 @@ void EditorFileSystem::_update_script_classes() {
update_script_paths.clear();
}
ScriptServer::save_global_classes();
EditorNode::get_editor_data().script_class_save_icon_paths();
EditorNode::get_editor_data().script_class_save_global_classes();
emit_signal("script_classes_updated");