Skip to content

Commit 01d1f10

Browse files
committed
Emit filesystem_changed only once per frame
1 parent 61accf0 commit 01d1f10

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

editor/editor_file_system.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -2376,10 +2376,18 @@ void EditorFileSystem::update_files(const Vector<String> &p_script_paths) {
23762376
if (!is_scanning()) {
23772377
_process_update_pending();
23782378
}
2379-
call_deferred(SNAME("emit_signal"), "filesystem_changed"); // Update later
2379+
if (!filesystem_changed_queued) {
2380+
filesystem_changed_queued = true;
2381+
callable_mp(this, &EditorFileSystem::_notify_filesystem_changed).call_deferred();
2382+
}
23802383
}
23812384
}
23822385

2386+
void EditorFileSystem::_notify_filesystem_changed() {
2387+
emit_signal("filesystem_changed");
2388+
filesystem_changed_queued = false;
2389+
}
2390+
23832391
HashSet<String> EditorFileSystem::get_valid_extensions() const {
23842392
return valid_extensions;
23852393
}

editor/editor_file_system.h

+2
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ class EditorFileSystem : public Node {
180180
EditorFileSystemDirectory *new_filesystem = nullptr;
181181
ScannedDirectory *first_scan_root_dir = nullptr;
182182

183+
bool filesystem_changed_queued = false;
183184
bool scanning = false;
184185
bool importing = false;
185186
bool first_scan = true;
@@ -189,6 +190,7 @@ class EditorFileSystem : public Node {
189190
bool revalidate_import_files = false;
190191
int nb_files_total = 0;
191192

193+
void _notify_filesystem_changed();
192194
void _scan_filesystem();
193195
void _first_scan_filesystem();
194196
void _first_scan_process_scripts(const ScannedDirectory *p_scan_dir, List<String> &p_gdextension_extensions, HashSet<String> &p_existing_class_names, HashSet<String> &p_extensions);

0 commit comments

Comments
 (0)