Merge pull request #108992 from WhalesState/headless-import

Fix Editor crash during first scan in headless import mode.
This commit is contained in:
Thaddeus Crews
2025-07-27 10:28:28 -05:00
3 changed files with 4 additions and 8 deletions

View File

@ -950,6 +950,7 @@ void EditorData::clear_edited_scenes() {
}
}
edited_scene.clear();
SceneTree::get_singleton()->set_edited_scene_root(nullptr);
}
void EditorData::set_plugin_window_layout(Ref<ConfigFile> p_layout) {

View File

@ -5616,14 +5616,6 @@ void EditorNode::_editor_file_dialog_unregister(EditorFileDialog *p_dialog) {
Vector<EditorNodeInitCallback> 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", "First Scan");
EditorFileSystem::get_singleton()->scan();
return;
}
if (!waiting_for_first_scan) {
return;
}

View File

@ -1653,6 +1653,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
upwards = true;
} else if (arg == "--quit") { // Auto quit at the end of the first main loop iteration
quit_after = 1;
#ifdef TOOLS_ENABLED
wait_for_import = true;
#endif
} else if (arg == "--quit-after") { // Quit after the given number of iterations
if (N) {
quit_after = N->get().to_int();