diff --git a/plugin/src/main/cpp/export/meta_export_plugin.cpp b/plugin/src/main/cpp/export/meta_export_plugin.cpp index 25938f14..f225893f 100644 --- a/plugin/src/main/cpp/export/meta_export_plugin.cpp +++ b/plugin/src/main/cpp/export/meta_export_plugin.cpp @@ -169,6 +169,15 @@ MetaEditorExportPlugin::MetaEditorExportPlugin() { PROPERTY_USAGE_DEFAULT, BOUNDARY_ENABLED_VALUE, false); + _instant_splash_screen_option = _generate_export_option( + "meta_xr_features/instant_splash_screen", + "", + Variant::Type::BOOL, + PROPERTY_HINT_NONE, + "", + PROPERTY_USAGE_DEFAULT, + false, + false); _support_quest_1_option = _generate_export_option( "meta_xr_features/quest_1_support", "", @@ -229,6 +238,7 @@ TypedArray<Dictionary> MetaEditorExportPlugin::_get_export_options(const Ref<Edi export_options.append(_use_overlay_keyboard_option); export_options.append(_use_experimental_features_option); export_options.append(_boundary_mode_option); + export_options.append(_instant_splash_screen_option); export_options.append(_support_quest_1_option); export_options.append(_support_quest_2_option); export_options.append(_support_quest_3_option); @@ -340,6 +350,10 @@ String MetaEditorExportPlugin::_get_export_option_warning(const Ref<EditorExport if (!openxr_enabled && _get_int_option(option, BOUNDARY_ENABLED_VALUE) > BOUNDARY_ENABLED_VALUE) { return "Boundary mode changes require \"XR Mode\" to be \"OpenXR\".\n"; } + } else if (option == "meta_xr_features/instant_splash_screen") { + if (!openxr_enabled && _get_bool_option(option)) { + return "\"Instant splash screen\" is only valid when \"XR Mode\" is \"OpenXR\".\n"; + } } return OpenXREditorExportPlugin::_get_export_option_warning(platform, option); @@ -458,6 +472,21 @@ String MetaEditorExportPlugin::_get_android_manifest_element_contents(const Ref< return contents; } +void MetaEditorExportPlugin::_export_begin(const PackedStringArray &p_features, bool p_is_debug, const String &p_path, uint32_t p_flags) { + bool instant_splash_screen = _get_bool_option("meta_xr_features/instant_splash_screen"); + if (!instant_splash_screen) { + return; + } + + String boot_splash_path = ProjectSettings::get_singleton()->get_setting_with_override("application/boot_splash/image"); + if (!FileAccess::file_exists(boot_splash_path)) { + return; + } + + PackedByteArray boot_splash_file = FileAccess::get_file_as_bytes(boot_splash_path); + add_file("res://vr_splash.png", boot_splash_file, true); +} + String MetaEditorExportPlugin::_get_android_manifest_application_element_contents(const Ref<EditorExportPlatform> &platform, bool debug) const { String contents; if (!_supports_platform(platform) || !_is_vendor_plugin_enabled()) { @@ -475,6 +504,11 @@ String MetaEditorExportPlugin::_get_android_manifest_application_element_content contents += " <meta-data tools:node=\"replace\" android:name=\"com.oculus.handtracking.version\" android:value=\"V2.0\" />\n"; } + bool instant_splash_screen = _get_bool_option("meta_xr_features/instant_splash_screen"); + if (instant_splash_screen) { + contents += " <meta-data android:name=\"com.oculus.ossplash\" android:value=\"true\"/>\n"; + } + if ((int)ProjectSettings::get_singleton()->get_setting_with_override("xr/openxr/environment_blend_mode") != XRInterface::XR_ENV_BLEND_MODE_OPAQUE) { // Show the splash screen in passthrough, if the user launches it from passthrough. contents += " <meta-data android:name=\"com.oculus.ossplash.background\" android:value=\"passthrough-contextual\" />\n"; diff --git a/plugin/src/main/cpp/include/export/meta_export_plugin.h b/plugin/src/main/cpp/include/export/meta_export_plugin.h index f2f21510..292cc30d 100644 --- a/plugin/src/main/cpp/include/export/meta_export_plugin.h +++ b/plugin/src/main/cpp/include/export/meta_export_plugin.h @@ -83,6 +83,8 @@ class MetaEditorExportPlugin : public OpenXREditorExportPlugin { String _get_android_manifest_application_element_contents(const Ref<EditorExportPlatform> &platform, bool debug) const override; String _get_android_manifest_element_contents(const Ref<EditorExportPlatform> &platform, bool debug) const override; + virtual void _export_begin(const PackedStringArray &p_features, bool p_is_debug, const String &p_path, uint32_t p_flags) override; + protected: static void _bind_methods(); @@ -104,6 +106,7 @@ class MetaEditorExportPlugin : public OpenXREditorExportPlugin { Dictionary _use_overlay_keyboard_option; Dictionary _use_experimental_features_option; Dictionary _boundary_mode_option; + Dictionary _instant_splash_screen_option; Dictionary _support_quest_1_option; Dictionary _support_quest_2_option; Dictionary _support_quest_3_option;