From b52e1be2c267e741d3d0a3a9da58b2a3091956fd Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Sun, 2 Jul 2023 23:56:52 -0700 Subject: [PATCH] Clean up the XR features parameters from core Following on the previous commit, the XR features logic have now be moved to the Godot OpenXR loader plugin. See https://github.com/GodotVR/godot_openxr_loaders/pull/38 --- .../EditorExportPlatformAndroid.xml | 6 --- platform/android/export/export_plugin.cpp | 30 ----------- .../android/export/gradle_export_util.cpp | 53 ------------------- platform/android/export/gradle_export_util.h | 16 ------ 4 files changed, 105 deletions(-) diff --git a/platform/android/doc_classes/EditorExportPlatformAndroid.xml b/platform/android/doc_classes/EditorExportPlatformAndroid.xml index 57c1c99962f5..d61d63d2422a 100644 --- a/platform/android/doc_classes/EditorExportPlatformAndroid.xml +++ b/platform/android/doc_classes/EditorExportPlatformAndroid.xml @@ -584,12 +584,6 @@ Application version visible to the user. - - - - - - diff --git a/platform/android/export/export_plugin.cpp b/platform/android/export/export_plugin.cpp index ea76b6fc34cd..cdffee9318c4 100644 --- a/platform/android/export/export_plugin.cpp +++ b/platform/android/export/export_plugin.cpp @@ -832,16 +832,6 @@ void EditorExportPlatformAndroid::_get_permissions(const Ref r_permissions.push_back("android.permission.INTERNET"); } } - - int xr_mode_index = p_preset->get("xr_features/xr_mode"); - if (xr_mode_index == XR_MODE_OPENXR) { - int hand_tracking_index = p_preset->get("xr_features/hand_tracking"); // 0: none, 1: optional, 2: required - if (hand_tracking_index > XR_HAND_TRACKING_NONE) { - if (r_permissions.find("com.oculus.permission.HAND_TRACKING") == -1) { - r_permissions.push_back("com.oculus.permission.HAND_TRACKING"); - } - } - } } void EditorExportPlatformAndroid::_write_tmp_manifest(const Ref &p_preset, bool p_give_internet, bool p_debug) { @@ -881,7 +871,6 @@ void EditorExportPlatformAndroid::_write_tmp_manifest(const Ref(this), p_preset, _has_read_write_storage_permission(perms), p_debug); manifest_text += "\n"; String manifest_path = vformat("res://android/build/src/%s/AndroidManifest.xml", (p_debug ? "debug" : "release")); @@ -1751,22 +1740,6 @@ String EditorExportPlatformAndroid::get_export_option_warning(const EditorExport if (xr_mode_index == XR_MODE_OPENXR && !gradle_build_enabled) { return TTR("OpenXR requires \"Use Gradle Build\" to be enabled"); } - } else if (p_name == "xr_features/hand_tracking") { - int xr_mode_index = p_preset->get("xr_features/xr_mode"); - int hand_tracking = p_preset->get("xr_features/hand_tracking"); - if (xr_mode_index != XR_MODE_OPENXR) { - if (hand_tracking > XR_HAND_TRACKING_NONE) { - return TTR("\"Hand Tracking\" is only valid when \"XR Mode\" is \"OpenXR\"."); - } - } - } else if (p_name == "xr_features/passthrough") { - int xr_mode_index = p_preset->get("xr_features/xr_mode"); - int passthrough_mode = p_preset->get("xr_features/passthrough"); - if (xr_mode_index != XR_MODE_OPENXR) { - if (passthrough_mode > XR_PASSTHROUGH_NONE) { - return TTR("\"Passthrough\" is only valid when \"XR Mode\" is \"OpenXR\"."); - } - } } else if (p_name == "gradle_build/export_format") { bool gradle_build_enabled = p_preset->get("gradle_build/use_gradle_build"); if (int(p_preset->get("gradle_build/export_format")) == EXPORT_FORMAT_AAB && !gradle_build_enabled) { @@ -1874,9 +1847,6 @@ void EditorExportPlatformAndroid::get_export_options(List *r_optio r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "graphics/opengl_debug"), false)); r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/xr_mode", PROPERTY_HINT_ENUM, "Regular,OpenXR"), XR_MODE_REGULAR, false, true)); - r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/hand_tracking", PROPERTY_HINT_ENUM, "None,Optional,Required"), XR_HAND_TRACKING_NONE, false, true)); - r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/hand_tracking_frequency", PROPERTY_HINT_ENUM, "Low,High"), XR_HAND_TRACKING_FREQUENCY_LOW)); - r_options->push_back(ExportOption(PropertyInfo(Variant::INT, "xr_features/passthrough", PROPERTY_HINT_ENUM, "None,Optional,Required"), XR_PASSTHROUGH_NONE, false, true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/immersive_mode"), true)); r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "screen/support_small"), true)); diff --git a/platform/android/export/gradle_export_util.cpp b/platform/android/export/gradle_export_util.cpp index 78a439284d88..d0d0c34bb4e5 100644 --- a/platform/android/export/gradle_export_util.cpp +++ b/platform/android/export/gradle_export_util.cpp @@ -254,28 +254,6 @@ String _get_screen_sizes_tag(const Ref &p_preset) { return manifest_screen_sizes; } -String _get_xr_features_tag(const Ref &p_preset) { - String manifest_xr_features; - int xr_mode_index = (int)(p_preset->get("xr_features/xr_mode")); - bool uses_xr = xr_mode_index == XR_MODE_OPENXR; - if (uses_xr) { - int hand_tracking_index = p_preset->get("xr_features/hand_tracking"); // 0: none, 1: optional, 2: required - if (hand_tracking_index == XR_HAND_TRACKING_OPTIONAL) { - manifest_xr_features += " \n"; - } else if (hand_tracking_index == XR_HAND_TRACKING_REQUIRED) { - manifest_xr_features += " \n"; - } - - int passthrough_mode = p_preset->get("xr_features/passthrough"); - if (passthrough_mode == XR_PASSTHROUGH_OPTIONAL) { - manifest_xr_features += " \n"; - } else if (passthrough_mode == XR_PASSTHROUGH_REQUIRED) { - manifest_xr_features += " \n"; - } - } - return manifest_xr_features; -} - String _get_activity_tag(const Ref &p_export_platform, const Ref &p_preset, bool p_debug) { String orientation = _get_android_orientation_label(DisplayServer::ScreenOrientation(int(GLOBAL_GET("display/window/handheld/orientation")))); String manifest_activity_text = vformat( @@ -293,22 +271,6 @@ String _get_activity_tag(const Ref &p_export_platform, con " \n" " \n"; - int xr_mode_index = (int)(p_preset->get("xr_features/xr_mode")); - bool uses_xr = xr_mode_index == XR_MODE_OPENXR; - if (uses_xr) { - manifest_activity_text += "\n" - " \n" - " \n" - "\n" - " \n" - " \n" - "\n" - " \n" - " \n"; - } - bool uses_leanback_category = p_preset->get("package/show_in_android_tv"); if (uses_leanback_category) { manifest_activity_text += " \n"; @@ -341,9 +303,6 @@ String _get_application_tag(const Ref &p_export_platform, int app_category_index = (int)(p_preset->get("package/app_category")); bool is_game = app_category_index == APP_CATEGORY_GAME; - int xr_mode_index = (int)(p_preset->get("xr_features/xr_mode")); - bool uses_xr = xr_mode_index == XR_MODE_OPENXR; - String manifest_application_text = vformat( " &p_export_platform, bool_to_string(p_preset->get("package/retain_data_on_uninstall")), bool_to_string(p_has_read_write_storage_permission)); - if (uses_xr) { - bool hand_tracking_enabled = (int)(p_preset->get("xr_features/hand_tracking")) > XR_HAND_TRACKING_NONE; - if (hand_tracking_enabled) { - int hand_tracking_frequency_index = p_preset->get("xr_features/hand_tracking_frequency"); - String hand_tracking_frequency = hand_tracking_frequency_index == XR_HAND_TRACKING_FREQUENCY_LOW ? "LOW" : "HIGH"; - manifest_application_text += vformat( - " \n", - hand_tracking_frequency); - manifest_application_text += " \n"; - } - } - Vector> export_plugins = EditorExport::get_singleton()->get_export_plugins(); for (int i = 0; i < export_plugins.size(); i++) { if (export_plugins[i]->supports_platform(p_export_platform)) { diff --git a/platform/android/export/gradle_export_util.h b/platform/android/export/gradle_export_util.h index ad2ab31dad36..2498394adda1 100644 --- a/platform/android/export/gradle_export_util.h +++ b/platform/android/export/gradle_export_util.h @@ -61,20 +61,6 @@ static const int APP_CATEGORY_VIDEO = 8; static const int XR_MODE_REGULAR = 0; static const int XR_MODE_OPENXR = 1; -// Supported XR hand tracking modes. -static const int XR_HAND_TRACKING_NONE = 0; -static const int XR_HAND_TRACKING_OPTIONAL = 1; -static const int XR_HAND_TRACKING_REQUIRED = 2; - -// Supported XR hand tracking frequencies. -static const int XR_HAND_TRACKING_FREQUENCY_LOW = 0; -static const int XR_HAND_TRACKING_FREQUENCY_HIGH = 1; - -// Supported XR passthrough modes. -static const int XR_PASSTHROUGH_NONE = 0; -static const int XR_PASSTHROUGH_OPTIONAL = 1; -static const int XR_PASSTHROUGH_REQUIRED = 2; - struct CustomExportData { String assets_directory; bool debug; @@ -116,8 +102,6 @@ String _get_gles_tag(); String _get_screen_sizes_tag(const Ref &p_preset); -String _get_xr_features_tag(const Ref &p_preset); - String _get_activity_tag(const Ref &p_export_platform, const Ref &p_preset, bool p_debug); String _get_application_tag(const Ref &p_export_platform, const Ref &p_preset, bool p_has_read_write_storage_permission, bool p_debug);