Godot Engine – Multi-platform 2D and 3D game engine
Fix visionOS exports containing iOS-specific device capabilities in Info.plist
Balázs Faludi20a9a3aa13c3
diff --git a/editor/export/editor_export_platform_apple_embedded.cpp b/editor/export/editor_export_platform_apple_embedded.cppindex d36af171f19..5fe9c3a66a0 100644--- a/editor/export/editor_export_platform_apple_embedded.cpp+++ b/editor/export/editor_export_platform_apple_embedded.cpp@@ -219,6 +219,14 @@ void EditorExportPlatformAppleEmbedded::get_usage_descriptions(List<EditorExportr_descriptions->push_back({ "privacy/photolibrary_usage_description", "NSPhotoLibraryUsageDescription", "Provide a message if you need access to the photo library" });}+void EditorExportPlatformAppleEmbedded::get_required_device_capabilities(const Ref<EditorExportPreset> &p_preset, Vector<String> &r_capabilities) const {+ // Note that required device capabilities are requirements for the app to be installed.+ // They don't enable anything.+ if ((bool)p_preset->get("capabilities/access_wifi") && !r_capabilities.has("wifi")) {+ r_capabilities.push_back("wifi");+ }+}+void EditorExportPlatformAppleEmbedded::_notification(int p_what) {#ifdef MACOS_ENABLEDif (p_what == NOTIFICATION_POSTINITIALIZE) {@@ -250,10 +258,6 @@ bool EditorExportPlatformAppleEmbedded::get_export_option_visibility(const Editop_option == "application/signature") {return advanced_options_enabled;}- if (p_option == "capabilities/performance_a12") {- String rendering_method = get_project_setting(Ref<EditorExportPreset>(p_preset), "rendering/renderer/rendering_method.mobile");- return !(rendering_method == "forward_plus" || rendering_method == "mobile");- }return true;}@@ -327,8 +331,6 @@ void EditorExportPlatformAppleEmbedded::get_export_options(List<ExportOption> *rr_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "entitlements/additional", PROPERTY_HINT_MULTILINE_TEXT, "monospace,no_wrap"), ""));r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/access_wifi"), false));- r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/performance_gaming_tier"), false));- r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/performance_a12"), false));r_options->push_back(ExportOption(PropertyInfo(Variant::PACKED_STRING_ARRAY, "capabilities/additional"), PackedStringArray()));r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "shader_baker/enabled"), false));@@ -522,22 +524,8 @@ String EditorExportPlatformAppleEmbedded::_process_config_file_line(const Ref<Edstrnew += p_line.replace("$entitlements_full", entitlements);} else if (p_line.contains("$required_device_capabilities")) {String capabilities;-- // I've removed armv7 as we can run on 64bit only devices- // Note that capabilities listed here are requirements for the app to be installed.- // They don't enable anything.Vector<String> capabilities_list = p_config.capabilities;- String rendering_method = get_project_setting(p_preset, "rendering/renderer/rendering_method.mobile");-- if ((bool)p_preset->get("capabilities/access_wifi") && !capabilities_list.has("wifi")) {- capabilities_list.push_back("wifi");- }- if ((bool)p_preset->get("capabilities/performance_gaming_tier") && !capabilities_list.has("iphone-performance-gaming-tier")) {- capabilities_list.push_back("iphone-performance-gaming-tier");- }- if (((bool)p_preset->get("capabilities/performance_a12") || rendering_method == "forward_plus" || rendering_method == "mobile") && !capabilities_list.has("iphone-ipad-minimum-performance-a12")) {- capabilities_list.push_back("iphone-ipad-minimum-performance-a12");- }+ get_required_device_capabilities(p_preset, capabilities_list);for (const String &capability : capabilities_list) {capabilities += "<string>" + capability + "</string>\n";}diff --git a/editor/export/editor_export_platform_apple_embedded.h b/editor/export/editor_export_platform_apple_embedded.hindex 25a35ee0497..52ae3380a46 100644--- a/editor/export/editor_export_platform_apple_embedded.h+++ b/editor/export/editor_export_platform_apple_embedded.h@@ -238,6 +238,7 @@ protected:virtual Vector<IconInfo> get_icon_infos() const = 0;virtual void get_usage_descriptions(List<UsageDescription> *r_descriptions) const;+ virtual void get_required_device_capabilities(const Ref<EditorExportPreset> &p_preset, Vector<String> &r_capabilities) const;void _notification(int p_what);diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cppindex 27d1f4d7d12..838e96d64c5 100644--- a/platform/ios/export/export_plugin.cpp+++ b/platform/ios/export/export_plugin.cpp@@ -64,6 +64,9 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options)r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "storyboard/custom_image@3x", PROPERTY_HINT_FILE_PATH, "*.png,*.jpg,*.jpeg"), ""));r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "storyboard/use_custom_bg_color"), false));r_options->push_back(ExportOption(PropertyInfo(Variant::COLOR, "storyboard/custom_bg_color"), Color()));++ r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/performance_gaming_tier"), false));+ r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/performance_a12"), false));}bool EditorExportPlatformIOS::has_valid_export_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates, bool p_debug) const {@@ -90,6 +93,16 @@ bool EditorExportPlatformIOS::has_valid_export_configuration(const Ref<EditorExpreturn valid;}+bool EditorExportPlatformIOS::get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option) const {+ if (p_preset) {+ if (p_option == "capabilities/performance_a12") {+ String rendering_method = get_project_setting(Ref<EditorExportPreset>(p_preset), "rendering/renderer/rendering_method.mobile");+ return !(rendering_method == "forward_plus" || rendering_method == "mobile");+ }+ }+ return EditorExportPlatformAppleEmbedded::get_export_option_visibility(p_preset, p_option);+}+HashMap<String, Variant> EditorExportPlatformIOS::get_custom_project_settings(const Ref<EditorExportPreset> &p_preset) const {HashMap<String, Variant> settings;@@ -230,6 +243,17 @@ Vector<EditorExportPlatformAppleEmbedded::IconInfo> EditorExportPlatformIOS::get};}+void EditorExportPlatformIOS::get_required_device_capabilities(const Ref<EditorExportPreset> &p_preset, Vector<String> &r_capabilities) const {+ EditorExportPlatformAppleEmbedded::get_required_device_capabilities(p_preset, r_capabilities);+ String rendering_method = get_project_setting(p_preset, "rendering/renderer/rendering_method.mobile");+ if ((bool)p_preset->get("capabilities/performance_gaming_tier") && !r_capabilities.has("iphone-performance-gaming-tier")) {+ r_capabilities.push_back("iphone-performance-gaming-tier");+ }+ if (((bool)p_preset->get("capabilities/performance_a12") || rendering_method == "forward_plus" || rendering_method == "mobile") && !r_capabilities.has("iphone-ipad-minimum-performance-a12")) {+ r_capabilities.push_back("iphone-ipad-minimum-performance-a12");+ }+}+String EditorExportPlatformIOS::_process_config_file_line(const Ref<EditorExportPreset> &p_preset, const String &p_line, const AppleEmbeddedConfigData &p_config, bool p_debug, const CodeSigningDetails &p_code_signing) {// Do iOS specific processing first, and call super implementation if there are no matchesdiff --git a/platform/ios/export/export_plugin.h b/platform/ios/export/export_plugin.hindex 103ce1c7096..d3cbae14b0a 100644--- a/platform/ios/export/export_plugin.h+++ b/platform/ios/export/export_plugin.h@@ -44,9 +44,11 @@ class EditorExportPlatformIOS : public EditorExportPlatformAppleEmbedded {virtual String get_minimum_deployment_target() const override { return "15.0"; }virtual Vector<IconInfo> get_icon_infos() const override;+ virtual void get_required_device_capabilities(const Ref<EditorExportPreset> &p_preset, Vector<String> &r_capabilities) const override;virtual void get_export_options(List<ExportOption> *r_options) const override;virtual bool has_valid_export_configuration(const Ref<EditorExportPreset> &p_preset, String &r_error, bool &r_missing_templates, bool p_debug = false) const override;+ virtual bool get_export_option_visibility(const EditorExportPreset *p_preset, const String &p_option) const override;virtual Error _export_loading_screen_file(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir) override;virtual HashMap<String, Variant> get_custom_project_settings(const Ref<EditorExportPreset> &p_preset) const override;diff --git a/platform/visionos/doc_classes/EditorExportPlatformVisionOS.xml b/platform/visionos/doc_classes/EditorExportPlatformVisionOS.xmlindex e87bb29dbc4..fd3db6e7c94 100644--- a/platform/visionos/doc_classes/EditorExportPlatformVisionOS.xml+++ b/platform/visionos/doc_classes/EditorExportPlatformVisionOS.xml@@ -88,14 +88,6 @@<member name="capabilities/additional" type="PackedStringArray" setter="" getter="">Additional data added to the [code]UIRequiredDeviceCapabilities[/code] array of the [code]Info.plist[/code] file.</member>- <member name="capabilities/performance_a12" type="bool" setter="" getter="">- Requires the graphics performance and features of the A12 Bionic and later chips (devices supporting all Vulkan renderer features).- Enabling this option limits supported devices to: iPhone XS, iPhone XR, iPad Mini (5th gen.), iPad Air (3rd gen.), iPad (8th gen), and newer.- </member>- <member name="capabilities/performance_gaming_tier" type="bool" setter="" getter="">- Requires the graphics performance and features of the A17 Pro and later chips.- Enabling this option limits supported devices to: iPhone 15 Pro and newer.- </member><member name="custom_template/debug" type="String" setter="" getter="">Path to the custom export template. If left empty, default template is used.</member>