Skip to content

Commit 1a6da7b

Browse files
committed
Merge pull request #108992 from WhalesState/headless-import
Fix Editor crash during first scan in headless import mode.
2 parents 0dd9178 + aa086fa commit 1a6da7b

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

editor/editor_data.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -950,6 +950,7 @@ void EditorData::clear_edited_scenes() {
950950
}
951951
}
952952
edited_scene.clear();
953+
SceneTree::get_singleton()->set_edited_scene_root(nullptr);
953954
}
954955

955956
void EditorData::set_plugin_window_layout(Ref<ConfigFile> p_layout) {

editor/editor_node.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5616,14 +5616,6 @@ void EditorNode::_editor_file_dialog_unregister(EditorFileDialog *p_dialog) {
56165616
Vector<EditorNodeInitCallback> EditorNode::_init_callbacks;
56175617

56185618
void EditorNode::_begin_first_scan() {
5619-
// In headless mode, scan right away.
5620-
// This allows users to continue using `godot --headless --editor --quit` to prepare a project.
5621-
if (!DisplayServer::get_singleton()->window_can_draw()) {
5622-
OS::get_singleton()->benchmark_begin_measure("Editor", "First Scan");
5623-
EditorFileSystem::get_singleton()->scan();
5624-
return;
5625-
}
5626-
56275619
if (!waiting_for_first_scan) {
56285620
return;
56295621
}

main/main.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1653,6 +1653,9 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
16531653
upwards = true;
16541654
} else if (arg == "--quit") { // Auto quit at the end of the first main loop iteration
16551655
quit_after = 1;
1656+
#ifdef TOOLS_ENABLED
1657+
wait_for_import = true;
1658+
#endif
16561659
} else if (arg == "--quit-after") { // Quit after the given number of iterations
16571660
if (N) {
16581661
quit_after = N->get().to_int();

0 commit comments

Comments
 (0)