From d9cefb34c1dd825fcceb76d430ee7410349b6a12 Mon Sep 17 00:00:00 2001 From: BastiaanOlij Date: Fri, 28 Jul 2017 10:32:08 +1000 Subject: ARKit for Godot 3.2 This PR introduces support for ARKit to the iOS version of Godot. ARKit is Apples Augmented Reality platform. This PR brings in support for ARKit 1.0 and implements a few ARKit 2.0 features. It requires iOS 11 to run but should not prevent Godot from running on older versions as long as ARKit remains unused. --- platform/iphone/export/export.cpp | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'platform/iphone/export/export.cpp') diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index b2064472e4..a9daa6ea5f 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -95,7 +95,7 @@ class EditorExportPlatformIOS : public EditorExportPlatform { Vector _get_supported_architectures(); Vector _get_preset_architectures(const Ref &p_preset); - void _add_assets_to_project(Vector &p_project_data, const Vector &p_additional_assets); + void _add_assets_to_project(const Ref &p_preset, Vector &p_project_data, const Vector &p_additional_assets); Error _export_additional_assets(const String &p_out_dir, const Vector &p_assets, bool p_is_framework, Vector &r_exported_assets); Error _export_additional_assets(const String &p_out_dir, const Vector &p_libraries, Vector &r_exported_assets); @@ -656,7 +656,7 @@ struct ExportLibsData { String dest_dir; }; -void EditorExportPlatformIOS::_add_assets_to_project(Vector &p_project_data, const Vector &p_additional_assets) { +void EditorExportPlatformIOS::_add_assets_to_project(const Ref &p_preset, Vector &p_project_data, const Vector &p_additional_assets) { Vector > export_plugins = EditorExport::get_singleton()->get_export_plugins(); Vector frameworks; for (int i = 0; i < export_plugins.size(); ++i) { @@ -714,7 +714,28 @@ void EditorExportPlatformIOS::_add_assets_to_project(Vector &p_project_ // Note, frameworks like gamekit are always included in our project.pbxprof file // even if turned off in capabilities. - // Frameworks that are used by modules (like arkit) we may need to optionally add here. + + // We do need our ARKit framework + if ((bool)p_preset->get("capabilities/arkit")) { + String build_id = (++current_id).str(); + String ref_id = (++current_id).str(); + + if (pbx_frameworks_build.length() > 0) { + pbx_frameworks_build += ",\n"; + pbx_frameworks_refs += ",\n"; + } + + pbx_frameworks_build += build_id; + pbx_frameworks_refs += ref_id; + + Dictionary format_dict; + format_dict["build_id"] = build_id; + format_dict["ref_id"] = ref_id; + format_dict["name"] = "ARKit.framework"; + format_dict["file_path"] = "System/Library/Frameworks/ARKit.framework"; + format_dict["file_type"] = "wrapper.framework"; + pbx_files += file_info_format.format(format_dict, "$_"); + } String str = String::utf8((const char *)p_project_data.ptr(), p_project_data.size()); str = str.replace("$additional_pbx_files", pbx_files); @@ -1045,7 +1066,7 @@ Error EditorExportPlatformIOS::export_project(const Ref &p_p print_line("Exporting additional assets"); Vector assets; _export_additional_assets(dest_dir + binary_name, libraries, assets); - _add_assets_to_project(project_file_data, assets); + _add_assets_to_project(p_preset, project_file_data, assets); String project_file_name = dest_dir + binary_name + ".xcodeproj/project.pbxproj"; FileAccess *f = FileAccess::open(project_file_name, FileAccess::WRITE); if (!f) { -- cgit v1.2.3