summaryrefslogtreecommitdiffstats
path: root/editor/plugins/editor_plugin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/plugins/editor_plugin.cpp')
-rw-r--r--editor/plugins/editor_plugin.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/editor/plugins/editor_plugin.cpp b/editor/plugins/editor_plugin.cpp
index 005407e188..d9f60e155d 100644
--- a/editor/plugins/editor_plugin.cpp
+++ b/editor/plugins/editor_plugin.cpp
@@ -414,13 +414,19 @@ void EditorPlugin::remove_translation_parser_plugin(const Ref<EditorTranslationP
void EditorPlugin::add_import_plugin(const Ref<EditorImportPlugin> &p_importer, bool p_first_priority) {
ERR_FAIL_COND(!p_importer.is_valid());
ResourceFormatImporter::get_singleton()->add_importer(p_importer, p_first_priority);
- callable_mp(EditorFileSystem::get_singleton(), &EditorFileSystem::scan).call_deferred();
+ // Plugins are now loaded during the first scan. It's important not to start another scan,
+ // even a deferred one, as it would cause a scan during a scan at the next main thread iteration.
+ if (!EditorFileSystem::get_singleton()->doing_first_scan()) {
+ callable_mp(EditorFileSystem::get_singleton(), &EditorFileSystem::scan).call_deferred();
+ }
}
void EditorPlugin::remove_import_plugin(const Ref<EditorImportPlugin> &p_importer) {
ERR_FAIL_COND(!p_importer.is_valid());
ResourceFormatImporter::get_singleton()->remove_importer(p_importer);
- if (!EditorNode::get_singleton()->is_exiting()) {
+ // Plugins are now loaded during the first scan. It's important not to start another scan,
+ // even a deferred one, as it would cause a scan during a scan at the next main thread iteration.
+ if (!EditorNode::get_singleton()->is_exiting() && !EditorFileSystem::get_singleton()->doing_first_scan()) {
callable_mp(EditorFileSystem::get_singleton(), &EditorFileSystem::scan).call_deferred();
}
}