diff options
Diffstat (limited to 'platform/ios/export')
-rw-r--r-- | platform/ios/export/export_plugin.cpp | 36 | ||||
-rw-r--r-- | platform/ios/export/export_plugin.h | 4 |
2 files changed, 37 insertions, 3 deletions
diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cpp index f518d7607b..91d75b0629 100644 --- a/platform/ios/export/export_plugin.cpp +++ b/platform/ios/export/export_plugin.cpp @@ -124,6 +124,16 @@ String EditorExportPlatformIOS::get_export_option_warning(const EditorExportPres return String(); } +void EditorExportPlatformIOS::_notification(int p_what) { +#ifdef MACOS_ENABLED + if (p_what == NOTIFICATION_POSTINITIALIZE) { + if (EditorExport::get_singleton()) { + 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; } @@ -2234,7 +2244,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"); @@ -2272,7 +2282,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; @@ -2310,7 +2320,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"); @@ -2379,6 +2389,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) { @@ -2643,6 +2672,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"; } |