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

Skip unnecessary updates to scene groups and scripts

This commit is contained in:
kobewi
2024-05-15 16:26:33 +02:00
parent ce00392fc3
commit f3b0f7b9e2
2 changed files with 16 additions and 11 deletions

View File

@@ -297,20 +297,20 @@ void EditorFileSystem::_scan_filesystem() {
} }
} }
String update_cache = EditorPaths::get_singleton()->get_project_settings_dir().path_join("filesystem_update4"); const String update_cache = EditorPaths::get_singleton()->get_project_settings_dir().path_join("filesystem_update4");
if (first_scan && FileAccess::exists(update_cache)) {
if (FileAccess::exists(update_cache)) {
{ {
Ref<FileAccess> f2 = FileAccess::open(update_cache, FileAccess::READ); Ref<FileAccess> f2 = FileAccess::open(update_cache, FileAccess::READ);
String l = f2->get_line().strip_edges(); String l = f2->get_line().strip_edges();
while (!l.is_empty()) { while (!l.is_empty()) {
file_cache.erase(l); //erase cache for this, so it gets updated dep_update_list.insert(l);
file_cache.erase(l); // Erase cache for this, so it gets updated.
l = f2->get_line().strip_edges(); l = f2->get_line().strip_edges();
} }
} }
Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
d->remove(update_cache); //bye bye update cache d->remove(update_cache); // Bye bye update cache.
} }
EditorProgressBG scan_progress("efs", "ScanFS", 1000); EditorProgressBG scan_progress("efs", "ScanFS", 1000);
@@ -326,6 +326,7 @@ void EditorFileSystem::_scan_filesystem() {
Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_RESOURCES); Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
d->change_dir("res://"); d->change_dir("res://");
_scan_new_dir(new_filesystem, d, sp); _scan_new_dir(new_filesystem, d, sp);
dep_update_list.clear();
file_cache.clear(); //clear caches, no longer needed file_cache.clear(); //clear caches, no longer needed
@@ -946,6 +947,8 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, Ref<DirAc
fi->import_modified_time = 0; fi->import_modified_time = 0;
fi->import_valid = true; fi->import_valid = true;
// Files in dep_update_list are forced for rescan to update dependencies. They don't need other updates.
if (!dep_update_list.has(path)) {
if (ClassDB::is_parent_class(fi->type, SNAME("Script"))) { if (ClassDB::is_parent_class(fi->type, SNAME("Script"))) {
_queue_update_script_class(path); _queue_update_script_class(path);
} }
@@ -954,6 +957,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, Ref<DirAc
} }
} }
} }
}
if (fi->uid != ResourceUID::INVALID_ID) { if (fi->uid != ResourceUID::INVALID_ID) {
if (ResourceUID::get_singleton()->has_id(fi->uid)) { if (ResourceUID::get_singleton()->has_id(fi->uid)) {

View File

@@ -197,6 +197,7 @@ class EditorFileSystem : public Node {
}; };
HashMap<String, FileCache> file_cache; HashMap<String, FileCache> file_cache;
HashSet<String> dep_update_list;
struct ScanProgress { struct ScanProgress {
float low = 0; float low = 0;