diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2020-01-07 13:29:02 +0100 |
|---|---|---|
| committer | Rémi Verschelde <rverschelde@gmail.com> | 2020-01-07 14:25:56 +0100 |
| commit | 5011afcb6ad6a7f7eb37a2cb74f28985e70cbc20 (patch) | |
| tree | 337be6abf4964783cc3a47bdaf6345c4ed9e806e /main | |
| parent | 96fdb48edd49966485cc344a01eaaa74a2999d42 (diff) | |
| download | redot-engine-5011afcb6ad6a7f7eb37a2cb74f28985e70cbc20.tar.gz | |
Export: Improve usability of command line interface
I'm barely scratching the surface of the changes needed to make the
--export command line interface easy to use, but this should already
improve things somewhat.
- Streamline `can_export()` templates check in all platforms, checking
first for the presence of official templates, then of any defined
custom template, and reporting on the absence of any.
Shouldn't change the actual return value much which is still true if
either release or debug is usable - we might want to change that
eventually and better validate against the requested target.
- Fix discrepancy between platforms using `custom_package/debug` and
`custom_template/debug` (resp. `release`).
All now use `custom_template`, which will break compatibility for
`export_presets.cfg` with earlier projects (but is easy to fix).
- Use `can_export()` when attempting a command line export and report
the same errors that would be shown in the editor.
- Improve error reporting after a failed export attempt, handling
missing template and invalid path more gracefully.
- Cleanup of unused stuff in EditorNode around the export workflow.
- Improve --export documentation in --help a bit.
Fixes #16949 (at least many of the misunderstandings listed there).
Fixes #18470.
Diffstat (limited to 'main')
| -rw-r--r-- | main/main.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/main/main.cpp b/main/main.cpp index 2bcea5cb7d..308c53de13 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -286,8 +286,10 @@ void Main::print_help(const char *p_binary) { OS::get_singleton()->print(" -s, --script <script> Run a script.\n"); OS::get_singleton()->print(" --check-only Only parse for errors and quit (use with --script).\n"); #ifdef TOOLS_ENABLED - OS::get_singleton()->print(" --export <target> <path> Export the project using the given export target. Export only main pack if path ends with .pck or .zip. <path> is relative to the project directory.\n"); - OS::get_singleton()->print(" --export-debug <target> <path> Like --export, but use debug template.\n"); + OS::get_singleton()->print(" --export <preset> <path> Export the project using the given preset and matching release template. The preset name should match one defined in export_presets.cfg.\n"); + OS::get_singleton()->print(" <path> should be absolute or relative to the project directory, and include the filename for the binary (e.g. 'builds/game.exe').\n"); + OS::get_singleton()->print(" The target directory should exist. Only the data pack is exported if <path> ends with .pck or .zip.\n"); + OS::get_singleton()->print(" --export-debug <preset> <path> Same as --export, but using the debug template.\n"); OS::get_singleton()->print(" --doctool <path> Dump the engine API reference to the given <path> in XML format, merging if existing files are found.\n"); OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n"); OS::get_singleton()->print(" --build-solutions Build the scripting solutions (e.g. for C# projects).\n"); @@ -1513,11 +1515,11 @@ bool Main::start() { if (_export_preset != "") { if (game_path == "") { - String err = "Command line param "; + String err = "Command line parameter "; err += export_debug ? "--export-debug" : "--export"; err += " passed but no destination path given.\n"; err += "Please specify the binary's file path to export to. Aborting export."; - ERR_PRINT(err.utf8().get_data()); + ERR_PRINT(err); return false; } } @@ -1698,20 +1700,14 @@ bool Main::start() { } #ifdef TOOLS_ENABLED - EditorNode *editor_node = NULL; if (editor) { - editor_node = memnew(EditorNode); sml->get_root()->add_child(editor_node); - //root_node->set_editor(editor); - //startup editor - if (_export_preset != "") { - - editor_node->export_preset(_export_preset, game_path, export_debug, "", true); - game_path = ""; //no load anything + editor_node->export_preset(_export_preset, game_path, export_debug); + game_path = ""; // Do not load anything. } } #endif |
