diff --git a/doc/classes/EditorExportPlatform.xml b/doc/classes/EditorExportPlatform.xml
index 0e5de79b25d..d4084e84a0a 100644
--- a/doc/classes/EditorExportPlatform.xml
+++ b/doc/classes/EditorExportPlatform.xml
@@ -11,11 +11,217 @@
$DOCS_URL/tutorials/platform/consoles.html
+
+
+
+
+
+
+ Adds a message to the export log that will be displayed when exporting ends.
+
+
+
+
+
+ Clears the export log.
+
+
+
+
+
+ Create a new preset for this platform.
+
+
+
+
+
+
+
+
+
+ Creates a PCK archive at [param path] for the specified [param preset].
+
+
+
+
+
+
+
+
+
+ Creates a full project at [param path] for the specified [param preset].
+
+
+
+
+
+
+
+
+
+ Exports project files for the specified preset. This method can be used to implement custom export format, other than PCK and ZIP. One of the callbacks is called for each exported file.
+ [param save_cb] is called for all exported files and have the following arguments: [code]file_path: String[/code], [code]file_data: PackedByteArray[/code], [code]file_index: int[/code], [code]file_count: int[/code], [code]encryption_include_filters: PackedStringArray[/code], [code]encryption_exclude_filters: PackedStringArray[/code], [code]encryption_key: PackedByteArray[/code].
+ [param shared_cb] is called for exported native shared/static libraries and have the following arguments: [code]file_path: String[/code], [code]tags: PackedStringArray[/code], [code]target_folder: String[/code].
+ [b]Note:[/b] [code]file_index[/code] and [code]file_count[/code] are intended for progress tracking only and aren't necesserely unique and precise.
+
+
+
+
+
+
+
+
+
+ Create a ZIP archive at [param path] for the specified [param preset].
+
+
+
+
+
+
+ Locates export template for the platform, and returns [Dictionary] with the following keys: [code]path: String[/code] and [code]error: String[/code]. This method is provided for convenience and custom export platforms aren't required to use it or keep export templates stored in the same way official templates are.
+
+
+
+
+
+
+ Generates array of command line arguments for the default export templates for the debug flags and editor settings.
+
+
+
+
+
+ Returns array of [EditorExportPreset]s for this platform.
+
+
+
+
+
+ Returns array of core file names that always should be exported regardless of preset config.
+
+
+
+
+
+
+ Returns message category, for the message with [param index].
+
+
+
+
+
+ Returns number of messages in the export log.
+
+
+
+
+
+
+ Returns message text, for the message with [param index].
+
+
+
+
+
+
+ Returns message type, for the message with [param index].
+
+
Returns the name of the export operating system handled by this [EditorExportPlatform] class, as a friendly string. Possible return values are [code]Windows[/code], [code]Linux[/code], [code]macOS[/code], [code]Android[/code], [code]iOS[/code], and [code]Web[/code].
+
+
+
+ Returns most severe message type currently present in the export log.
+
+
+
+
+
+
+
+
+
+ Saves PCK archive and returns [Dictionary] with the following keys: [code]result: Error[/code], [code]so_files: Array[/code] (array of the shared/static objects which contains dictionaries with the following keys: [code]path: String[/code], [code]tags: PackedStringArray[/code], and [code]target_folder: String[/code]).
+ If [param embed] is [code]true[/code], PCK content is appended to the end of [param path] file and return [Dictionary] additionally include following keys: [code]embedded_start: int[/code] (embedded PCK offset) and [code]embedded_size: int[/code] (embedded PCK size).
+
+
+
+
+
+
+
+
+ Saves ZIP archive and returns [Dictionary] with the following keys: [code]result: Error[/code], [code]so_files: Array[/code] (array of the shared/static objects which contains dictionaries with the following keys: [code]path: String[/code], [code]tags: PackedStringArray[/code], and [code]target_folder: String[/code]).
+
+
+
+
+
+
+
+
+
+
+ Uploads specified file over SCP protocol to the remote host.
+
+
+
+
+
+
+
+
+
+
+
+ Executes specified command on the remote host via SSH protocol and returns command output in the [param output].
+
+
+
+
+
+
+
+
+
+
+ Executes specified command on the remote host via SSH protocol and returns process ID (on the remote host) without waiting for command to finish.
+
+
+
+
+ Invalid message type used as the default value when no type is specified.
+
+
+ Message type for informational messages that have no effect on the export.
+
+
+ Message type for warning messages that should be addressed but still allow to complete the export.
+
+
+ Message type for error messages that must be addressed and fail the export.
+
+
+ Flag is set if remotely debugged project is expected to use remote file system. If set, [method gen_export_flags] will add [code]--remove-fs[/code] and [code]--remote-fs-password[/code] (if password is set in the editor settings) command line arguments to the list.
+
+
+ Flag is set if remote debug is enabled. If set, [method gen_export_flags] will add [code]--remote-debug[/code] and [code]--breakpoints[/code] (if breakpoints are selected in the script editor or added by the plugin) command line arguments to the list.
+
+
+ Flag is set if remotely debugged project is running on the localhost. If set, [method gen_export_flags] will use [code]localhost[/code] instead of [member EditorSettings.network/debug/remote_host] as remote debugger host.
+
+
+ Flag is set if "Visible Collision Shapes" remote debug option is enabled. If set, [method gen_export_flags] will add [code]--debug-collisions[/code] command line arguments to the list.
+
+
+ Flag is set if Visible Navigation" remote debug option is enabled. If set, [method gen_export_flags] will add [code]--debug-navigation[/code] command line arguments to the list.
+
+
diff --git a/doc/classes/EditorExportPlatformExtension.xml b/doc/classes/EditorExportPlatformExtension.xml
new file mode 100644
index 00000000000..ef589e2f585
--- /dev/null
+++ b/doc/classes/EditorExportPlatformExtension.xml
@@ -0,0 +1,282 @@
+
+
+
+ Base class for custom [EditorExportPlatform] implementations (plugins).
+
+
+ External [EditorExportPlatform] implementations should inherit from this class.
+ To use [EditorExportPlatform], register it using the [method EditorPlugin.add_export_platform] method first.
+
+
+
+
+
+
+
+
+
+ [b]Optional.[/b]
+ Returns [code]true[/code], if specified [param preset] is valid and can be exported. Use [method set_config_error] and [method set_config_missing_templates] to set error details.
+ Usual implementation can call [method _has_valid_export_configuration] and [method _has_valid_project_configuration] to determine if export is possible.
+
+
+
+
+
+ [b]Optional.[/b]
+ Called by the editor before platform is unregistered.
+
+
+
+
+
+
+
+
+
+ [b]Optional.[/b]
+ Creates a PCK archive at [param path] for the specified [param preset].
+ This method is called when "Export PCK/ZIP" button is pressed in the export dialog, and PCK is selected as a file type.
+
+
+
+
+
+
+
+
+
+ [b]Required.[/b]
+ Creates a full project at [param path] for the specified [param preset].
+ This method is called when "Export" button is pressed in the export dialog.
+ This method implementation can call [method EditorExportPlatform.save_pack] or [method EditorExportPlatform.save_zip] to use default PCK/ZIP export process, or calls [method EditorExportPlatform.export_project_files] and implement custom callback for processing each exported file.
+
+
+
+
+
+
+
+
+
+ [b]Optional.[/b]
+ Create a ZIP archive at [param path] for the specified [param preset].
+ This method is called when "Export PCK/ZIP" button is pressed in the export dialog, and ZIP is selected as a file type.
+
+
+
+
+
+
+ [b]Required.[/b]
+ Returns array of supported binary extensions for the full project export.
+
+
+
+
+
+ [b]Optional.[/b]
+ Returns protocol used for remote debugging. Default implementation return [code]tcp://[/code].
+
+
+
+
+
+
+ [b]Optional.[/b]
+ Returns device architecture for one-click deploy.
+
+
+
+
+
+
+
+ [b]Optional.[/b]
+ Validates [param option] and returns visibility for the specified [param preset]. Default implementation return [code]true[/code] for all options.
+
+
+
+
+
+
+
+ [b]Optional.[/b]
+ Validates [param option] and returns warning message for the specified [param preset]. Default implementation return empty string for all options.
+
+
+
+
+
+ [b]Optional.[/b]
+ Returns a property list, as an [Array] of dictionaries. Each [Dictionary] must at least contain the [code]name: StringName[/code] and [code]type: Variant.Type[/code] entries.
+ Additionally, the following keys are supported:
+ - [code]hint: PropertyHint[/code]
+ - [code]hint_string: String[/code]
+ - [code]usage: PropertyUsageFlags[/code]
+ - [code]class_name: StringName[/code]
+ - [code]default_value: Variant[/code], default value of the property.
+ - [code]update_visibility: bool[/code], if set to [code]true[/code], [method _get_export_option_visibility] is called for each property when this property is changed.
+ - [code]required: bool[/code], if set to [code]true[/code], this property warnings are critical, and should be resolved to make export possible. This value is a hint for the [method _has_valid_export_configuration] implementation, and not used by the engine directly.
+ See also [method Object._get_property_list].
+
+
+
+
+
+ [b]Required.[/b]
+ Returns platform logo displayed in the export dialog, logo should be 32x32 adjusted to the current editor scale, see [method EditorInterface.get_editor_scale].
+
+
+
+
+
+ [b]Required.[/b]
+ Returns export platform name.
+
+
+
+
+
+
+ [b]Optional.[/b]
+ Returns one-click deploy menu item icon for the specified [param device], icon should be 16x16 adjusted to the current editor scale, see [method EditorInterface.get_editor_scale].
+
+
+
+
+
+
+ [b]Optional.[/b]
+ Returns one-click deploy menu item label for the specified [param device].
+
+
+
+
+
+
+ [b]Optional.[/b]
+ Returns one-click deploy menu item tooltip for the specified [param device].
+
+
+
+
+
+ [b]Optional.[/b]
+ Returns number one-click deploy devices (or other one-click option displayed in the menu).
+
+
+
+
+
+ [b]Optional.[/b]
+ Returns tooltip of the one-click deploy menu button.
+
+
+
+
+
+ [b]Required.[/b]
+ Returns target OS name.
+
+
+
+
+
+ [b]Required.[/b]
+ Returns array of platform specific features.
+
+
+
+
+
+
+ [b]Required.[/b]
+ Returns array of platform specific features for the specified [param preset].
+
+
+
+
+
+ [b]Optional.[/b]
+ Returns icon of the one-click deploy menu button, icon should be 16x16 adjusted to the current editor scale, see [method EditorInterface.get_editor_scale].
+
+
+
+
+
+
+
+ [b]Required.[/b]
+ Returns [code]true[/code] if export configuration is valid.
+
+
+
+
+
+
+ [b]Required.[/b]
+ Returns [code]true[/code] if project configuration is valid.
+
+
+
+
+
+
+ [b]Optional.[/b]
+ Returns [code]true[/code] if specified file is a valid executable (native executable or script) for the target platform.
+
+
+
+
+
+ [b]Optional.[/b]
+ Returns [code]true[/code] if one-click deploy options are changed and editor interface should be updated.
+
+
+
+
+
+
+
+
+ [b]Optional.[/b]
+ This method is called when [param device] one-click deploy menu option is selected.
+ Implementation should export project to a temporary location, upload and run it on the specific [param device], or perform another action associated with the menu item.
+
+
+
+
+
+ [b]Optional.[/b]
+ Returns [code]true[/code] if export options list is changed and presets should be updated.
+
+
+
+
+
+ Returns current configuration error message text. This method should be called only from the [method _can_export], [method _has_valid_export_configuration], or [method _has_valid_project_configuration] implementations.
+
+
+
+
+
+ Returns [code]true[/code] is export templates are missing from the current configuration. This method should be called only from the [method _can_export], [method _has_valid_export_configuration], or [method _has_valid_project_configuration] implementations.
+
+
+
+
+
+
+ Sets current configuration error message text. This method should be called only from the [method _can_export], [method _has_valid_export_configuration], or [method _has_valid_project_configuration] implementations.
+
+
+
+
+
+
+ Set to [code]true[/code] is export templates are missing from the current configuration. This method should be called only from the [method _can_export], [method _has_valid_export_configuration], or [method _has_valid_project_configuration] implementations.
+
+
+
+
diff --git a/doc/classes/EditorExportPlugin.xml b/doc/classes/EditorExportPlugin.xml
index 9ef911a68dc..42e1968eb03 100644
--- a/doc/classes/EditorExportPlugin.xml
+++ b/doc/classes/EditorExportPlugin.xml
@@ -305,6 +305,18 @@
In case of a directory code-sign will error if you place non code object in directory.
+
+
+
+ Returns currently used export platform.
+
+
+
+
+
+ Returns currently used export preset.
+
+
diff --git a/doc/classes/EditorExportPreset.xml b/doc/classes/EditorExportPreset.xml
new file mode 100644
index 00000000000..bba79364e4b
--- /dev/null
+++ b/doc/classes/EditorExportPreset.xml
@@ -0,0 +1,186 @@
+
+
+
+ Export preset configuration.
+
+
+ Export preset configuration. Instances of [EditorExportPreset] by editor UI and intended to be used a read-only configuration passed to the [EditorExportPlatform] methods when exporting the project.
+
+
+
+
+
+
+
+ Returns [code]true[/code], is "Advanced" toggle is enabled in the export dialog.
+
+
+
+
+
+ Returns string with a comma separated list of custom features.
+
+
+
+
+
+ Returns [Dictionary] of files selected in the "Resources" tab of the export dialog. Dictionary keys are file names and values are export mode - [code]"strip[/code], [code]"keep"[/code], or [code]"remove"[/code]. See also [method get_file_export_mode].
+
+
+
+
+
+ Returns number of files selected in the "Resources" tab of the export dialog.
+
+
+
+
+
+ Returns [code]true[/code], PCK directory encryption is enabled in the export dialog.
+
+
+
+
+
+ Returns [code]true[/code], PCK encryption is enabled in the export dialog.
+
+
+
+
+
+ Returns file filters to exclude during PCK encryption.
+
+
+
+
+
+ Returns file filters to include during PCK encryption.
+
+
+
+
+
+ Returns PCK encryption key.
+
+
+
+
+
+ Returns file filters to exclude during export.
+
+
+
+
+
+ Returns export file filter mode selected in the "Resources" tab of the export dialog.
+
+
+
+
+
+ Returns export target path.
+
+
+
+
+
+
+
+ Returns file export mode for the specified file.
+
+
+
+
+
+ Returns array of files to export.
+
+
+
+
+
+ Returns file filters to include during export.
+
+
+
+
+
+
+
+ Returns export option value or value of environment variable if it is set.
+
+
+
+
+
+ Returns export preset name.
+
+
+
+
+
+ Returns script export mode.
+
+
+
+
+
+
+
+ Returns the preset's version number, or fall back to the [member ProjectSettings.application/config/version] project setting if set to an empty string.
+ If [param windows_version] is [code]true[/code], formats the returned version number to be compatible with Windows executable metadata.
+
+
+
+
+
+
+ Returns [code]true[/code] if preset has specified property.
+
+
+
+
+
+
+ Returns [code]true[/code] if specified file is exported.
+
+
+
+
+
+ Returns [code]true[/code] if dedicated server export mode is selected in the export dialog.
+
+
+
+
+
+ Returns [code]true[/code] if "Runnable" toggle is enabled in the export dialog.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/doc/classes/EditorPlugin.xml b/doc/classes/EditorPlugin.xml
index ed3233b1ae2..37f8b2213be 100644
--- a/doc/classes/EditorPlugin.xml
+++ b/doc/classes/EditorPlugin.xml
@@ -455,6 +455,13 @@
Adds a [Script] as debugger plugin to the Debugger. The script must extend [EditorDebuggerPlugin].
+
+
+
+
+ Registers a new [EditorExportPlatform]. Export platforms provides functionality of exporting to the specific platform.
+
+
@@ -653,6 +660,13 @@
Removes the debugger plugin with given script from the Debugger.
+
+
+
+
+ Removes an export platform registered by [method add_export_platform].
+
+
diff --git a/doc/classes/ScriptEditor.xml b/doc/classes/ScriptEditor.xml
index 50adecccf57..5cf077c266c 100644
--- a/doc/classes/ScriptEditor.xml
+++ b/doc/classes/ScriptEditor.xml
@@ -10,6 +10,12 @@
+
+
+
+ Returns array of breakpoints.
+
+
diff --git a/editor/editor_run_native.cpp b/editor/editor_run_native.cpp
index 5d378820ae2..e0e1ef6d19c 100644
--- a/editor/editor_run_native.cpp
+++ b/editor/editor_run_native.cpp
@@ -141,7 +141,7 @@ Error EditorRunNative::start_run_native(int p_id) {
emit_signal(SNAME("native_run"), preset);
- int flags = 0;
+ BitField flags = 0;
bool deploy_debug_remote = is_deploy_debug_remote_enabled();
bool deploy_dumb = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_file_server", false);
@@ -149,16 +149,16 @@ Error EditorRunNative::start_run_native(int p_id) {
bool debug_navigation = EditorSettings::get_singleton()->get_project_metadata("debug_options", "run_debug_navigation", false);
if (deploy_debug_remote) {
- flags |= EditorExportPlatform::DEBUG_FLAG_REMOTE_DEBUG;
+ flags.set_flag(EditorExportPlatform::DEBUG_FLAG_REMOTE_DEBUG);
}
if (deploy_dumb) {
- flags |= EditorExportPlatform::DEBUG_FLAG_DUMB_CLIENT;
+ flags.set_flag(EditorExportPlatform::DEBUG_FLAG_DUMB_CLIENT);
}
if (debug_collisions) {
- flags |= EditorExportPlatform::DEBUG_FLAG_VIEW_COLLISIONS;
+ flags.set_flag(EditorExportPlatform::DEBUG_FLAG_VIEW_COLLISIONS);
}
if (debug_navigation) {
- flags |= EditorExportPlatform::DEBUG_FLAG_VIEW_NAVIGATION;
+ flags.set_flag(EditorExportPlatform::DEBUG_FLAG_VIEW_NAVIGATION);
}
eep->clear_messages();
diff --git a/editor/export/editor_export.cpp b/editor/export/editor_export.cpp
index 72ab186036d..975a601ae19 100644
--- a/editor/export/editor_export.cpp
+++ b/editor/export/editor_export.cpp
@@ -124,7 +124,17 @@ void EditorExport::_bind_methods() {
void EditorExport::add_export_platform(const Ref &p_platform) {
export_platforms.push_back(p_platform);
+
should_update_presets = true;
+ should_reload_presets = true;
+}
+
+void EditorExport::remove_export_platform(const Ref &p_platform) {
+ export_platforms.erase(p_platform);
+ p_platform->cleanup();
+
+ should_update_presets = true;
+ should_reload_presets = true;
}
int EditorExport::get_export_platform_count() {
@@ -244,7 +254,7 @@ void EditorExport::load_config() {
if (!preset.is_valid()) {
index++;
- ERR_CONTINUE(!preset.is_valid());
+ continue; // Unknown platform, skip without error (platform might be loaded later).
}
preset->set_name(config->get_value(section, "name"));
@@ -343,6 +353,12 @@ void EditorExport::load_config() {
void EditorExport::update_export_presets() {
HashMap> platform_options;
+ if (should_reload_presets) {
+ should_reload_presets = false;
+ export_presets.clear();
+ load_config();
+ }
+
for (int i = 0; i < export_platforms.size(); i++) {
Ref platform = export_platforms[i];
diff --git a/editor/export/editor_export.h b/editor/export/editor_export.h
index f8cb90dc39e..ebb2038f534 100644
--- a/editor/export/editor_export.h
+++ b/editor/export/editor_export.h
@@ -47,6 +47,7 @@ class EditorExport : public Node {
Timer *save_timer = nullptr;
bool block_save = false;
bool should_update_presets = false;
+ bool should_reload_presets = false;
static EditorExport *singleton;
@@ -66,6 +67,7 @@ public:
void add_export_platform(const Ref &p_platform);
int get_export_platform_count();
Ref get_export_platform(int p_idx);
+ void remove_export_platform(const Ref &p_platform);
void add_export_preset(const Ref &p_preset, int p_at_pos = -1);
int get_export_preset_count() const;
diff --git a/editor/export/editor_export_platform.cpp b/editor/export/editor_export_platform.cpp
index 8b31eda3bc7..7ad589a58d8 100644
--- a/editor/export/editor_export_platform.cpp
+++ b/editor/export/editor_export_platform.cpp
@@ -71,7 +71,7 @@ bool EditorExportPlatform::fill_log_messages(RichTextLabel *p_log, Error p_err)
p_log->add_text(" ");
p_log->add_text(get_name());
p_log->add_text(" - ");
- if (p_err == OK) {
+ if (p_err == OK && get_worst_message_type() < EditorExportPlatform::EXPORT_MESSAGE_ERROR) {
if (get_worst_message_type() >= EditorExportPlatform::EXPORT_MESSAGE_WARNING) {
p_log->add_image(p_log->get_editor_theme_icon(SNAME("StatusWarning")), 16 * EDSCALE, 16 * EDSCALE, Color(1.0, 1.0, 1.0), INLINE_ALIGNMENT_CENTER);
p_log->add_text(" ");
@@ -167,58 +167,6 @@ bool EditorExportPlatform::fill_log_messages(RichTextLabel *p_log, Error p_err)
return has_messages;
}
-void EditorExportPlatform::gen_debug_flags(Vector &r_flags, int p_flags) {
- String host = EDITOR_GET("network/debug/remote_host");
- int remote_port = (int)EDITOR_GET("network/debug/remote_port");
-
- if (EditorSettings::get_singleton()->has_setting("export/android/use_wifi_for_remote_debug") && EDITOR_GET("export/android/use_wifi_for_remote_debug")) {
- host = EDITOR_GET("export/android/wifi_remote_debug_host");
- } else if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) {
- host = "localhost";
- }
-
- if (p_flags & DEBUG_FLAG_DUMB_CLIENT) {
- int port = EDITOR_GET("filesystem/file_server/port");
- String passwd = EDITOR_GET("filesystem/file_server/password");
- r_flags.push_back("--remote-fs");
- r_flags.push_back(host + ":" + itos(port));
- if (!passwd.is_empty()) {
- r_flags.push_back("--remote-fs-password");
- r_flags.push_back(passwd);
- }
- }
-
- if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) {
- r_flags.push_back("--remote-debug");
-
- r_flags.push_back(get_debug_protocol() + host + ":" + String::num(remote_port));
-
- List breakpoints;
- ScriptEditor::get_singleton()->get_breakpoints(&breakpoints);
-
- if (breakpoints.size()) {
- r_flags.push_back("--breakpoints");
- String bpoints;
- for (const List::Element *E = breakpoints.front(); E; E = E->next()) {
- bpoints += E->get().replace(" ", "%20");
- if (E->next()) {
- bpoints += ",";
- }
- }
-
- r_flags.push_back(bpoints);
- }
- }
-
- if (p_flags & DEBUG_FLAG_VIEW_COLLISIONS) {
- r_flags.push_back("--debug-collisions");
- }
-
- if (p_flags & DEBUG_FLAG_VIEW_NAVIGATION) {
- r_flags.push_back("--debug-navigation");
- }
-}
-
Error EditorExportPlatform::_save_pack_file(void *p_userdata, const String &p_path, const Vector &p_data, int p_file, int p_total, const Vector &p_enc_in_filters, const Vector &p_enc_ex_filters, const Vector &p_key) {
ERR_FAIL_COND_V_MSG(p_total < 1, ERR_PARAMETER_RANGE_ERROR, "Must select at least one file to export.");
@@ -530,7 +478,7 @@ HashSet EditorExportPlatform::get_features(const Ref
return result;
}
-EditorExportPlatform::ExportNotifier::ExportNotifier(EditorExportPlatform &p_platform, const Ref &p_preset, bool p_debug, const String &p_path, int p_flags) {
+EditorExportPlatform::ExportNotifier::ExportNotifier(EditorExportPlatform &p_platform, const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags) {
HashSet features = p_platform.get_features(p_preset, p_debug);
Vector[> export_plugins = EditorExport::get_singleton()->get_export_plugins();
//initial export plugin callback
@@ -919,6 +867,55 @@ Vector EditorExportPlatform::get_forced_export_files() {
return files;
}
+Error EditorExportPlatform::_script_save_file(void *p_userdata, const String &p_path, const Vector &p_data, int p_file, int p_total, const Vector &p_enc_in_filters, const Vector &p_enc_ex_filters, const Vector &p_key) {
+ Callable cb = ((ScriptCallbackData *)p_userdata)->file_cb;
+ ERR_FAIL_COND_V(!cb.is_valid(), FAILED);
+
+ Variant path = p_path;
+ Variant data = p_data;
+ Variant file = p_file;
+ Variant total = p_total;
+ Variant enc_in = p_enc_in_filters;
+ Variant enc_ex = p_enc_ex_filters;
+ Variant enc_key = p_key;
+
+ Variant ret;
+ Callable::CallError ce;
+ const Variant *args[7] = { &path, &data, &file, &total, &enc_in, &enc_ex, &enc_key };
+
+ cb.callp(args, 7, ret, ce);
+ ERR_FAIL_COND_V_MSG(ce.error != Callable::CallError::CALL_OK, FAILED, vformat("Failed to execute file save callback: %s.", Variant::get_callable_error_text(cb, args, 7, ce)));
+
+ return (Error)ret.operator int();
+}
+
+Error EditorExportPlatform::_script_add_shared_object(void *p_userdata, const SharedObject &p_so) {
+ Callable cb = ((ScriptCallbackData *)p_userdata)->so_cb;
+ if (!cb.is_valid()) {
+ return OK; // Optional.
+ }
+
+ Variant path = p_so.path;
+ Variant tags = p_so.tags;
+ Variant target = p_so.target;
+
+ Variant ret;
+ Callable::CallError ce;
+ const Variant *args[3] = { &path, &tags, &target };
+
+ cb.callp(args, 3, ret, ce);
+ ERR_FAIL_COND_V_MSG(ce.error != Callable::CallError::CALL_OK, FAILED, vformat("Failed to execute shared object save callback: %s.", Variant::get_callable_error_text(cb, args, 3, ce)));
+
+ return (Error)ret.operator int();
+}
+
+Error EditorExportPlatform::_export_project_files(const Ref &p_preset, bool p_debug, const Callable &p_save_func, const Callable &p_so_func) {
+ ScriptCallbackData data;
+ data.file_cb = p_save_func;
+ data.so_cb = p_so_func;
+ return export_project_files(p_preset, p_debug, _script_save_file, &data, _script_add_shared_object);
+}
+
Error EditorExportPlatform::export_project_files(const Ref &p_preset, bool p_debug, EditorExportSaveFunction p_func, void *p_udata, EditorExportSaveSharedObject p_so_func) {
//figure out paths of files that will be exported
HashSet paths;
@@ -1425,7 +1422,7 @@ Error EditorExportPlatform::export_project_files(const Ref &
return p_func(p_udata, "res://" + config_file, data, idx, total, enc_in_filters, enc_ex_filters, key);
}
-Error EditorExportPlatform::_add_shared_object(void *p_userdata, const SharedObject &p_so) {
+Error EditorExportPlatform::_pack_add_shared_object(void *p_userdata, const SharedObject &p_so) {
PackData *pack_data = (PackData *)p_userdata;
if (pack_data->so_files) {
pack_data->so_files->push_back(p_so);
@@ -1434,6 +1431,15 @@ Error EditorExportPlatform::_add_shared_object(void *p_userdata, const SharedObj
return OK;
}
+Error EditorExportPlatform::_zip_add_shared_object(void *p_userdata, const SharedObject &p_so) {
+ ZipData *zip_data = (ZipData *)p_userdata;
+ if (zip_data->so_files) {
+ zip_data->so_files->push_back(p_so);
+ }
+
+ return OK;
+}
+
void EditorExportPlatform::zip_folder_recursive(zipFile &p_zip, const String &p_root_path, const String &p_folder, const String &p_pkg_name) {
String dir = p_folder.is_empty() ? p_root_path : p_root_path.path_join(p_folder);
@@ -1551,6 +1557,54 @@ void EditorExportPlatform::zip_folder_recursive(zipFile &p_zip, const String &p_
da->list_dir_end();
}
+Dictionary EditorExportPlatform::_save_pack(const Ref &p_preset, bool p_debug, const String &p_path, bool p_embed) {
+ Vector so_files;
+ int64_t embedded_start = 0;
+ int64_t embedded_size = 0;
+ Error err_code = save_pack(p_preset, p_debug, p_path, &so_files, p_embed, &embedded_start, &embedded_size);
+
+ Dictionary ret;
+ ret["result"] = err_code;
+ if (err_code == OK) {
+ Array arr;
+ for (const SharedObject &E : so_files) {
+ Dictionary so;
+ so["path"] = E.path;
+ so["tags"] = E.tags;
+ so["target_folder"] = E.target;
+ arr.push_back(so);
+ }
+ ret["so_files"] = arr;
+ if (p_embed) {
+ ret["embedded_start"] = embedded_start;
+ ret["embedded_size"] = embedded_size;
+ }
+ }
+
+ return ret;
+}
+
+Dictionary EditorExportPlatform::_save_zip(const Ref &p_preset, bool p_debug, const String &p_path) {
+ Vector so_files;
+ Error err_code = save_zip(p_preset, p_debug, p_path, &so_files);
+
+ Dictionary ret;
+ ret["result"] = err_code;
+ if (err_code == OK) {
+ Array arr;
+ for (const SharedObject &E : so_files) {
+ Dictionary so;
+ so["path"] = E.path;
+ so["tags"] = E.tags;
+ so["target_folder"] = E.target;
+ arr.push_back(so);
+ }
+ ret["so_files"] = arr;
+ }
+
+ return ret;
+}
+
Error EditorExportPlatform::save_pack(const Ref &p_preset, bool p_debug, const String &p_path, Vector *p_so_files, bool p_embed, int64_t *r_embedded_start, int64_t *r_embedded_size) {
EditorProgress ep("savepack", TTR("Packing"), 102, true);
@@ -1570,7 +1624,7 @@ Error EditorExportPlatform::save_pack(const Ref &p_preset, b
pd.f = ftmp;
pd.so_files = p_so_files;
- Error err = export_project_files(p_preset, p_debug, _save_pack_file, &pd, _add_shared_object);
+ Error err = export_project_files(p_preset, p_debug, _save_pack_file, &pd, _pack_add_shared_object);
// Close temp file.
pd.f.unref();
@@ -1777,7 +1831,7 @@ Error EditorExportPlatform::save_pack(const Ref &p_preset, b
return OK;
}
-Error EditorExportPlatform::save_zip(const Ref &p_preset, bool p_debug, const String &p_path) {
+Error EditorExportPlatform::save_zip(const Ref &p_preset, bool p_debug, const String &p_path, Vector *p_so_files) {
EditorProgress ep("savezip", TTR("Packing"), 102, true);
Ref io_fa;
@@ -1787,8 +1841,9 @@ Error EditorExportPlatform::save_zip(const Ref &p_preset, bo
ZipData zd;
zd.ep = &ep;
zd.zip = zip;
+ zd.so_files = p_so_files;
- Error err = export_project_files(p_preset, p_debug, _save_zip_file, &zd);
+ Error err = export_project_files(p_preset, p_debug, _save_zip_file, &zd, _zip_add_shared_object);
if (err != OK && err != ERR_SKIP) {
add_message(EXPORT_MESSAGE_ERROR, TTR("Save ZIP"), TTR("Failed to export project files."));
}
@@ -1798,45 +1853,48 @@ Error EditorExportPlatform::save_zip(const Ref &p_preset, bo
return OK;
}
-Error EditorExportPlatform::export_pack(const Ref &p_preset, bool p_debug, const String &p_path, int p_flags) {
+Error EditorExportPlatform::export_pack(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags) {
ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);
return save_pack(p_preset, p_debug, p_path);
}
-Error EditorExportPlatform::export_zip(const Ref &p_preset, bool p_debug, const String &p_path, int p_flags) {
+Error EditorExportPlatform::export_zip(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags) {
ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);
return save_zip(p_preset, p_debug, p_path);
}
-void EditorExportPlatform::gen_export_flags(Vector &r_flags, int p_flags) {
+Vector EditorExportPlatform::gen_export_flags(BitField p_flags) {
+ Vector ret;
String host = EDITOR_GET("network/debug/remote_host");
int remote_port = (int)EDITOR_GET("network/debug/remote_port");
- if (p_flags & DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST) {
+ if (get_name() == "Android" && EditorSettings::get_singleton()->has_setting("export/android/use_wifi_for_remote_debug") && EDITOR_GET("export/android/use_wifi_for_remote_debug")) {
+ host = EDITOR_GET("export/android/wifi_remote_debug_host");
+ } else if (p_flags.has_flag(DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST)) {
host = "localhost";
}
- if (p_flags & DEBUG_FLAG_DUMB_CLIENT) {
+ if (p_flags.has_flag(DEBUG_FLAG_DUMB_CLIENT)) {
int port = EDITOR_GET("filesystem/file_server/port");
String passwd = EDITOR_GET("filesystem/file_server/password");
- r_flags.push_back("--remote-fs");
- r_flags.push_back(host + ":" + itos(port));
+ ret.push_back("--remote-fs");
+ ret.push_back(host + ":" + itos(port));
if (!passwd.is_empty()) {
- r_flags.push_back("--remote-fs-password");
- r_flags.push_back(passwd);
+ ret.push_back("--remote-fs-password");
+ ret.push_back(passwd);
}
}
- if (p_flags & DEBUG_FLAG_REMOTE_DEBUG) {
- r_flags.push_back("--remote-debug");
+ if (p_flags.has_flag(DEBUG_FLAG_REMOTE_DEBUG)) {
+ ret.push_back("--remote-debug");
- r_flags.push_back(get_debug_protocol() + host + ":" + String::num(remote_port));
+ ret.push_back(get_debug_protocol() + host + ":" + String::num(remote_port));
List breakpoints;
ScriptEditor::get_singleton()->get_breakpoints(&breakpoints);
if (breakpoints.size()) {
- r_flags.push_back("--breakpoints");
+ ret.push_back("--breakpoints");
String bpoints;
for (List::Element *E = breakpoints.front(); E; E = E->next()) {
bpoints += E->get().replace(" ", "%20");
@@ -1845,17 +1903,18 @@ void EditorExportPlatform::gen_export_flags(Vector &r_flags, int p_flags
}
}
- r_flags.push_back(bpoints);
+ ret.push_back(bpoints);
}
}
- if (p_flags & DEBUG_FLAG_VIEW_COLLISIONS) {
- r_flags.push_back("--debug-collisions");
+ if (p_flags.has_flag(DEBUG_FLAG_VIEW_COLLISIONS)) {
+ ret.push_back("--debug-collisions");
}
- if (p_flags & DEBUG_FLAG_VIEW_NAVIGATION) {
- r_flags.push_back("--debug-navigation");
+ if (p_flags.has_flag(DEBUG_FLAG_VIEW_NAVIGATION)) {
+ ret.push_back("--debug-navigation");
}
+ return ret;
}
bool EditorExportPlatform::can_export(const Ref &p_preset, String &r_error, bool &r_missing_templates, bool p_debug) const {
@@ -2035,8 +2094,61 @@ Error EditorExportPlatform::ssh_push_to_remote(const String &p_host, const Strin
return OK;
}
+Array EditorExportPlatform::get_current_presets() const {
+ Array ret;
+ for (int i = 0; i < EditorExport::get_singleton()->get_export_preset_count(); i++) {
+ Ref ep = EditorExport::get_singleton()->get_export_preset(i);
+ if (ep->get_platform() == this) {
+ ret.push_back(ep);
+ }
+ }
+ return ret;
+}
+
void EditorExportPlatform::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_os_name"), &EditorExportPlatform::get_os_name);
+
+ ClassDB::bind_method(D_METHOD("create_preset"), &EditorExportPlatform::create_preset);
+
+ ClassDB::bind_method(D_METHOD("find_export_template", "template_file_name"), &EditorExportPlatform::_find_export_template);
+ ClassDB::bind_method(D_METHOD("get_current_presets"), &EditorExportPlatform::get_current_presets);
+
+ ClassDB::bind_method(D_METHOD("save_pack", "preset", "debug", "path", "embed"), &EditorExportPlatform::_save_pack, DEFVAL(false));
+ ClassDB::bind_method(D_METHOD("save_zip", "preset", "debug", "path"), &EditorExportPlatform::_save_zip);
+
+ ClassDB::bind_method(D_METHOD("gen_export_flags", "flags"), &EditorExportPlatform::gen_export_flags);
+
+ ClassDB::bind_method(D_METHOD("export_project_files", "preset", "debug", "save_cb", "shared_cb"), &EditorExportPlatform::_export_project_files, DEFVAL(Callable()));
+
+ ClassDB::bind_method(D_METHOD("export_project", "preset", "debug", "path", "flags"), &EditorExportPlatform::export_project, DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("export_pack", "preset", "debug", "path", "flags"), &EditorExportPlatform::export_pack, DEFVAL(0));
+ ClassDB::bind_method(D_METHOD("export_zip", "preset", "debug", "path", "flags"), &EditorExportPlatform::export_zip, DEFVAL(0));
+
+ ClassDB::bind_method(D_METHOD("clear_messages"), &EditorExportPlatform::clear_messages);
+ ClassDB::bind_method(D_METHOD("add_message", "type", "category", "message"), &EditorExportPlatform::add_message);
+ ClassDB::bind_method(D_METHOD("get_message_count"), &EditorExportPlatform::get_message_count);
+
+ ClassDB::bind_method(D_METHOD("get_message_type", "index"), &EditorExportPlatform::_get_message_type);
+ ClassDB::bind_method(D_METHOD("get_message_category", "index"), &EditorExportPlatform::_get_message_category);
+ ClassDB::bind_method(D_METHOD("get_message_text", "index"), &EditorExportPlatform::_get_message_text);
+ ClassDB::bind_method(D_METHOD("get_worst_message_type"), &EditorExportPlatform::get_worst_message_type);
+
+ ClassDB::bind_method(D_METHOD("ssh_run_on_remote", "host", "port", "ssh_arg", "cmd_args", "output", "port_fwd"), &EditorExportPlatform::_ssh_run_on_remote, DEFVAL(Array()), DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("ssh_run_on_remote_no_wait", "host", "port", "ssh_args", "cmd_args", "port_fwd"), &EditorExportPlatform::_ssh_run_on_remote_no_wait, DEFVAL(-1));
+ ClassDB::bind_method(D_METHOD("ssh_push_to_remote", "host", "port", "scp_args", "src_file", "dst_file"), &EditorExportPlatform::ssh_push_to_remote);
+
+ ClassDB::bind_static_method("EditorExportPlatform", D_METHOD("get_forced_export_files"), &EditorExportPlatform::get_forced_export_files);
+
+ BIND_ENUM_CONSTANT(EXPORT_MESSAGE_NONE);
+ BIND_ENUM_CONSTANT(EXPORT_MESSAGE_INFO);
+ BIND_ENUM_CONSTANT(EXPORT_MESSAGE_WARNING);
+ BIND_ENUM_CONSTANT(EXPORT_MESSAGE_ERROR);
+
+ BIND_BITFIELD_FLAG(DEBUG_FLAG_DUMB_CLIENT);
+ BIND_BITFIELD_FLAG(DEBUG_FLAG_REMOTE_DEBUG);
+ BIND_BITFIELD_FLAG(DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST);
+ BIND_BITFIELD_FLAG(DEBUG_FLAG_VIEW_COLLISIONS);
+ BIND_BITFIELD_FLAG(DEBUG_FLAG_VIEW_NAVIGATION);
}
EditorExportPlatform::EditorExportPlatform() {
diff --git a/editor/export/editor_export_platform.h b/editor/export/editor_export_platform.h
index 3fd75ff67f2..a800bb95e6d 100644
--- a/editor/export/editor_export_platform.h
+++ b/editor/export/editor_export_platform.h
@@ -56,6 +56,14 @@ public:
typedef Error (*EditorExportSaveFunction)(void *p_userdata, const String &p_path, const Vector &p_data, int p_file, int p_total, const Vector &p_enc_in_filters, const Vector &p_enc_ex_filters, const Vector &p_key);
typedef Error (*EditorExportSaveSharedObject)(void *p_userdata, const SharedObject &p_so);
+ enum DebugFlags {
+ DEBUG_FLAG_DUMB_CLIENT = 1,
+ DEBUG_FLAG_REMOTE_DEBUG = 2,
+ DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST = 4,
+ DEBUG_FLAG_VIEW_COLLISIONS = 8,
+ DEBUG_FLAG_VIEW_NAVIGATION = 16,
+ };
+
enum ExportMessageType {
EXPORT_MESSAGE_NONE,
EXPORT_MESSAGE_INFO,
@@ -92,6 +100,7 @@ private:
struct ZipData {
void *zip = nullptr;
EditorProgress *ep = nullptr;
+ Vector *so_files = nullptr;
};
Vector messages;
@@ -101,13 +110,22 @@ private:
void _export_find_dependencies(const String &p_path, HashSet &p_paths);
static Error _save_pack_file(void *p_userdata, const String &p_path, const Vector &p_data, int p_file, int p_total, const Vector &p_enc_in_filters, const Vector &p_enc_ex_filters, const Vector &p_key);
+ static Error _pack_add_shared_object(void *p_userdata, const SharedObject &p_so);
+
static Error _save_zip_file(void *p_userdata, const String &p_path, const Vector &p_data, int p_file, int p_total, const Vector &p_enc_in_filters, const Vector &p_enc_ex_filters, const Vector &p_key);
+ static Error _zip_add_shared_object(void *p_userdata, const SharedObject &p_so);
+
+ struct ScriptCallbackData {
+ Callable file_cb;
+ Callable so_cb;
+ };
+
+ static Error _script_save_file(void *p_userdata, const String &p_path, const Vector &p_data, int p_file, int p_total, const Vector &p_enc_in_filters, const Vector &p_enc_ex_filters, const Vector &p_key);
+ static Error _script_add_shared_object(void *p_userdata, const SharedObject &p_so);
void _edit_files_with_filter(Ref &da, const Vector &p_filters, HashSet &r_list, bool exclude);
void _edit_filter_list(HashSet &r_list, const String &p_filter, bool exclude);
- static Error _add_shared_object(void *p_userdata, const SharedObject &p_so);
-
struct FileExportCache {
uint64_t source_modified_time = 0;
String source_md5;
@@ -126,19 +144,46 @@ private:
protected:
struct ExportNotifier {
- ExportNotifier(EditorExportPlatform &p_platform, const Ref &p_preset, bool p_debug, const String &p_path, int p_flags);
+ ExportNotifier(EditorExportPlatform &p_platform, const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags);
~ExportNotifier();
};
HashSet get_features(const Ref &p_preset, bool p_debug) const;
- bool exists_export_template(const String &template_file_name, String *err) const;
- String find_export_template(const String &template_file_name, String *err = nullptr) const;
- void gen_export_flags(Vector &r_flags, int p_flags);
- void gen_debug_flags(Vector &r_flags, int p_flags);
+ Dictionary _find_export_template(const String &p_template_file_name) const {
+ Dictionary ret;
+ String err;
+
+ String path = find_export_template(p_template_file_name, &err);
+ ret["result"] = (err.is_empty() && !path.is_empty()) ? OK : FAILED;
+ ret["path"] = path;
+ ret["error_string"] = err;
+
+ return ret;
+ }
+
+ bool exists_export_template(const String &p_template_file_name, String *r_err) const;
+ String find_export_template(const String &p_template_file_name, String *r_err = nullptr) const;
+ Vector gen_export_flags(BitField p_flags);
virtual void zip_folder_recursive(zipFile &p_zip, const String &p_root_path, const String &p_folder, const String &p_pkg_name);
+ Error _ssh_run_on_remote(const String &p_host, const String &p_port, const Vector &p_ssh_args, const String &p_cmd_args, Array r_output = Array(), int p_port_fwd = -1) const {
+ String pipe;
+ Error err = ssh_run_on_remote(p_host, p_port, p_ssh_args, p_cmd_args, &pipe, p_port_fwd);
+ r_output.push_back(pipe);
+ return err;
+ }
+ OS::ProcessID _ssh_run_on_remote_no_wait(const String &p_host, const String &p_port, const Vector &p_ssh_args, const String &p_cmd_args, int p_port_fwd = -1) const {
+ OS::ProcessID pid = 0;
+ Error err = ssh_run_on_remote_no_wait(p_host, p_port, p_ssh_args, p_cmd_args, &pid, p_port_fwd);
+ if (err != OK) {
+ return -1;
+ } else {
+ return pid;
+ }
+ }
+
Error ssh_run_on_remote(const String &p_host, const String &p_port, const Vector &p_ssh_args, const String &p_cmd_args, String *r_out = nullptr, int p_port_fwd = -1) const;
Error ssh_run_on_remote_no_wait(const String &p_host, const String &p_port, const Vector &p_ssh_args, const String &p_cmd_args, OS::ProcessID *r_pid = nullptr, int p_port_fwd = -1) const;
Error ssh_push_to_remote(const String &p_host, const String &p_port, const Vector &p_scp_args, const String &p_src_file, const String &p_dst_file) const;
@@ -195,6 +240,21 @@ public:
return messages[p_index];
}
+ virtual ExportMessageType _get_message_type(int p_index) const {
+ ERR_FAIL_INDEX_V(p_index, messages.size(), EXPORT_MESSAGE_NONE);
+ return messages[p_index].msg_type;
+ }
+
+ virtual String _get_message_category(int p_index) const {
+ ERR_FAIL_INDEX_V(p_index, messages.size(), String());
+ return messages[p_index].category;
+ }
+
+ virtual String _get_message_text(int p_index) const {
+ ERR_FAIL_INDEX_V(p_index, messages.size(), String());
+ return messages[p_index].text;
+ }
+
virtual ExportMessageType get_worst_message_type() const {
ExportMessageType worst_type = EXPORT_MESSAGE_NONE;
for (int i = 0; i < messages.size(); i++) {
@@ -216,10 +276,16 @@ public:
virtual String get_name() const = 0;
virtual Ref get_logo() const = 0;
+ Array get_current_presets() const;
+
+ Error _export_project_files(const Ref &p_preset, bool p_debug, const Callable &p_save_func, const Callable &p_so_func);
Error export_project_files(const Ref &p_preset, bool p_debug, EditorExportSaveFunction p_func, void *p_udata, EditorExportSaveSharedObject p_so_func = nullptr);
+ Dictionary _save_pack(const Ref &p_preset, bool p_debug, const String &p_path, bool p_embed = false);
+ Dictionary _save_zip(const Ref &p_preset, bool p_debug, const String &p_path);
+
Error save_pack(const Ref &p_preset, bool p_debug, const String &p_path, Vector *p_so_files = nullptr, bool p_embed = false, int64_t *r_embedded_start = nullptr, int64_t *r_embedded_size = nullptr);
- Error save_zip(const Ref &p_preset, bool p_debug, const String &p_path);
+ Error save_zip(const Ref &p_preset, bool p_debug, const String &p_path, Vector *p_so_files = nullptr);
virtual bool poll_export() { return false; }
virtual int get_options_count() const { return 0; }
@@ -229,31 +295,26 @@ public:
virtual String get_option_tooltip(int p_device) const { return ""; }
virtual String get_device_architecture(int p_device) const { return ""; }
- enum DebugFlags {
- DEBUG_FLAG_DUMB_CLIENT = 1,
- DEBUG_FLAG_REMOTE_DEBUG = 2,
- DEBUG_FLAG_REMOTE_DEBUG_LOCALHOST = 4,
- DEBUG_FLAG_VIEW_COLLISIONS = 8,
- DEBUG_FLAG_VIEW_NAVIGATION = 16,
- };
-
virtual void cleanup() {}
- virtual Error run(const Ref &p_preset, int p_device, int p_debug_flags) { return OK; }
+ virtual Error run(const Ref &p_preset, int p_device, BitField p_debug_flags) { return OK; }
virtual Ref get_run_icon() const { return get_logo(); }
- bool can_export(const Ref &p_preset, String &r_error, bool &r_missing_templates, bool p_debug = false) const;
+ virtual bool can_export(const Ref &p_preset, String &r_error, bool &r_missing_templates, bool p_debug = false) const;
virtual bool has_valid_export_configuration(const Ref &p_preset, String &r_error, bool &r_missing_templates, bool p_debug = false) const = 0;
virtual bool has_valid_project_configuration(const Ref &p_preset, String &r_error) const = 0;
virtual List get_binary_extensions(const Ref &p_preset) const = 0;
- virtual Error export_project(const Ref &p_preset, bool p_debug, const String &p_path, int p_flags = 0) = 0;
- virtual Error export_pack(const Ref &p_preset, bool p_debug, const String &p_path, int p_flags = 0);
- virtual Error export_zip(const Ref &p_preset, bool p_debug, const String &p_path, int p_flags = 0);
+ virtual Error export_project(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags = 0) = 0;
+ virtual Error export_pack(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags = 0);
+ virtual Error export_zip(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags = 0);
virtual void get_platform_features(List *r_features) const = 0;
- virtual void resolve_platform_feature_priorities(const Ref &p_preset, HashSet &p_features) = 0;
+ virtual void resolve_platform_feature_priorities(const Ref &p_preset, HashSet &p_features){};
virtual String get_debug_protocol() const { return "tcp://"; }
EditorExportPlatform();
};
+VARIANT_ENUM_CAST(EditorExportPlatform::ExportMessageType)
+VARIANT_BITFIELD_CAST(EditorExportPlatform::DebugFlags);
+
#endif // EDITOR_EXPORT_PLATFORM_H
diff --git a/editor/export/editor_export_platform_extension.cpp b/editor/export/editor_export_platform_extension.cpp
new file mode 100644
index 00000000000..808a2076e2e
--- /dev/null
+++ b/editor/export/editor_export_platform_extension.cpp
@@ -0,0 +1,317 @@
+/**************************************************************************/
+/* editor_export_platform_extension.cpp */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/**************************************************************************/
+
+#include "editor_export_platform_extension.h"
+
+void EditorExportPlatformExtension::_bind_methods() {
+ ClassDB::bind_method(D_METHOD("set_config_error", "error_text"), &EditorExportPlatformExtension::set_config_error);
+ ClassDB::bind_method(D_METHOD("get_config_error"), &EditorExportPlatformExtension::get_config_error);
+
+ ClassDB::bind_method(D_METHOD("set_config_missing_templates", "missing_templates"), &EditorExportPlatformExtension::set_config_missing_templates);
+ ClassDB::bind_method(D_METHOD("get_config_missing_templates"), &EditorExportPlatformExtension::get_config_missing_templates);
+
+ GDVIRTUAL_BIND(_get_preset_features, "preset");
+ GDVIRTUAL_BIND(_is_executable, "path");
+ GDVIRTUAL_BIND(_get_export_options);
+ GDVIRTUAL_BIND(_should_update_export_options);
+ GDVIRTUAL_BIND(_get_export_option_visibility, "preset", "option");
+ GDVIRTUAL_BIND(_get_export_option_warning, "preset", "option");
+
+ GDVIRTUAL_BIND(_get_os_name);
+ GDVIRTUAL_BIND(_get_name);
+ GDVIRTUAL_BIND(_get_logo);
+
+ GDVIRTUAL_BIND(_poll_export);
+ GDVIRTUAL_BIND(_get_options_count);
+ GDVIRTUAL_BIND(_get_options_tooltip);
+
+ GDVIRTUAL_BIND(_get_option_icon, "device");
+ GDVIRTUAL_BIND(_get_option_label, "device");
+ GDVIRTUAL_BIND(_get_option_tooltip, "device");
+ GDVIRTUAL_BIND(_get_device_architecture, "device");
+
+ GDVIRTUAL_BIND(_cleanup);
+
+ GDVIRTUAL_BIND(_run, "preset", "device", "debug_flags");
+ GDVIRTUAL_BIND(_get_run_icon);
+
+ GDVIRTUAL_BIND(_can_export, "preset", "debug");
+ GDVIRTUAL_BIND(_has_valid_export_configuration, "preset", "debug");
+ GDVIRTUAL_BIND(_has_valid_project_configuration, "preset");
+
+ GDVIRTUAL_BIND(_get_binary_extensions, "preset");
+
+ GDVIRTUAL_BIND(_export_project, "preset", "debug", "path", "flags");
+ GDVIRTUAL_BIND(_export_pack, "preset", "debug", "path", "flags");
+ GDVIRTUAL_BIND(_export_zip, "preset", "debug", "path", "flags");
+
+ GDVIRTUAL_BIND(_get_platform_features);
+
+ GDVIRTUAL_BIND(_get_debug_protocol);
+}
+
+void EditorExportPlatformExtension::get_preset_features(const Ref &p_preset, List *r_features) const {
+ Vector ret;
+ if (GDVIRTUAL_REQUIRED_CALL(_get_preset_features, p_preset, ret) && r_features) {
+ for (const String &E : ret) {
+ r_features->push_back(E);
+ }
+ }
+}
+
+bool EditorExportPlatformExtension::is_executable(const String &p_path) const {
+ bool ret = false;
+ GDVIRTUAL_CALL(_is_executable, p_path, ret);
+ return ret;
+}
+
+void EditorExportPlatformExtension::get_export_options(List *r_options) const {
+ TypedArray ret;
+ if (GDVIRTUAL_CALL(_get_export_options, ret) && r_options) {
+ for (const Variant &var : ret) {
+ const Dictionary &d = var;
+ ERR_CONTINUE(!d.has("name"));
+ ERR_CONTINUE(!d.has("type"));
+
+ PropertyInfo pinfo = PropertyInfo::from_dict(d);
+ ERR_CONTINUE(pinfo.name.is_empty() && (pinfo.usage & PROPERTY_USAGE_STORAGE));
+ ERR_CONTINUE(pinfo.type < 0 || pinfo.type >= Variant::VARIANT_MAX);
+
+ Variant default_value;
+ if (d.has("default_value")) {
+ default_value = d["default_value"];
+ }
+ bool update_visibility = false;
+ if (d.has("update_visibility")) {
+ update_visibility = d["update_visibility"];
+ }
+ bool required = false;
+ if (d.has("required")) {
+ required = d["required"];
+ }
+
+ r_options->push_back(ExportOption(pinfo, default_value, update_visibility, required));
+ }
+ }
+}
+
+bool EditorExportPlatformExtension::should_update_export_options() {
+ bool ret = false;
+ GDVIRTUAL_CALL(_should_update_export_options, ret);
+ return ret;
+}
+
+bool EditorExportPlatformExtension::get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option) const {
+ bool ret = true;
+ GDVIRTUAL_CALL(_get_export_option_visibility, Ref(p_preset), p_option, ret);
+ return ret;
+}
+
+String EditorExportPlatformExtension::get_export_option_warning(const EditorExportPreset *p_preset, const StringName &p_name) const {
+ String ret;
+ GDVIRTUAL_CALL(_get_export_option_warning, Ref(p_preset), p_name, ret);
+ return ret;
+}
+
+String EditorExportPlatformExtension::get_os_name() const {
+ String ret;
+ GDVIRTUAL_REQUIRED_CALL(_get_os_name, ret);
+ return ret;
+}
+
+String EditorExportPlatformExtension::get_name() const {
+ String ret;
+ GDVIRTUAL_REQUIRED_CALL(_get_name, ret);
+ return ret;
+}
+
+Ref EditorExportPlatformExtension::get_logo() const {
+ Ref ret;
+ GDVIRTUAL_REQUIRED_CALL(_get_logo, ret);
+ return ret;
+}
+
+bool EditorExportPlatformExtension::poll_export() {
+ bool ret = false;
+ GDVIRTUAL_CALL(_poll_export, ret);
+ return ret;
+}
+
+int EditorExportPlatformExtension::get_options_count() const {
+ int ret = 0;
+ GDVIRTUAL_CALL(_get_options_count, ret);
+ return ret;
+}
+
+String EditorExportPlatformExtension::get_options_tooltip() const {
+ String ret;
+ GDVIRTUAL_CALL(_get_options_tooltip, ret);
+ return ret;
+}
+
+Ref EditorExportPlatformExtension::get_option_icon(int p_index) const {
+ Ref ret;
+ if (GDVIRTUAL_CALL(_get_option_icon, p_index, ret)) {
+ return ret;
+ }
+ return EditorExportPlatform::get_option_icon(p_index);
+}
+
+String EditorExportPlatformExtension::get_option_label(int p_device) const {
+ String ret;
+ GDVIRTUAL_CALL(_get_option_label, p_device, ret);
+ return ret;
+}
+
+String EditorExportPlatformExtension::get_option_tooltip(int p_device) const {
+ String ret;
+ GDVIRTUAL_CALL(_get_option_tooltip, p_device, ret);
+ return ret;
+}
+
+String EditorExportPlatformExtension::get_device_architecture(int p_device) const {
+ String ret;
+ GDVIRTUAL_CALL(_get_device_architecture, p_device, ret);
+ return ret;
+}
+
+void EditorExportPlatformExtension::cleanup() {
+ GDVIRTUAL_CALL(_cleanup);
+}
+
+Error EditorExportPlatformExtension::run(const Ref &p_preset, int p_device, BitField p_debug_flags) {
+ Error ret = OK;
+ GDVIRTUAL_CALL(_run, p_preset, p_device, p_debug_flags, ret);
+ return ret;
+}
+
+Ref EditorExportPlatformExtension::get_run_icon() const {
+ Ref ret;
+ if (GDVIRTUAL_CALL(_get_run_icon, ret)) {
+ return ret;
+ }
+ return EditorExportPlatform::get_run_icon();
+}
+
+bool EditorExportPlatformExtension::can_export(const Ref &p_preset, String &r_error, bool &r_missing_templates, bool p_debug) const {
+ bool ret = false;
+ config_error = r_error;
+ config_missing_templates = r_missing_templates;
+ if (GDVIRTUAL_CALL(_can_export, p_preset, p_debug, ret)) {
+ r_error = config_error;
+ r_missing_templates = config_missing_templates;
+ return ret;
+ }
+ return EditorExportPlatform::can_export(p_preset, r_error, r_missing_templates, p_debug);
+}
+
+bool EditorExportPlatformExtension::has_valid_export_configuration(const Ref &p_preset, String &r_error, bool &r_missing_templates, bool p_debug) const {
+ bool ret = false;
+ config_error = r_error;
+ config_missing_templates = r_missing_templates;
+ if (GDVIRTUAL_REQUIRED_CALL(_has_valid_export_configuration, p_preset, p_debug, ret)) {
+ r_error = config_error;
+ r_missing_templates = config_missing_templates;
+ }
+ return ret;
+}
+
+bool EditorExportPlatformExtension::has_valid_project_configuration(const Ref &p_preset, String &r_error) const {
+ bool ret = false;
+ config_error = r_error;
+ if (GDVIRTUAL_REQUIRED_CALL(_has_valid_project_configuration, p_preset, ret)) {
+ r_error = config_error;
+ }
+ return ret;
+}
+
+List EditorExportPlatformExtension::get_binary_extensions(const Ref &p_preset) const {
+ List ret_list;
+ Vector ret;
+ if (GDVIRTUAL_REQUIRED_CALL(_get_binary_extensions, p_preset, ret)) {
+ for (const String &E : ret) {
+ ret_list.push_back(E);
+ }
+ }
+ return ret_list;
+}
+
+Error EditorExportPlatformExtension::export_project(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags) {
+ ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);
+
+ Error ret = FAILED;
+ GDVIRTUAL_REQUIRED_CALL(_export_project, p_preset, p_debug, p_path, p_flags, ret);
+ return ret;
+}
+
+Error EditorExportPlatformExtension::export_pack(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags) {
+ ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);
+
+ Error ret = FAILED;
+ if (GDVIRTUAL_CALL(_export_pack, p_preset, p_debug, p_path, p_flags, ret)) {
+ return ret;
+ }
+ return save_pack(p_preset, p_debug, p_path);
+}
+
+Error EditorExportPlatformExtension::export_zip(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags) {
+ ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);
+
+ Error ret = FAILED;
+ if (GDVIRTUAL_CALL(_export_zip, p_preset, p_debug, p_path, p_flags, ret)) {
+ return ret;
+ }
+ return save_zip(p_preset, p_debug, p_path);
+}
+
+void EditorExportPlatformExtension::get_platform_features(List *r_features) const {
+ Vector ret;
+ if (GDVIRTUAL_REQUIRED_CALL(_get_platform_features, ret) && r_features) {
+ for (const String &E : ret) {
+ r_features->push_back(E);
+ }
+ }
+}
+
+String EditorExportPlatformExtension::get_debug_protocol() const {
+ String ret;
+ if (GDVIRTUAL_CALL(_get_debug_protocol, ret)) {
+ return ret;
+ }
+ return EditorExportPlatform::get_debug_protocol();
+}
+
+EditorExportPlatformExtension::EditorExportPlatformExtension() {
+ //NOP
+}
+
+EditorExportPlatformExtension::~EditorExportPlatformExtension() {
+ //NOP
+}
diff --git a/editor/export/editor_export_platform_extension.h b/editor/export/editor_export_platform_extension.h
new file mode 100644
index 00000000000..6391e65ac18
--- /dev/null
+++ b/editor/export/editor_export_platform_extension.h
@@ -0,0 +1,149 @@
+/**************************************************************************/
+/* editor_export_platform_extension.h */
+/**************************************************************************/
+/* This file is part of: */
+/* GODOT ENGINE */
+/* https://godotengine.org */
+/**************************************************************************/
+/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
+/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
+/* */
+/* Permission is hereby granted, free of charge, to any person obtaining */
+/* a copy of this software and associated documentation files (the */
+/* "Software"), to deal in the Software without restriction, including */
+/* without limitation the rights to use, copy, modify, merge, publish, */
+/* distribute, sublicense, and/or sell copies of the Software, and to */
+/* permit persons to whom the Software is furnished to do so, subject to */
+/* the following conditions: */
+/* */
+/* The above copyright notice and this permission notice shall be */
+/* included in all copies or substantial portions of the Software. */
+/* */
+/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
+/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
+/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
+/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
+/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
+/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
+/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
+/**************************************************************************/
+
+#ifndef EDITOR_EXPORT_PLATFORM_EXTENSION_H
+#define EDITOR_EXPORT_PLATFORM_EXTENSION_H
+
+#include "editor_export_platform.h"
+#include "editor_export_preset.h"
+
+class EditorExportPlatformExtension : public EditorExportPlatform {
+ GDCLASS(EditorExportPlatformExtension, EditorExportPlatform);
+
+ mutable String config_error;
+ mutable bool config_missing_templates = false;
+
+protected:
+ static void _bind_methods();
+
+public:
+ virtual void get_preset_features(const Ref &p_preset, List *r_features) const override;
+ GDVIRTUAL1RC(Vector, _get_preset_features, Ref);
+
+ virtual bool is_executable(const String &p_path) const override;
+ GDVIRTUAL1RC(bool, _is_executable, const String &);
+
+ virtual void get_export_options(List *r_options) const override;
+ GDVIRTUAL0RC(TypedArray, _get_export_options);
+
+ virtual bool should_update_export_options() override;
+ GDVIRTUAL0R(bool, _should_update_export_options);
+
+ virtual bool get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option) const override;
+ GDVIRTUAL2RC(bool, _get_export_option_visibility, Ref, const String &);
+
+ virtual String get_export_option_warning(const EditorExportPreset *p_preset, const StringName &p_name) const override;
+ GDVIRTUAL2RC(String, _get_export_option_warning, Ref, const StringName &);
+
+ virtual String get_os_name() const override;
+ GDVIRTUAL0RC(String, _get_os_name);
+
+ virtual String get_name() const override;
+ GDVIRTUAL0RC(String, _get_name);
+
+ virtual Ref get_logo() const override;
+ GDVIRTUAL0RC(Ref, _get_logo);
+
+ virtual bool poll_export() override;
+ GDVIRTUAL0R(bool, _poll_export);
+
+ virtual int get_options_count() const override;
+ GDVIRTUAL0RC(int, _get_options_count);
+
+ virtual String get_options_tooltip() const override;
+ GDVIRTUAL0RC(String, _get_options_tooltip);
+
+ virtual Ref get_option_icon(int p_index) const override;
+ GDVIRTUAL1RC(Ref, _get_option_icon, int);
+
+ virtual String get_option_label(int p_device) const override;
+ GDVIRTUAL1RC(String, _get_option_label, int);
+
+ virtual String get_option_tooltip(int p_device) const override;
+ GDVIRTUAL1RC(String, _get_option_tooltip, int);
+
+ virtual String get_device_architecture(int p_device) const override;
+ GDVIRTUAL1RC(String, _get_device_architecture, int);
+
+ virtual void cleanup() override;
+ GDVIRTUAL0(_cleanup);
+
+ virtual Error run(const Ref &p_preset, int p_device, BitField p_debug_flags) override;
+ GDVIRTUAL3R(Error, _run, Ref, int, BitField);
+
+ virtual Ref get_run_icon() const override;
+ GDVIRTUAL0RC(Ref, _get_run_icon);
+
+ void set_config_error(const String &p_error) const {
+ config_error = p_error;
+ }
+ String get_config_error() const {
+ return config_error;
+ }
+
+ void set_config_missing_templates(bool p_missing_templates) const {
+ config_missing_templates = p_missing_templates;
+ }
+ bool get_config_missing_templates() const {
+ return config_missing_templates;
+ }
+
+ virtual bool can_export(const Ref &p_preset, String &r_error, bool &r_missing_templates, bool p_debug = false) const override;
+ GDVIRTUAL2RC(bool, _can_export, Ref, bool);
+
+ virtual bool has_valid_export_configuration(const Ref &p_preset, String &r_error, bool &r_missing_templates, bool p_debug = false) const override;
+ GDVIRTUAL2RC(bool, _has_valid_export_configuration, Ref, bool);
+
+ virtual bool has_valid_project_configuration(const Ref &p_preset, String &r_error) const override;
+ GDVIRTUAL1RC(bool, _has_valid_project_configuration, Ref);
+
+ virtual List get_binary_extensions(const Ref &p_preset) const override;
+ GDVIRTUAL1RC(Vector, _get_binary_extensions, Ref);
+
+ virtual Error export_project(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags = 0) override;
+ GDVIRTUAL4R(Error, _export_project, Ref, bool, const String &, BitField);
+
+ virtual Error export_pack(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags = 0) override;
+ GDVIRTUAL4R(Error, _export_pack, Ref, bool, const String &, BitField);
+
+ virtual Error export_zip(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags = 0) override;
+ GDVIRTUAL4R(Error, _export_zip, Ref, bool, const String &, BitField);
+
+ virtual void get_platform_features(List *r_features) const override;
+ GDVIRTUAL0RC(Vector, _get_platform_features);
+
+ virtual String get_debug_protocol() const override;
+ GDVIRTUAL0RC(String, _get_debug_protocol);
+
+ EditorExportPlatformExtension();
+ ~EditorExportPlatformExtension();
+};
+
+#endif // EDITOR_EXPORT_PLATFORM_EXTENSION_H
diff --git a/editor/export/editor_export_platform_pc.cpp b/editor/export/editor_export_platform_pc.cpp
index cdaf18b3467..24d89b7f347 100644
--- a/editor/export/editor_export_platform_pc.cpp
+++ b/editor/export/editor_export_platform_pc.cpp
@@ -115,7 +115,7 @@ bool EditorExportPlatformPC::has_valid_project_configuration(const Ref &p_preset, bool p_debug, const String &p_path, int p_flags) {
+Error EditorExportPlatformPC::export_project(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags) {
ExportNotifier notifier(*this, p_preset, p_debug, p_path, p_flags);
Error err = prepare_template(p_preset, p_debug, p_path, p_flags);
@@ -129,7 +129,7 @@ Error EditorExportPlatformPC::export_project(const Ref &p_pr
return err;
}
-Error EditorExportPlatformPC::prepare_template(const Ref &p_preset, bool p_debug, const String &p_path, int p_flags) {
+Error EditorExportPlatformPC::prepare_template(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags) {
if (!DirAccess::exists(p_path.get_base_dir())) {
add_message(EXPORT_MESSAGE_ERROR, TTR("Prepare Template"), TTR("The given export path doesn't exist."));
return ERR_FILE_BAD_PATH;
@@ -182,7 +182,7 @@ Error EditorExportPlatformPC::prepare_template(const Ref &p_
return err;
}
-Error EditorExportPlatformPC::export_project_data(const Ref &p_preset, bool p_debug, const String &p_path, int p_flags) {
+Error EditorExportPlatformPC::export_project_data(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags) {
String pck_path;
if (p_preset->get("binary_format/embed_pck")) {
pck_path = p_path;
diff --git a/editor/export/editor_export_platform_pc.h b/editor/export/editor_export_platform_pc.h
index 53574c23331..668ddaf47ef 100644
--- a/editor/export/editor_export_platform_pc.h
+++ b/editor/export/editor_export_platform_pc.h
@@ -54,13 +54,13 @@ public:
virtual bool has_valid_export_configuration(const Ref &p_preset, String &r_error, bool &r_missing_templates, bool p_debug = false) const override;
virtual bool has_valid_project_configuration(const Ref &p_preset, String &r_error) const override;
- virtual Error export_project(const Ref &p_preset, bool p_debug, const String &p_path, int p_flags = 0) override;
+ virtual Error export_project(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags = 0) override;
virtual Error sign_shared_object(const Ref &p_preset, bool p_debug, const String &p_path);
virtual String get_template_file_name(const String &p_target, const String &p_arch) const = 0;
- virtual Error prepare_template(const Ref &p_preset, bool p_debug, const String &p_path, int p_flags);
- virtual Error modify_template(const Ref &p_preset, bool p_debug, const String &p_path, int p_flags) { return OK; };
- virtual Error export_project_data(const Ref &p_preset, bool p_debug, const String &p_path, int p_flags);
+ virtual Error prepare_template(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags);
+ virtual Error modify_template(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags) { return OK; }
+ virtual Error export_project_data(const Ref &p_preset, bool p_debug, const String &p_path, BitField p_flags);
void set_name(const String &p_name);
void set_os_name(const String &p_name);
diff --git a/editor/export/editor_export_plugin.cpp b/editor/export/editor_export_plugin.cpp
index 28d0750d5a9..f56dd61e3bd 100644
--- a/editor/export/editor_export_plugin.cpp
+++ b/editor/export/editor_export_plugin.cpp
@@ -48,6 +48,14 @@ Ref EditorExportPlugin::get_export_preset() const {
return export_preset;
}
+Ref EditorExportPlugin::get_export_platform() const {
+ if (export_preset.is_valid()) {
+ return export_preset->get_platform();
+ } else {
+ return Ref();
+ }
+}
+
void EditorExportPlugin::add_file(const String &p_path, const Vector &p_file, bool p_remap) {
ExtraFile ef;
ef.data = p_file;
@@ -321,6 +329,9 @@ void EditorExportPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("skip"), &EditorExportPlugin::skip);
ClassDB::bind_method(D_METHOD("get_option", "name"), &EditorExportPlugin::get_option);
+ ClassDB::bind_method(D_METHOD("get_export_preset"), &EditorExportPlugin::get_export_preset);
+ ClassDB::bind_method(D_METHOD("get_export_platform"), &EditorExportPlugin::get_export_platform);
+
GDVIRTUAL_BIND(_export_file, "path", "type", "features");
GDVIRTUAL_BIND(_export_begin, "features", "is_debug", "path", "flags");
GDVIRTUAL_BIND(_export_end);
diff --git a/editor/export/editor_export_plugin.h b/editor/export/editor_export_plugin.h
index 56eea850109..7a355614c75 100644
--- a/editor/export/editor_export_plugin.h
+++ b/editor/export/editor_export_plugin.h
@@ -91,6 +91,7 @@ class EditorExportPlugin : public RefCounted {
protected:
void set_export_preset(const Ref &p_preset);
Ref get_export_preset() const;
+ Ref get_export_platform() const;
void add_file(const String &p_path, const Vector &p_file, bool p_remap);
void add_shared_object(const String &p_path, const Vector &tags, const String &p_target = String());
diff --git a/editor/export/editor_export_preset.cpp b/editor/export/editor_export_preset.cpp
index e2e3e9d1547..9f805666d0a 100644
--- a/editor/export/editor_export_preset.cpp
+++ b/editor/export/editor_export_preset.cpp
@@ -62,6 +62,48 @@ bool EditorExportPreset::_get(const StringName &p_name, Variant &r_ret) const {
void EditorExportPreset::_bind_methods() {
ClassDB::bind_method(D_METHOD("_get_property_warning", "name"), &EditorExportPreset::_get_property_warning);
+
+ ClassDB::bind_method(D_METHOD("has", "property"), &EditorExportPreset::has);
+
+ ClassDB::bind_method(D_METHOD("get_files_to_export"), &EditorExportPreset::get_files_to_export);
+ ClassDB::bind_method(D_METHOD("get_customized_files"), &EditorExportPreset::get_customized_files);
+ ClassDB::bind_method(D_METHOD("get_customized_files_count"), &EditorExportPreset::get_customized_files_count);
+ ClassDB::bind_method(D_METHOD("has_export_file", "path"), &EditorExportPreset::has_export_file);
+ ClassDB::bind_method(D_METHOD("get_file_export_mode", "path", "default"), &EditorExportPreset::get_file_export_mode, DEFVAL(MODE_FILE_NOT_CUSTOMIZED));
+
+ ClassDB::bind_method(D_METHOD("get_preset_name"), &EditorExportPreset::get_name);
+ ClassDB::bind_method(D_METHOD("is_runnable"), &EditorExportPreset::is_runnable);
+ ClassDB::bind_method(D_METHOD("are_advanced_options_enabled"), &EditorExportPreset::are_advanced_options_enabled);
+ ClassDB::bind_method(D_METHOD("is_dedicated_server"), &EditorExportPreset::is_dedicated_server);
+ ClassDB::bind_method(D_METHOD("get_export_filter"), &EditorExportPreset::get_export_filter);
+ ClassDB::bind_method(D_METHOD("get_include_filter"), &EditorExportPreset::get_include_filter);
+ ClassDB::bind_method(D_METHOD("get_exclude_filter"), &EditorExportPreset::get_exclude_filter);
+ ClassDB::bind_method(D_METHOD("get_custom_features"), &EditorExportPreset::get_custom_features);
+ ClassDB::bind_method(D_METHOD("get_export_path"), &EditorExportPreset::get_export_path);
+ ClassDB::bind_method(D_METHOD("get_encryption_in_filter"), &EditorExportPreset::get_enc_in_filter);
+ ClassDB::bind_method(D_METHOD("get_encryption_ex_filter"), &EditorExportPreset::get_enc_ex_filter);
+ ClassDB::bind_method(D_METHOD("get_encrypt_pck"), &EditorExportPreset::get_enc_pck);
+ ClassDB::bind_method(D_METHOD("get_encrypt_directory"), &EditorExportPreset::get_enc_directory);
+ ClassDB::bind_method(D_METHOD("get_encryption_key"), &EditorExportPreset::get_script_encryption_key);
+ ClassDB::bind_method(D_METHOD("get_script_export_mode"), &EditorExportPreset::get_script_export_mode);
+
+ ClassDB::bind_method(D_METHOD("get_or_env", "name", "env_var"), &EditorExportPreset::_get_or_env);
+ ClassDB::bind_method(D_METHOD("get_version", "name", "windows_version"), &EditorExportPreset::get_version);
+
+ BIND_ENUM_CONSTANT(EXPORT_ALL_RESOURCES);
+ BIND_ENUM_CONSTANT(EXPORT_SELECTED_SCENES);
+ BIND_ENUM_CONSTANT(EXPORT_SELECTED_RESOURCES);
+ BIND_ENUM_CONSTANT(EXCLUDE_SELECTED_RESOURCES);
+ BIND_ENUM_CONSTANT(EXPORT_CUSTOMIZED);
+
+ BIND_ENUM_CONSTANT(MODE_FILE_NOT_CUSTOMIZED);
+ BIND_ENUM_CONSTANT(MODE_FILE_STRIP);
+ BIND_ENUM_CONSTANT(MODE_FILE_KEEP);
+ BIND_ENUM_CONSTANT(MODE_FILE_REMOVE);
+
+ BIND_ENUM_CONSTANT(MODE_SCRIPT_TEXT);
+ BIND_ENUM_CONSTANT(MODE_SCRIPT_BINARY_TOKENS);
+ BIND_ENUM_CONSTANT(MODE_SCRIPT_BINARY_TOKENS_COMPRESSED);
}
String EditorExportPreset::_get_property_warning(const StringName &p_name) const {
diff --git a/editor/export/editor_export_preset.h b/editor/export/editor_export_preset.h
index c6a8808af12..f220477461f 100644
--- a/editor/export/editor_export_preset.h
+++ b/editor/export/editor_export_preset.h
@@ -168,6 +168,9 @@ public:
void set_script_export_mode(int p_mode);
int get_script_export_mode() const;
+ Variant _get_or_env(const StringName &p_name, const String &p_env_var) const {
+ return get_or_env(p_name, p_env_var);
+ }
Variant get_or_env(const StringName &p_name, const String &p_env_var, bool *r_valid = nullptr) const;
// Return the preset's version number, or fall back to the
@@ -183,4 +186,8 @@ public:
EditorExportPreset();
};
+VARIANT_ENUM_CAST(EditorExportPreset::ExportFilter);
+VARIANT_ENUM_CAST(EditorExportPreset::FileExportMode);
+VARIANT_ENUM_CAST(EditorExportPreset::ScriptExportMode);
+
#endif // EDITOR_EXPORT_PRESET_H
diff --git a/editor/plugins/editor_plugin.cpp b/editor/plugins/editor_plugin.cpp
index d9f60e155d1..8ce667568f1 100644
--- a/editor/plugins/editor_plugin.cpp
+++ b/editor/plugins/editor_plugin.cpp
@@ -40,6 +40,7 @@
#include "editor/editor_translation_parser.h"
#include "editor/editor_undo_redo_manager.h"
#include "editor/export/editor_export.h"
+#include "editor/export/editor_export_platform.h"
#include "editor/gui/editor_bottom_panel.h"
#include "editor/gui/editor_title_bar.h"
#include "editor/import/3d/resource_importer_scene.h"
@@ -441,6 +442,16 @@ void EditorPlugin::remove_export_plugin(const Ref &p_exporte
EditorExport::get_singleton()->remove_export_plugin(p_exporter);
}
+void EditorPlugin::add_export_platform(const Ref &p_platform) {
+ ERR_FAIL_COND(p_platform.is_null());
+ EditorExport::get_singleton()->add_export_platform(p_platform);
+}
+
+void EditorPlugin::remove_export_platform(const Ref &p_platform) {
+ ERR_FAIL_COND(p_platform.is_null());
+ EditorExport::get_singleton()->remove_export_platform(p_platform);
+}
+
void EditorPlugin::add_node_3d_gizmo_plugin(const Ref &p_gizmo_plugin) {
ERR_FAIL_COND(!p_gizmo_plugin.is_valid());
Node3DEditor::get_singleton()->add_gizmo_plugin(p_gizmo_plugin);
@@ -608,6 +619,8 @@ void EditorPlugin::_bind_methods() {
ClassDB::bind_method(D_METHOD("remove_scene_post_import_plugin", "scene_import_plugin"), &EditorPlugin::remove_scene_post_import_plugin);
ClassDB::bind_method(D_METHOD("add_export_plugin", "plugin"), &EditorPlugin::add_export_plugin);
ClassDB::bind_method(D_METHOD("remove_export_plugin", "plugin"), &EditorPlugin::remove_export_plugin);
+ ClassDB::bind_method(D_METHOD("add_export_platform", "platform"), &EditorPlugin::add_export_platform);
+ ClassDB::bind_method(D_METHOD("remove_export_platform", "platform"), &EditorPlugin::remove_export_platform);
ClassDB::bind_method(D_METHOD("add_node_3d_gizmo_plugin", "plugin"), &EditorPlugin::add_node_3d_gizmo_plugin);
ClassDB::bind_method(D_METHOD("remove_node_3d_gizmo_plugin", "plugin"), &EditorPlugin::remove_node_3d_gizmo_plugin);
ClassDB::bind_method(D_METHOD("add_inspector_plugin", "plugin"), &EditorPlugin::add_inspector_plugin);
diff --git a/editor/plugins/editor_plugin.h b/editor/plugins/editor_plugin.h
index f6c4b35407c..2e0771f906f 100644
--- a/editor/plugins/editor_plugin.h
+++ b/editor/plugins/editor_plugin.h
@@ -41,6 +41,7 @@ class PopupMenu;
class EditorDebuggerPlugin;
class EditorExport;
class EditorExportPlugin;
+class EditorExportPlatform;
class EditorImportPlugin;
class EditorInspectorPlugin;
class EditorInterface;
@@ -224,6 +225,9 @@ public:
void add_export_plugin(const Ref &p_exporter);
void remove_export_plugin(const Ref &p_exporter);
+ void add_export_platform(const Ref &p_platform);
+ void remove_export_platform(const Ref &p_platform);
+
void add_node_3d_gizmo_plugin(const Ref &p_gizmo_plugin);
void remove_node_3d_gizmo_plugin(const Ref &p_gizmo_plugin);
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp
index a33fc479555..d7de5a72230 100644
--- a/editor/plugins/script_editor_plugin.cpp
+++ b/editor/plugins/script_editor_plugin.cpp
@@ -578,8 +578,8 @@ void ScriptEditor::_clear_breakpoints() {
script_editor_cache->get_sections(&cached_editors);
for (const String &E : cached_editors) {
Array breakpoints = _get_cached_breakpoints_for_script(E);
- for (int i = 0; i < breakpoints.size(); i++) {
- EditorDebuggerNode::get_singleton()->set_breakpoint(E, (int)breakpoints[i] + 1, false);
+ for (int breakpoint : breakpoints) {
+ EditorDebuggerNode::get_singleton()->set_breakpoint(E, (int)breakpoint + 1, false);
}
if (breakpoints.size() > 0) {
@@ -1820,7 +1820,8 @@ void ScriptEditor::notify_script_changed(const Ref]