Browse Source

[3.x, iOS] Remove deprecated LaunchImages support and switch to Storyboard by default.

bruvzg 1 year ago
parent
commit
5255b661b4

+ 0 - 2
misc/dist/ios_xcode/godot_ios.xcodeproj/project.pbxproj

@@ -308,7 +308,6 @@
 			buildSettings = {
 				ARCHS = "$godot_archs";
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-				$pbx_launch_image_usage_setting
 				CODE_SIGN_ENTITLEMENTS = "$binary/$binary.entitlements";
 				CODE_SIGN_IDENTITY = "$code_sign_identity_debug";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_debug";
@@ -340,7 +339,6 @@
 			buildSettings = {
 				ARCHS = "$godot_archs";
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
-				$pbx_launch_image_usage_setting
 				CODE_SIGN_ENTITLEMENTS = "$binary/$binary.entitlements";
 				CODE_SIGN_IDENTITY = "$code_sign_identity_release";
 				"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "$code_sign_identity_release";

+ 0 - 102
misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Contents.json

@@ -1,102 +0,0 @@
-{
-  "images" : [
-    {
-      "extent" : "full-screen",
-      "idiom" : "iphone",
-      "subtype" : "2436h",
-      "filename" : "Default-Portrait-X.png",
-      "minimum-system-version" : "11.0",
-      "orientation" : "portrait",
-      "scale" : "3x"
-    },
-    {
-      "extent" : "full-screen",
-      "idiom" : "iphone",
-      "subtype" : "2436h",
-      "filename" : "Default-Landscape-X.png",
-      "minimum-system-version" : "11.0",
-      "orientation" : "landscape",
-      "scale" : "3x"
-    },
-    {
-      "extent" : "full-screen",
-      "idiom" : "iphone",
-      "subtype" : "736h",
-      "filename" : "[email protected]",
-      "minimum-system-version" : "8.0",
-      "orientation" : "portrait",
-      "scale" : "3x"
-    },
-    {
-      "extent" : "full-screen",
-      "idiom" : "iphone",
-      "subtype" : "736h",
-      "filename" : "[email protected]",
-      "minimum-system-version" : "8.0",
-      "orientation" : "landscape",
-      "scale" : "3x"
-    },
-    {
-      "extent" : "full-screen",
-      "idiom" : "iphone",
-      "subtype" : "667h",
-      "filename" : "[email protected]",
-      "minimum-system-version" : "8.0",
-      "orientation" : "portrait",
-      "scale" : "2x"
-    },
-    {
-      "orientation" : "portrait",
-      "idiom" : "iphone",
-      "filename" : "[email protected]",
-      "extent" : "full-screen",
-      "minimum-system-version" : "7.0",
-      "scale" : "2x"
-    },
-    {
-      "extent" : "full-screen",
-      "idiom" : "iphone",
-      "subtype" : "retina4",
-      "filename" : "[email protected]",
-      "minimum-system-version" : "7.0",
-      "orientation" : "portrait",
-      "scale" : "2x"
-    },
-    {
-      "orientation" : "portrait",
-      "idiom" : "ipad",
-      "filename" : "Default-Portrait.png",
-      "extent" : "full-screen",
-      "minimum-system-version" : "7.0",
-      "scale" : "1x"
-    },
-    {
-      "orientation" : "landscape",
-      "idiom" : "ipad",
-      "filename" : "Default-Landscape.png",
-      "extent" : "full-screen",
-      "minimum-system-version" : "7.0",
-      "scale" : "1x"
-    },
-    {
-      "orientation" : "portrait",
-      "idiom" : "ipad",
-      "filename" : "[email protected]",
-      "extent" : "full-screen",
-      "minimum-system-version" : "7.0",
-      "scale" : "2x"
-    },
-    {
-      "orientation" : "landscape",
-      "idiom" : "ipad",
-      "filename" : "[email protected]",
-      "extent" : "full-screen",
-      "minimum-system-version" : "7.0",
-      "scale" : "2x"
-    }
-  ],
-  "info" : {
-    "version" : 1,
-    "author" : "xcode"
-  }
-}

BIN
misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/[email protected]


BIN
misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/[email protected]


BIN
misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/[email protected]


BIN
misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/[email protected]


BIN
misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape-X.png


BIN
misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Landscape.png


BIN
misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/[email protected]


BIN
misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/[email protected]


BIN
misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait-X.png


BIN
misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/Default-Portrait.png


BIN
misc/dist/ios_xcode/godot_ios/Images.xcassets/LaunchImage.launchimage/[email protected]


+ 10 - 160
platform/iphone/export/export.cpp

@@ -108,7 +108,6 @@ class EditorExportPlatformIOS : public EditorExportPlatform {
 	String _get_linker_flags();
 	String _get_cpp_code();
 	void _fix_config_file(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &pfile, const IOSConfigData &p_config, bool p_debug);
-	Error _export_loading_screen_images(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir);
 	Error _export_loading_screen_file(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir);
 	Error _export_icons(const Ref<EditorExportPreset> &p_preset, const String &p_iconset_dir);
 
@@ -322,29 +321,6 @@ Vector<EditorExportPlatformIOS::ExportArchitecture> EditorExportPlatformIOS::_ge
 	return archs;
 }
 
-struct LoadingScreenInfo {
-	const char *preset_key;
-	const char *export_name;
-	int width;
-	int height;
-	bool rotate;
-};
-
-static const LoadingScreenInfo loading_screen_infos[] = {
-	{ PNAME("landscape_launch_screens/iphone_2436x1125"), "Default-Landscape-X.png", 2436, 1125, false },
-	{ PNAME("landscape_launch_screens/iphone_2208x1242"), "[email protected]", 2208, 1242, false },
-	{ PNAME("landscape_launch_screens/ipad_1024x768"), "Default-Landscape.png", 1024, 768, false },
-	{ PNAME("landscape_launch_screens/ipad_2048x1536"), "[email protected]", 2048, 1536, false },
-
-	{ PNAME("portrait_launch_screens/iphone_640x960"), "[email protected]", 640, 960, false },
-	{ PNAME("portrait_launch_screens/iphone_640x1136"), "[email protected]", 640, 1136, false },
-	{ PNAME("portrait_launch_screens/iphone_750x1334"), "[email protected]", 750, 1334, false },
-	{ PNAME("portrait_launch_screens/iphone_1125x2436"), "Default-Portrait-X.png", 1125, 2436, false },
-	{ PNAME("portrait_launch_screens/ipad_768x1024"), "Default-Portrait.png", 768, 1024, false },
-	{ PNAME("portrait_launch_screens/ipad_1536x2048"), "[email protected]", 1536, 2048, false },
-	{ PNAME("portrait_launch_screens/iphone_1242x2208"), "[email protected]", 1242, 2208, false }
-};
-
 void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options) {
 	r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/debug", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
 	r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "custom_template/release", PROPERTY_HINT_GLOBAL_FILE, "*.zip"), ""));
