diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-01-07 14:27:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-07 14:27:03 +0100 |
commit | 25e942d64fa9ae5864e68bc0b27d5f3525a91771 (patch) | |
tree | d3b7ff625f68f488f88763f49a0bb8f8e8aee9cb | |
parent | a2fe9faa64ea4788bfbea73cdbd7176852fa3759 (diff) | |
parent | ab12a5cf8e9fb6b12cfeb4a0a0e13671fca9ede0 (diff) |
Merge pull request #15438 from endragor/export-after-import
Perform export after import is fully complete
-rw-r--r-- | editor/editor_node.cpp | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 70047bc60c..f480883867 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -393,42 +393,6 @@ void EditorNode::_fs_changed() { E->get()->invalidate(); } - if (export_defer.preset != "") { - Ref<EditorExportPreset> preset; - for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); ++i) { - preset = EditorExport::get_singleton()->get_export_preset(i); - if (preset->get_name() == export_defer.preset) { - break; - } - preset.unref(); - } - if (preset.is_null()) { - String err = "Unknown export preset: " + export_defer.preset; - ERR_PRINT(err.utf8().get_data()); - } else { - Ref<EditorExportPlatform> platform = preset->get_platform(); - if (platform.is_null()) { - String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform."; - ERR_PRINT(err.utf8().get_data()); - } else { - // ensures export_project does not loop infinitely, because notifications may - // come during the export - export_defer.preset = ""; - if (!preset->is_runnable() && (export_defer.path.ends_with(".pck") || export_defer.path.ends_with(".zip"))) { - if (export_defer.path.ends_with(".zip")) { - platform->save_zip(preset, export_defer.path); - } else if (export_defer.path.ends_with(".pck")) { - platform->save_pack(preset, export_defer.path); - } - } else { - platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0); - } - } - } - - get_tree()->quit(); - } - { //reload changed resources List<Ref<Resource> > changed; @@ -465,6 +429,42 @@ void EditorNode::_fs_changed() { } _mark_unsaved_scenes(); + + if (export_defer.preset != "" && !EditorFileSystem::get_singleton()->is_scanning()) { + Ref<EditorExportPreset> preset; + for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); ++i) { + preset = EditorExport::get_singleton()->get_export_preset(i); + if (preset->get_name() == export_defer.preset) { + break; + } + preset.unref(); + } + if (preset.is_null()) { + String err = "Unknown export preset: " + export_defer.preset; + ERR_PRINT(err.utf8().get_data()); + } else { + Ref<EditorExportPlatform> platform = preset->get_platform(); + if (platform.is_null()) { + String err = "Preset \"" + export_defer.preset + "\" doesn't have a platform."; + ERR_PRINT(err.utf8().get_data()); + } else { + // ensures export_project does not loop infinitely, because notifications may + // come during the export + export_defer.preset = ""; + if (!preset->is_runnable() && (export_defer.path.ends_with(".pck") || export_defer.path.ends_with(".zip"))) { + if (export_defer.path.ends_with(".zip")) { + platform->save_zip(preset, export_defer.path); + } else if (export_defer.path.ends_with(".pck")) { + platform->save_pack(preset, export_defer.path); + } + } else { + platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0); + } + } + } + + get_tree()->quit(); + } } void EditorNode::_resources_reimported(const Vector<String> &p_resources) { |