From 95fbb2ecb2db566033104c9f4c4631839c3b16f4 Mon Sep 17 00:00:00 2001 From: clayjohn Date: Tue, 7 Nov 2023 10:46:56 +0100 Subject: [PATCH] Scan the filesystem in the first frame when using headless mode --- editor/editor_node.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 6fe23720fbe..c8ba1cfe5e7 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -4633,6 +4633,14 @@ void EditorNode::_editor_file_dialog_unregister(EditorFileDialog *p_dialog) { Vector EditorNode::_init_callbacks; void EditorNode::_begin_first_scan() { + // In headless mode, scan right away. + // This allows users to continue using `godot --headless --editor --quit` to prepare a project. + if (!DisplayServer::get_singleton()->window_can_draw()) { + OS::get_singleton()->benchmark_begin_measure("editor_scan_and_import"); + EditorFileSystem::get_singleton()->scan(); + return; + } + if (!waiting_for_first_scan) { return; }