From baa01fffa072dbbea5f76f351a0bb5610a156c04 Mon Sep 17 00:00:00 2001 From: Mauricio Narvaez Date: Sun, 24 Dec 2023 00:29:39 -0800 Subject: [PATCH] Add export option to support scene API and request if in manifest --- .../main/cpp/export/meta_export_plugin.cpp | 21 +++++++++++++++++++ .../src/main/cpp/export/meta_export_plugin.h | 1 + .../openxr/vendors/meta/GodotOpenXRMeta.kt | 5 +++++ 3 files changed, 27 insertions(+) diff --git a/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.cpp b/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.cpp index 8f452adf..29c7ae05 100644 --- a/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.cpp +++ b/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.cpp @@ -104,6 +104,16 @@ MetaEditorExportPlugin::MetaEditorExportPlugin() { false, false ); + _use_scene_api_option = _generate_export_option( + "meta_xr_features/use_scene_api", + "", + Variant::Type::BOOL, + PROPERTY_HINT_NONE, + "", + PROPERTY_USAGE_DEFAULT, + false, + false + ); _support_quest_1_option = _generate_export_option( "meta_xr_features/quest_1_support", "", @@ -160,6 +170,7 @@ TypedArray MetaEditorExportPlugin::_get_export_options(const Ref\n"; } + // Check for scene api + bool use_scene_api = _get_bool_option("meta_xr_features/use_scene_api"); + if (use_scene_api) { + contents += " \n"; + } + return contents; } diff --git a/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.h b/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.h index 33c202ce..0b20d128 100644 --- a/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.h +++ b/godotopenxrmeta/src/main/cpp/export/meta_export_plugin.h @@ -83,6 +83,7 @@ class MetaEditorExportPlugin : public OpenXREditorExportPlugin { Dictionary _hand_tracking_frequency_option; Dictionary _passthrough_option; Dictionary _use_anchor_api_option; + Dictionary _use_scene_api_option; Dictionary _support_quest_1_option; Dictionary _support_quest_2_option; Dictionary _support_quest_3_option; diff --git a/godotopenxrmeta/src/main/java/org/godotengine/openxr/vendors/meta/GodotOpenXRMeta.kt b/godotopenxrmeta/src/main/java/org/godotengine/openxr/vendors/meta/GodotOpenXRMeta.kt index f35e31f9..b79e74cf 100644 --- a/godotopenxrmeta/src/main/java/org/godotengine/openxr/vendors/meta/GodotOpenXRMeta.kt +++ b/godotopenxrmeta/src/main/java/org/godotengine/openxr/vendors/meta/GodotOpenXRMeta.kt @@ -44,6 +44,7 @@ class GodotOpenXRMeta(godot: Godot?) : GodotPlugin(godot) { private val TAG = GodotOpenXRMeta::class.java.simpleName private const val EYE_TRACKING_PERMISSION = "com.oculus.permission.EYE_TRACKING" + private const val SCENE_PERMISSION = "com.oculus.permission.USE_SCENE" init { try { @@ -67,6 +68,10 @@ class GodotOpenXRMeta(godot: Godot?) : GodotPlugin(godot) { Log.d(TAG, "Requesting permission '${EYE_TRACKING_PERMISSION}'") PermissionsUtil.requestPermission(EYE_TRACKING_PERMISSION, activity) } + // Request the scene API permission if it's included in the manifest + if (PermissionsUtil.hasManifestPermission(activity, SCENE_PERMISSION)) { + PermissionsUtil.requestPermission(SCENE_PERMISSION, activity) + } return null }