diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 50595ec7a693..cd02482bc758 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -2376,10 +2376,18 @@ void EditorFileSystem::update_files(const Vector &p_script_paths) { if (!is_scanning()) { _process_update_pending(); } - call_deferred(SNAME("emit_signal"), "filesystem_changed"); // Update later + if (!filesystem_changed_queued) { + filesystem_changed_queued = true; + callable_mp(this, &EditorFileSystem::_notify_filesystem_changed).call_deferred(); + } } } +void EditorFileSystem::_notify_filesystem_changed() { + emit_signal("filesystem_changed"); + filesystem_changed_queued = false; +} + HashSet EditorFileSystem::get_valid_extensions() const { return valid_extensions; } diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h index 1479c0e49ee3..11573ef0d75e 100644 --- a/editor/editor_file_system.h +++ b/editor/editor_file_system.h @@ -180,6 +180,7 @@ class EditorFileSystem : public Node { EditorFileSystemDirectory *new_filesystem = nullptr; ScannedDirectory *first_scan_root_dir = nullptr; + bool filesystem_changed_queued = false; bool scanning = false; bool importing = false; bool first_scan = true; @@ -189,6 +190,7 @@ class EditorFileSystem : public Node { bool revalidate_import_files = false; int nb_files_total = 0; + void _notify_filesystem_changed(); void _scan_filesystem(); void _first_scan_filesystem(); void _first_scan_process_scripts(const ScannedDirectory *p_scan_dir, List &p_gdextension_extensions, HashSet &p_existing_class_names, HashSet &p_extensions);