@@ -374,7 +350,6 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options)
 	r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "application/copyright"), ""));
 
 	r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/icon_interpolation", PROPERTY_HINT_ENUM, "Nearest neighbor,Bilinear,Cubic,Trilinear,Lanczos"), 4));
-	r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "application/launch_screens_interpolation", PROPERTY_HINT_ENUM, "Nearest neighbor,Bilinear,Cubic,Trilinear,Lanczos"), 4));
 
 	Vector<PluginConfigIOS> found_plugins = get_plugins();
 	for (int i = 0; i < found_plugins.size(); i++) {
@@ -430,16 +405,11 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options)
 	r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "icons/spotlight_40x40", PROPERTY_HINT_FILE, "*.png,*.jpg,*.jpeg"), "")); // Spotlight
 	r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "icons/spotlight_80x80", PROPERTY_HINT_FILE, "*.png,*.jpg,*.jpeg"), "")); // Spotlight on devices with Retina display
 
-	r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "storyboard/use_launch_screen_storyboard"), false));
 	r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "storyboard/image_scale_mode", PROPERTY_HINT_ENUM, "Same as Logo,Center,Scale to Fit,Scale to Fill,Scale"), 0));
 	r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "storyboard/custom_image@2x", PROPERTY_HINT_FILE, "*.png,*.jpg,*.jpeg"), ""));
 	r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "storyboard/custom_image@3x", PROPERTY_HINT_FILE, "*.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()));
