diff options
author | Ruslan Mustakov <r.mustakov@gmail.com> | 2017-08-14 20:15:06 +0700 |
---|---|---|
committer | Ruslan Mustakov <r.mustakov@gmail.com> | 2017-08-14 20:15:06 +0700 |
commit | ad457976fcfc88c90fb12aa85843ef40119764e3 (patch) | |
tree | 0d33b2015c9425b30f73c3365ffb934211dfb2ba /editor | |
parent | 9575dbdf788e8a5154b3ec2f66913e731ac02850 (diff) |
Enable command-line export
The syntax is identical to what it was in 2.1, but now you specify
preset name instead of platform name.
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_node.cpp | 28 | ||||
-rw-r--r-- | editor/editor_node.h | 4 |
2 files changed, 25 insertions, 7 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 730ba3cacc..1dce6f167a 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -364,10 +364,28 @@ void EditorNode::_fs_changed() { E->get()->invalidate(); } - if (export_defer.platform != "") { + 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; + } + } + 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 { + platform->export_project(preset, export_defer.debug, export_defer.path, /*p_flags*/ 0); + } + } - //project_export_settings->export_platform(export_defer.platform,export_defer.path,export_defer.debug,export_defer.password,true); - export_defer.platform = ""; + export_defer.preset = ""; } { @@ -3844,9 +3862,9 @@ void EditorNode::_editor_file_dialog_unregister(EditorFileDialog *p_dialog) { Vector<EditorNodeInitCallback> EditorNode::_init_callbacks; -Error EditorNode::export_platform(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after) { +Error EditorNode::export_preset(const String &preset, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after) { - export_defer.platform = p_platform; + export_defer.preset = preset; export_defer.path = p_path; export_defer.debug = p_debug; export_defer.password = p_password; diff --git a/editor/editor_node.h b/editor/editor_node.h index a440aaa1e6..8fd9055273 100644 --- a/editor/editor_node.h +++ b/editor/editor_node.h @@ -539,7 +539,7 @@ private: } struct ExportDefer { - String platform; + String preset; String path; bool debug; String password; @@ -742,7 +742,7 @@ public: void show_warning(const String &p_text, const String &p_title = "Warning!"); - Error export_platform(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after = false); + Error export_preset(const String &p_platform, const String &p_path, bool p_debug, const String &p_password, bool p_quit_after = false); static void register_editor_types(); static void unregister_editor_types(); |