diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/export/export_plugin.cpp | 31 | ||||
-rw-r--r-- | platform/android/export/export_plugin.h | 6 | ||||
-rw-r--r-- | platform/ios/export/export_plugin.cpp | 34 | ||||
-rw-r--r-- | platform/ios/export/export_plugin.h | 4 |
4 files changed, 70 insertions, 5 deletions
diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index 459f5a5983..00e837825b 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -291,7 +291,7 @@ void EditorExportPlatformAndroid::_check_for_changes_poll_thread(void *ud) { // Check for devices updates String adb = get_adb_path(); - if (FileAccess::exists(adb)) { + if (ea->has_runnable_preset.is_set() && FileAccess::exists(adb)) { String devices; List<String> args; args.push_back("devices"); @@ -423,6 +423,25 @@ void EditorExportPlatformAndroid::_check_for_changes_poll_thread(void *ud) { OS::get_singleton()->execute(adb, args); } } + +void EditorExportPlatformAndroid::_update_preset_status() { + const int preset_count = EditorExport::get_singleton()->get_export_preset_count(); + bool has_runnable = false; + + for (int i = 0; i < preset_count; i++) { + const Ref<EditorExportPreset> &preset = EditorExport::get_singleton()->get_export_preset(i); + if (preset->get_platform() == this && preset->is_runnable()) { + has_runnable = true; + break; + } + } + + if (has_runnable) { + has_runnable_preset.set(); + } else { + has_runnable_preset.clear(); + } +} #endif String EditorExportPlatformAndroid::get_project_name(const String &p_name) const { @@ -805,6 +824,15 @@ bool EditorExportPlatformAndroid::_uses_vulkan() { return uses_vulkan; } +void EditorExportPlatformAndroid::_notification(int p_what) { +#ifndef ANDROID_ENABLED + if (p_what == NOTIFICATION_POSTINITIALIZE) { + ERR_FAIL_NULL(EditorExport::get_singleton()); + EditorExport::get_singleton()->connect_presets_runnable_updated(callable_mp(this, &EditorExportPlatformAndroid::_update_preset_status)); + } +#endif +} + void EditorExportPlatformAndroid::_get_permissions(const Ref<EditorExportPreset> &p_preset, bool p_give_internet, Vector<String> &r_permissions) { const char **aperms = android_perms; while (*aperms) { @@ -3530,6 +3558,7 @@ EditorExportPlatformAndroid::EditorExportPlatformAndroid() { android_plugins_changed.set(); #endif // DISABLE_DEPRECATED #ifndef ANDROID_ENABLED + _update_preset_status(); check_for_changes_thread.start(_check_for_changes_poll_thread, this); #endif } diff --git a/platform/android/export/export_plugin.h b/platform/android/export/export_plugin.h index c282055fba..8490ecc356 100644 --- a/platform/android/export/export_plugin.h +++ b/platform/android/export/export_plugin.h @@ -97,8 +97,10 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { #ifndef ANDROID_ENABLED Thread check_for_changes_thread; SafeFlag quit_request; + SafeFlag has_runnable_preset; static void _check_for_changes_poll_thread(void *ud); + void _update_preset_status(); #endif String get_project_name(const String &p_name) const; @@ -190,10 +192,12 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { static bool _uses_vulkan(); +protected: + void _notification(int p_what); + public: typedef Error (*EditorExportSaveFunction)(void *p_userdata, const String &p_path, const Vector<uint8_t> &p_data, int p_file, int p_total, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t> &p_key); -public: virtual void get_preset_features(const Ref<EditorExportPreset> &p_preset, List<String> *r_features) const override; virtual void get_export_options(List<ExportOption> *r_options) const override; diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cpp index d35819c34d..1e0d1a46bb 100644 --- a/platform/ios/export/export_plugin.cpp +++ b/platform/ios/export/export_plugin.cpp @@ -124,6 +124,14 @@ String EditorExportPlatformIOS::get_export_option_warning(const EditorExportPres return String(); } +void EditorExportPlatformIOS::_notification(int p_what) { +#ifdef MACOS_ENABLED + if (p_what == NOTIFICATION_POSTINITIALIZE) { + EditorExport::get_singleton()->connect_presets_runnable_updated(callable_mp(this, &EditorExportPlatformIOS::_update_preset_status)); + } +#endif +} + bool EditorExportPlatformIOS::get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option) const { return true; } @@ -2228,7 +2236,7 @@ void EditorExportPlatformIOS::_check_for_changes_poll_thread(void *ud) { // Enum real devices (via ios_deploy, pre Xcode 15). String idepl = EDITOR_GET("export/ios/ios_deploy"); - if (!idepl.is_empty()) { + if (ea->has_runnable_preset.is_set() && !idepl.is_empty()) { String devices; List<String> args; args.push_back("-c"); @@ -2266,7 +2274,7 @@ void EditorExportPlatformIOS::_check_for_changes_poll_thread(void *ud) { } // Enum simulators. - if (_check_xcode_install() && (FileAccess::exists("/usr/bin/xcrun") || FileAccess::exists("/bin/xcrun"))) { + if (ea->has_runnable_preset.is_set() && _check_xcode_install() && (FileAccess::exists("/usr/bin/xcrun") || FileAccess::exists("/bin/xcrun"))) { { String devices; List<String> args; @@ -2304,7 +2312,7 @@ void EditorExportPlatformIOS::_check_for_changes_poll_thread(void *ud) { } // Enum simulators. - { + if (ea->has_runnable_preset.is_set()) { String devices; List<String> args; args.push_back("simctl"); @@ -2373,6 +2381,25 @@ void EditorExportPlatformIOS::_check_for_changes_poll_thread(void *ud) { } } } + +void EditorExportPlatformIOS::_update_preset_status() { + const int preset_count = EditorExport::get_singleton()->get_export_preset_count(); + bool has_runnable = false; + + for (int i = 0; i < preset_count; i++) { + const Ref<EditorExportPreset> &preset = EditorExport::get_singleton()->get_export_preset(i); + if (preset->get_platform() == this && preset->is_runnable()) { + has_runnable = true; + break; + } + } + + if (has_runnable) { + has_runnable_preset.set(); + } else { + has_runnable_preset.clear(); + } +} #endif Error EditorExportPlatformIOS::run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) { @@ -2637,6 +2664,7 @@ EditorExportPlatformIOS::EditorExportPlatformIOS() { plugins_changed.set(); devices_changed.set(); #ifdef MACOS_ENABLED + _update_preset_status(); check_for_changes_thread.start(_check_for_changes_poll_thread, this); #endif } diff --git a/platform/ios/export/export_plugin.h b/platform/ios/export/export_plugin.h index edbe566dab..197f27da76 100644 --- a/platform/ios/export/export_plugin.h +++ b/platform/ios/export/export_plugin.h @@ -81,9 +81,11 @@ class EditorExportPlatformIOS : public EditorExportPlatform { #ifdef MACOS_ENABLED Thread check_for_changes_thread; SafeFlag quit_request; + SafeFlag has_runnable_preset; static bool _check_xcode_install(); static void _check_for_changes_poll_thread(void *ud); + void _update_preset_status(); #endif typedef Error (*FileHandler)(String p_file, void *p_userdata); @@ -152,6 +154,8 @@ protected: virtual bool get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option) const override; virtual String get_export_option_warning(const EditorExportPreset *p_preset, const StringName &p_name) const override; + void _notification(int p_what); + public: virtual String get_name() const override { return "iOS"; } virtual String get_os_name() const override { return "iOS"; } |