Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip unnecessary updates to scene groups and scripts #91980

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
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
26 changes: 15 additions & 11 deletions editor/editor_file_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,20 +297,20 @@ void EditorFileSystem::_scan_filesystem() {
}
}

String update_cache = EditorPaths::get_singleton()->get_project_settings_dir().path_join("filesystem_update4");

if (FileAccess::exists(update_cache)) {
const String update_cache = EditorPaths::get_singleton()->get_project_settings_dir().path_join("filesystem_update4");
if (first_scan && FileAccess::exists(update_cache)) {
{
Ref<FileAccess> f2 = FileAccess::open(update_cache, FileAccess::READ);
String l = f2->get_line().strip_edges();
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();
}
}

Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
d->remove(update_cache); //bye bye update cache
Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
d->remove(update_cache); // Bye bye update cache.
}

EditorProgressBG scan_progress("efs", "ScanFS", 1000);
Expand All @@ -326,6 +326,7 @@ void EditorFileSystem::_scan_filesystem() {
Ref<DirAccess> d = DirAccess::create(DirAccess::ACCESS_RESOURCES);
d->change_dir("res://");
_scan_new_dir(new_filesystem, d, sp);
dep_update_list.clear();

file_cache.clear(); //clear caches, no longer needed

Expand Down Expand Up @@ -946,11 +947,14 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, Ref<DirAc
fi->import_modified_time = 0;
fi->import_valid = true;

if (ClassDB::is_parent_class(fi->type, SNAME("Script"))) {
_queue_update_script_class(path);
}
if (fi->type == SNAME("PackedScene")) {
_queue_update_scene_groups(path);
// 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"))) {
_queue_update_script_class(path);
}
if (fi->type == SNAME("PackedScene")) {
_queue_update_scene_groups(path);
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions editor/editor_file_system.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ class EditorFileSystem : public Node {
};

HashMap<String, FileCache> file_cache;
HashSet<String> dep_update_list;

struct ScanProgress {
float low = 0;
Expand Down
Loading