mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
Fix headless import always emits errors
(cherry picked from commit dba92c9354
)
This commit is contained in:
parent
b3caec15f5
commit
ccb325f0bc
2 changed files with 12 additions and 7 deletions
|
@ -1207,7 +1207,7 @@ void EditorNode::_sources_changed(bool p_exist) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start preview thread now that it's safe.
|
// Start preview thread now that it's safe.
|
||||||
if (!singleton->cmdline_export_mode) {
|
if (!singleton->cmdline_mode) {
|
||||||
EditorResourcePreview::get_singleton()->start();
|
EditorResourcePreview::get_singleton()->start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1807,7 +1807,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) {
|
||||||
save_scene_progress->step(TTR("Saving Scene"), 4);
|
save_scene_progress->step(TTR("Saving Scene"), 4);
|
||||||
_save_scene(p_file, p_idx);
|
_save_scene(p_file, p_idx);
|
||||||
|
|
||||||
if (!singleton->cmdline_export_mode) {
|
if (!singleton->cmdline_mode) {
|
||||||
EditorResourcePreview::get_singleton()->check_for_invalidation(p_file);
|
EditorResourcePreview::get_singleton()->check_for_invalidation(p_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4944,7 +4944,7 @@ bool EditorNode::is_object_of_custom_type(const Object *p_object, const StringNa
|
||||||
void EditorNode::progress_add_task(const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) {
|
void EditorNode::progress_add_task(const String &p_task, const String &p_label, int p_steps, bool p_can_cancel) {
|
||||||
if (!singleton) {
|
if (!singleton) {
|
||||||
return;
|
return;
|
||||||
} else if (singleton->cmdline_export_mode) {
|
} else if (singleton->cmdline_mode) {
|
||||||
print_line(p_task + ": begin: " + p_label + " steps: " + itos(p_steps));
|
print_line(p_task + ": begin: " + p_label + " steps: " + itos(p_steps));
|
||||||
} else if (singleton->progress_dialog) {
|
} else if (singleton->progress_dialog) {
|
||||||
singleton->progress_dialog->add_task(p_task, p_label, p_steps, p_can_cancel);
|
singleton->progress_dialog->add_task(p_task, p_label, p_steps, p_can_cancel);
|
||||||
|
@ -4954,7 +4954,7 @@ void EditorNode::progress_add_task(const String &p_task, const String &p_label,
|
||||||
bool EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_refresh) {
|
bool EditorNode::progress_task_step(const String &p_task, const String &p_state, int p_step, bool p_force_refresh) {
|
||||||
if (!singleton) {
|
if (!singleton) {
|
||||||
return false;
|
return false;
|
||||||
} else if (singleton->cmdline_export_mode) {
|
} else if (singleton->cmdline_mode) {
|
||||||
print_line("\t" + p_task + ": step " + itos(p_step) + ": " + p_state);
|
print_line("\t" + p_task + ": step " + itos(p_step) + ": " + p_state);
|
||||||
return false;
|
return false;
|
||||||
} else if (singleton->progress_dialog) {
|
} else if (singleton->progress_dialog) {
|
||||||
|
@ -4967,7 +4967,7 @@ bool EditorNode::progress_task_step(const String &p_task, const String &p_state,
|
||||||
void EditorNode::progress_end_task(const String &p_task) {
|
void EditorNode::progress_end_task(const String &p_task) {
|
||||||
if (!singleton) {
|
if (!singleton) {
|
||||||
return;
|
return;
|
||||||
} else if (singleton->cmdline_export_mode) {
|
} else if (singleton->cmdline_mode) {
|
||||||
print_line(p_task + ": end");
|
print_line(p_task + ": end");
|
||||||
} else if (singleton->progress_dialog) {
|
} else if (singleton->progress_dialog) {
|
||||||
singleton->progress_dialog->end_task(p_task);
|
singleton->progress_dialog->end_task(p_task);
|
||||||
|
@ -5220,7 +5220,7 @@ Error EditorNode::export_preset(const String &p_preset, const String &p_path, bo
|
||||||
export_defer.android_build_template = p_android_build_template;
|
export_defer.android_build_template = p_android_build_template;
|
||||||
export_defer.patch = p_patch;
|
export_defer.patch = p_patch;
|
||||||
export_defer.patches = p_patches;
|
export_defer.patches = p_patches;
|
||||||
cmdline_export_mode = true;
|
cmdline_mode = true;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6848,6 +6848,11 @@ EditorNode::EditorNode() {
|
||||||
DEV_ASSERT(!singleton);
|
DEV_ASSERT(!singleton);
|
||||||
singleton = this;
|
singleton = this;
|
||||||
|
|
||||||
|
// Detecting headless mode, that means the editor is running in command line.
|
||||||
|
if (!DisplayServer::get_singleton()->window_can_draw()) {
|
||||||
|
cmdline_mode = true;
|
||||||
|
}
|
||||||
|
|
||||||
Resource::_get_local_scene_func = _resource_get_edited_scene;
|
Resource::_get_local_scene_func = _resource_get_edited_scene;
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
@ -419,7 +419,7 @@ private:
|
||||||
bool script_distraction_free = false;
|
bool script_distraction_free = false;
|
||||||
|
|
||||||
bool changing_scene = false;
|
bool changing_scene = false;
|
||||||
bool cmdline_export_mode = false;
|
bool cmdline_mode = false;
|
||||||
bool convert_old = false;
|
bool convert_old = false;
|
||||||
bool immediate_dialog_confirmed = false;
|
bool immediate_dialog_confirmed = false;
|
||||||
bool opening_prev = false;
|
bool opening_prev = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue