Skip to content

armgit / godot

Public Imported from GitHub
0

Godot Engine – Multi-platform 2D and 3D game engine

[iOS] Use unique splash image set name to avoid caching.

Pāvels Nadtočajevs4fb8381639b7
diff --git a/editor/export/editor_export_platform_apple_embedded.cpp b/editor/export/editor_export_platform_apple_embedded.cpp
index 3398f846cc7..f543680ccab 100644
--- a/editor/export/editor_export_platform_apple_embedded.cpp
+++ b/editor/export/editor_export_platform_apple_embedded.cpp
@@ -1924,6 +1924,21 @@ Error EditorExportPlatformAppleEmbedded::_export_project_helper(const Ref<Editor
return err;
}
+ // Generate a unique name for the launch screen to avoid caching.
+ {
+ const String custom_launch_image_2x = p_preset->get("storyboard/custom_image@2x");
+ const String custom_launch_image_3x = p_preset->get("storyboard/custom_image@3x");
+
+ String launch_image_hash;
+ if (custom_launch_image_2x.length() > 0 && custom_launch_image_3x.length() > 0) {
+ Vector<String> launch_scr_files;
+ launch_scr_files.push_back(custom_launch_image_2x);
+ launch_scr_files.push_back(custom_launch_image_3x);
+ launch_image_hash = "_" + FileAccess::get_multiple_md5(launch_scr_files);
+ }
+ launch_screen_image_file_name = "SplashImage" + launch_image_hash;
+ }
+
//export rest of the files
int ret = unzGoToFirstFile(src_pkg_zip);
Vector<uint8_t> project_file_data;
@@ -1953,6 +1968,8 @@ Error EditorExportPlatformAppleEmbedded::_export_project_helper(const Ref<Editor
//write
+ file = file.replace("Images.xcassets/SplashImage.imageset", "Images.xcassets/" + launch_screen_image_file_name + ".imageset");
+
if (files_to_parse.has(file)) {
_fix_config_file(p_preset, data, config_data, p_debug);
} else if (file.begins_with("libgodot") && file.contains(get_platform_name())) {
@@ -2128,13 +2145,14 @@ Error EditorExportPlatformAppleEmbedded::_export_project_helper(const Ref<Editor
}
{
- String splash_image_path = binary_dir + "/Images.xcassets/SplashImage.imageset/";
+ String splash_image_path = binary_dir + "/Images.xcassets/" + launch_screen_image_file_name + ".imageset/";
Ref<DirAccess> launch_screen_da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
if (launch_screen_da.is_null()) {
add_message(EXPORT_MESSAGE_ERROR, TTR("Export"), TTR("Could not access the filesystem."));
return ERR_CANT_CREATE;
}
+ launch_screen_da->make_dir_recursive(splash_image_path);
print_line("Exporting launch screen storyboard");
diff --git a/editor/export/editor_export_platform_apple_embedded.h b/editor/export/editor_export_platform_apple_embedded.h
index 2358976e3e1..6420a225db9 100644
--- a/editor/export/editor_export_platform_apple_embedded.h
+++ b/editor/export/editor_export_platform_apple_embedded.h
@@ -209,6 +209,8 @@ private:
protected:
virtual String _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);
+ String launch_screen_image_file_name;
+
void _blend_and_rotate(Ref<Image> &p_dst, Ref<Image> &p_src, bool p_rot);
virtual Error _export_loading_screen_file(const Ref<EditorExportPreset> &p_preset, const String &p_dest_dir) { return OK; }
diff --git a/misc/dist/apple_embedded_xcode/godot_apple_embedded/Launch Screen.storyboard b/misc/dist/apple_embedded_xcode/godot_apple_embedded/Launch Screen.storyboard
index 3a7752a669b..08a7972a6b2 100644
--- a/misc/dist/apple_embedded_xcode/godot_apple_embedded/Launch Screen.storyboard
+++ b/misc/dist/apple_embedded_xcode/godot_apple_embedded/Launch Screen.storyboard
@@ -16,7 +16,7 @@
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
- <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="$launch_screen_image_mode" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="SplashImage" translatesAutoresizingMaskIntoConstraints="NO" id="tjZ-vn-Lsv">
+ <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="$launch_screen_image_mode" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="$launch_screen_image_file_name" translatesAutoresizingMaskIntoConstraints="NO" id="tjZ-vn-Lsv">
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
</imageView>
</subviews>
@@ -36,6 +36,6 @@
</scene>
</scenes>
<resources>
- <image name="SplashImage" width="266.66665649414062" height="200"/>
+ <image name="$launch_screen_image_file_name" width="266.66665649414062" height="200"/>
</resources>
</document>
diff --git a/platform/ios/export/export_plugin.cpp b/platform/ios/export/export_plugin.cpp
index fa5211f9ddb..e9ce8bab33c 100644
--- a/platform/ios/export/export_plugin.cpp
+++ b/platform/ios/export/export_plugin.cpp
@@ -456,7 +456,9 @@ String EditorExportPlatformIOS::_process_config_file_line(const Ref<EditorExport
}
}
- strnew += p_line.replace("$launch_screen_image_mode", value) + "\n";
+ strnew += p_line.replace("$launch_screen_image_mode", value).replace("$launch_screen_image_file_name", launch_screen_image_file_name) + "\n";
+ } else if (p_line.contains("$launch_screen_image_file_name")) {
+ strnew += p_line.replace("$launch_screen_image_file_name", launch_screen_image_file_name) + "\n";
} else if (p_line.contains("$launch_screen_background_color")) {
bool use_custom = p_preset->get("storyboard/use_custom_bg_color");
Color color = use_custom ? p_preset->get("storyboard/custom_bg_color") : get_project_setting(p_preset, "application/boot_splash/bg_color");