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
This commit is contained in:
Fredia Huya-Kouadio 2023-07-02 23:56:52 -07:00 committed by Yuri Sizov
parent d17811c814
commit b52e1be2c2
4 changed files with 0 additions and 105 deletions

View File

@ -584,12 +584,6 @@
<member name="version/name" type="String" setter="" getter="">
Application version visible to the user.
</member>
<member name="xr_features/hand_tracking" type="int" setter="" getter="">
</member>
<member name="xr_features/hand_tracking_frequency" type="int" setter="" getter="">
</member>
<member name="xr_features/passthrough" type="int" setter="" getter="">
</member>
<member name="xr_features/xr_mode" type="int" setter="" getter="">
</member>
</members>

View File

@ -832,16 +832,6 @@ void EditorExportPlatformAndroid::_get_permissions(const Ref<EditorExportPreset>
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<EditorExportPreset> &p_preset, bool p_give_internet, bool p_debug) {
@ -881,7 +871,6 @@ void EditorExportPlatformAndroid::_write_tmp_manifest(const Ref<EditorExportPres
}
}
manifest_text += _get_xr_features_tag(p_preset);
manifest_text += _get_application_tag(Ref<EditorExportPlatform>(this), p_preset, _has_read_write_storage_permission(perms), p_debug);
manifest_text += "</manifest>\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<ExportOption> *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));

View File

@ -254,28 +254,6 @@ String _get_screen_sizes_tag(const Ref<EditorExportPreset> &p_preset) {
return manifest_screen_sizes;
}
String _get_xr_features_tag(const Ref<EditorExportPreset> &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 += " <uses-feature tools:node=\"replace\" android:name=\"oculus.software.handtracking\" android:required=\"false\" />\n";
} else if (hand_tracking_index == XR_HAND_TRACKING_REQUIRED) {
manifest_xr_features += " <uses-feature tools:node=\"replace\" android:name=\"oculus.software.handtracking\" android:required=\"true\" />\n";
}
int passthrough_mode = p_preset->get("xr_features/passthrough");
if (passthrough_mode == XR_PASSTHROUGH_OPTIONAL) {
manifest_xr_features += " <uses-feature tools:node=\"replace\" android:name=\"com.oculus.feature.PASSTHROUGH\" android:required=\"false\" />\n";
} else if (passthrough_mode == XR_PASSTHROUGH_REQUIRED) {
manifest_xr_features += " <uses-feature tools:node=\"replace\" android:name=\"com.oculus.feature.PASSTHROUGH\" android:required=\"true\" />\n";
}
}
return manifest_xr_features;
}
String _get_activity_tag(const Ref<EditorExportPlatform> &p_export_platform, const Ref<EditorExportPreset> &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<EditorExportPlatform> &p_export_platform, con
" <action android:name=\"android.intent.action.MAIN\" />\n"
" <category android:name=\"android.intent.category.LAUNCHER\" />\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"
" <!-- Enable access to OpenXR on Oculus mobile devices, no-op on other Android\n"
" platforms. -->\n"
" <category android:name=\"com.oculus.intent.category.VR\" />\n"
"\n"
" <!-- OpenXR category tag to indicate the activity starts in an immersive OpenXR mode. \n"
" See https://registry.khronos.org/OpenXR/specs/1.0/html/xrspec.html#android-runtime-category. -->\n"
" <category android:name=\"org.khronos.openxr.intent.category.IMMERSIVE_HMD\" />\n"
"\n"
" <!-- Enable VR access on HTC Vive Focus devices. -->\n"
" <category android:name=\"com.htc.intent.category.VRAPP\" />\n";
}
bool uses_leanback_category = p_preset->get("package/show_in_android_tv");
if (uses_leanback_category) {
manifest_activity_text += " <category android:name=\"android.intent.category.LEANBACK_LAUNCHER\" />\n";
@ -341,9 +303,6 @@ String _get_application_tag(const Ref<EditorExportPlatform> &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(
" <application android:label=\"@string/godot_project_name_string\"\n"
" android:allowBackup=\"%s\"\n"
@ -360,18 +319,6 @@ String _get_application_tag(const Ref<EditorExportPlatform> &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(
" <meta-data tools:node=\"replace\" android:name=\"com.oculus.handtracking.frequency\" android:value=\"%s\" />\n",
hand_tracking_frequency);
manifest_application_text += " <meta-data tools:node=\"replace\" android:name=\"com.oculus.handtracking.version\" android:value=\"V2.0\" />\n";
}
}
Vector<Ref<EditorExportPlugin>> 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)) {

View File

@ -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<EditorExportPreset> &p_preset);
String _get_xr_features_tag(const Ref<EditorExportPreset> &p_preset);
String _get_activity_tag(const Ref<EditorExportPlatform> &p_export_platform, const Ref<EditorExportPreset> &p_preset, bool p_debug);
String _get_application_tag(const Ref<EditorExportPlatform> &p_export_platform, const Ref<EditorExportPreset> &p_preset, bool p_has_read_write_storage_permission, bool p_debug);