-
-	for (uint64_t i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) {
-		r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, loading_screen_infos[i].preset_key, PROPERTY_HINT_FILE, "*.png,*.jpg,*.jpeg"), ""));
-	}
 }
 
 void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_preset, Vector<uint8_t> &pfile, const IOSConfigData &p_config, bool p_debug) {
@@ -612,29 +582,24 @@ void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_
 			String description = p_preset->get("privacy/photolibrary_usage_description");
 			strnew += lines[i].replace("$photolibrary_usage_description", description) + "\n";
 		} else if (lines[i].find("$plist_launch_screen_name") != -1) {
-			bool is_on = p_preset->get("storyboard/use_launch_screen_storyboard");
-			String value = is_on ? "<key>UILaunchStoryboardName</key>\n<string>Launch Screen</string>" : "";
+			String value = "<key>UILaunchStoryboardName</key>\n<string>Launch Screen</string>";
 			strnew += lines[i].replace("$plist_launch_screen_name", value) + "\n";
 		} else if (lines[i].find("$pbx_launch_screen_file_reference") != -1) {
-			bool is_on = p_preset->get("storyboard/use_launch_screen_storyboard");
-			String value = is_on ? "90DD2D9D24B36E8000717FE1 = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = \"Launch Screen.storyboard\"; sourceTree = \"<group>\"; };" : "";
+			String value = "90DD2D9D24B36E8000717FE1 = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = \"Launch Screen.storyboard\"; sourceTree = \"<group>\"; };";
 			strnew += lines[i].replace("$pbx_launch_screen_file_reference", value) + "\n";
 		} else if (lines[i].find("$pbx_launch_screen_copy_files") != -1) {
-			bool is_on = p_preset->get("storyboard/use_launch_screen_storyboard");
-			String value = is_on ? "90DD2D9D24B36E8000717FE1 /* Launch Screen.storyboard */," : "";
+			String value = "90DD2D9D24B36E8000717FE1 /* Launch Screen.storyboard */,";
 			strnew += lines[i].replace("$pbx_launch_screen_copy_files", value) + "\n";
 		} else if (lines[i].find("$pbx_launch_screen_build_phase") != -1) {
-			bool is_on = p_preset->get("storyboard/use_launch_screen_storyboard");
-			String value = is_on ? "90DD2D9E24B36E8000717FE1 /* Launch Screen.storyboard in Resources */," : "";
+			String value = "90DD2D9E24B36E8000717FE1 /* Launch Screen.storyboard in Resources */,";
 			strnew += lines[i].replace("$pbx_launch_screen_build_phase", value) + "\n";
 		} else if (lines[i].find("$pbx_launch_screen_build_reference") != -1) {
-			bool is_on = p_preset->get("storyboard/use_launch_screen_storyboard");
-			String value = is_on ? "90DD2D9E24B36E8000717FE1 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 90DD2D9D24B36E8000717FE1 /* Launch Screen.storyboard */; };" : "";
+			String value = "90DD2D9E24B36E8000717FE1 /* Launch Screen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 90DD2D9D24B36E8000717FE1 /* Launch Screen.storyboard */; };";
 			strnew += lines[i].replace("$pbx_launch_screen_build_reference", value) + "\n";
+#ifndef DISABLE_DEPRECATED
 		} else if (lines[i].find("$pbx_launch_image_usage_setting") != -1) {
-			bool is_on = p_preset->get("storyboard/use_launch_screen_storyboard");
-			String value = is_on ? "" : "ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;";
-			strnew += lines[i].replace("$pbx_launch_image_usage_setting", value) + "\n";
+			strnew += lines[i].replace("$pbx_launch_image_usage_setting", "") + "\n";
+#endif
 		} else if (lines[i].find("$launch_screen_image_mode") != -1) {
 			int image_scale_mode = p_preset->get("storyboard/image_scale_mode");
 			String value;
@@ -1007,98 +972,6 @@ Error EditorExportPlatformIOS::_export_loading_screen_file(const Ref<EditorExpor
 	return OK;
 }
 
-Error EditorExportPlatformIOS::_export_loading_screen_images(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir) {
-	DirAccess *da = DirAccess::open(p_dest_dir);
-	ERR_FAIL_COND_V_MSG(!da, ERR_CANT_OPEN, "Cannot open directory '" + p_dest_dir + "'.");
-
-	for (uint64_t i = 0; i < sizeof(loading_screen_infos) / sizeof(loading_screen_infos[0]); ++i) {
-		LoadingScreenInfo info = loading_screen_infos[i];
-		String loading_screen_file = p_preset->get(info.preset_key);
-
-		Color boot_bg_color = ProjectSettings::get_singleton()->get("application/boot_splash/bg_color");
-		String boot_logo_path = ProjectSettings::get_singleton()->get("application/boot_splash/image");
-		bool boot_logo_scale = ProjectSettings::get_singleton()->get("application/boot_splash/fullsize");
-
-		if (loading_screen_file.size() > 0) {
-			// Load custom loading screens, and resize if required.
-			Ref<Image> img = memnew(Image);
-			Error err = ImageLoader::load_image(loading_screen_file, img);
-			if (err != OK) {
-				ERR_PRINT("Invalid loading screen (" + String(info.preset_key) + "): '" + loading_screen_file + "'.");
-				return ERR_UNCONFIGURED;
-			}
-			if (img->get_width() != info.width || img->get_height() != info.height) {
-				WARN_PRINT("Loading screen (" + String(info.preset_key) + "): '" + loading_screen_file + "' has incorrect size (" + String::num_int64(img->get_width()) + "x" + String::num_int64(img->get_height()) + ") and was automatically resized to " + String::num_int64(info.width) + "x" + String::num_int64(info.height) + ".");
-				float aspect_ratio = (float)img->get_width() / (float)img->get_height();
-				if (boot_logo_scale) {
-					if (info.height * aspect_ratio <= info.width) {
-						img->resize(info.height * aspect_ratio, info.height, (Image::Interpolation)(p_preset->get("application/launch_screens_interpolation").operator int()));
-					} else {
-						img->resize(info.width, info.width / aspect_ratio, (Image::Interpolation)(p_preset->get("application/launch_screens_interpolation").operator int()));
-					}
-				}
-				Ref<Image> new_img = memnew(Image);
-				new_img->create(info.width, info.height, false, Image::FORMAT_RGBA8);
-				new_img->fill(boot_bg_color);
-				_blend_and_rotate(new_img, img, false);
-				err = new_img->save_png(p_dest_dir + info.export_name);
-			} else {
-				err = da->copy(loading_screen_file, p_dest_dir + info.export_name);
-			}
-			if (err) {
-				memdelete(da);
-				String err_str = String("Failed to export loading screen (") + info.preset_key + ") from path '" + loading_screen_file + "'.";
-				ERR_PRINT(err_str.utf8().get_data());
-				return err;
-			}
-		} else {
-			// Generate loading screen from the splash screen
-			Ref<Image> img = memnew(Image);
-			img->create(info.width, info.height, false, Image::FORMAT_RGBA8);
-			img->fill(boot_bg_color);
-
-			Ref<Image> img_bs;
-
-			if (boot_logo_path.length() > 0) {
-				img_bs = Ref<Image>(memnew(Image));
-				ImageLoader::load_image(boot_logo_path, img_bs);
-			}
-			if (!img_bs.is_valid()) {
-				img_bs = Ref<Image>(memnew(Image(boot_splash_png)));
-			}
-			if (img_bs.is_valid()) {
-				float aspect_ratio = (float)img_bs->get_width() / (float)img_bs->get_height();
-				if (info.rotate) {
-					if (boot_logo_scale) {
-						if (info.width * aspect_ratio <= info.height) {
-							img_bs->resize(info.width * aspect_ratio, info.width, (Image::Interpolation)(p_preset->get("application/launch_screens_interpolation").operator int()));
-						} else {
-							img_bs->resize(info.height, info.height / aspect_ratio, (Image::Interpolation)(p_preset->get("application/launch_screens_interpolation").operator int()));
-						}
-					}
-				} else {
-					if (boot_logo_scale) {
-						if (info.height * aspect_ratio <= info.width) {
-							img_bs->resize(info.height * aspect_ratio, info.height, (Image::Interpolation)(p_preset->get("application/launch_screens_interpolation").operator int()));
-						} else {
-							img_bs->resize(info.width, info.width / aspect_ratio, (Image::Interpolation)(p_preset->get("application/launch_screens_interpolation").operator int()));
-						}
-					}
-				}
-				_blend_and_rotate(img, img_bs, info.rotate);
-			}
-			Error err = img->save_png(p_dest_dir + info.export_name);
-			if (err) {
-				String err_str = String("Failed to export loading screen (") + info.preset_key + ") from splash screen.";
-				WARN_PRINT(err_str.utf8().get_data());
-			}
-		}
-	}
-	memdelete(da);
-
-	return OK;
-}
-
 Error EditorExportPlatformIOS::_walk_dir_recursive(DirAccess *p_da, FileHandler p_handler, void *p_userdata) {
 	Vector<String> dirs;
 	String path;
@@ -2022,9 +1895,6 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
 		return err;
 	}
 
-	bool use_storyboard = p_preset->get("storyboard/use_launch_screen_storyboard");
-
-	String launch_image_path = dest_dir + binary_name + "/Images.xcassets/LaunchImage.launchimage/";
 	String splash_image_path = dest_dir + binary_name + "/Images.xcassets/SplashImage.imageset/";
 
 	DirAccess *launch_screen_da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
@@ -2033,29 +1903,9 @@ Error EditorExportPlatformIOS::export_project(const Ref<EditorExportPreset> &p_p
 		return ERR_CANT_CREATE;
 	}
 
-	if (use_storyboard) {
-		print_line("Using Launch Storyboard");
-
-		if (launch_screen_da->change_dir(launch_image_path) == OK) {
-			launch_screen_da->erase_contents_recursive();
-			launch_screen_da->remove(launch_image_path);
-		}
-
-		err = _export_loading_screen_file(p_preset, splash_image_path);
-	} else {
-		print_line("Using Launch Images");
-
-		const String launch_screen_path = dest_dir + binary_name + "/Launch Screen.storyboard";
-
-		launch_screen_da->remove(launch_screen_path);
+	print_line("Exporting launch screen storyboard");
 
-		if (launch_screen_da->change_dir(splash_image_path) == OK) {
-			launch_screen_da->erase_contents_recursive();
-			launch_screen_da->remove(splash_image_path);
-		}
-
-		err = _export_loading_screen_images(p_preset, launch_image_path);
-	}
+	err = _export_loading_screen_file(p_preset, splash_image_path);
 
 	memdelete(launch_screen_da);