Skip to content

Commit

Permalink
Add option to enable permissions necessary for sharing of Meta's spat…
Browse files Browse the repository at this point in the history
…ial anchors (#237)
  • Loading branch information
dsnopek authored Dec 23, 2024
1 parent 6c2a288 commit f9096c0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions plugin/src/main/cpp/export/meta_export_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ MetaEditorExportPlugin::MetaEditorExportPlugin() {
PROPERTY_USAGE_DEFAULT,
false,
false);
_use_anchor_sharing_option = _generate_export_option(
"meta_xr_features/use_anchor_sharing",
"",
Variant::Type::BOOL,
PROPERTY_HINT_NONE,
"",
PROPERTY_USAGE_DEFAULT,
false,
false);
_use_scene_api_option = _generate_export_option(
"meta_xr_features/use_scene_api",
"",
Expand Down Expand Up @@ -215,6 +224,7 @@ TypedArray<Dictionary> MetaEditorExportPlugin::_get_export_options(const Ref<Edi
export_options.append(_passthrough_option);
export_options.append(_render_model_option);
export_options.append(_use_anchor_api_option);
export_options.append(_use_anchor_sharing_option);
export_options.append(_use_scene_api_option);
export_options.append(_use_overlay_keyboard_option);
export_options.append(_use_experimental_features_option);
Expand Down Expand Up @@ -309,6 +319,10 @@ String MetaEditorExportPlugin::_get_export_option_warning(const Ref<EditorExport
if (!openxr_enabled && _get_bool_option(option)) {
return "\"Use anchor API\" is only valid when \"XR Mode\" is \"OpenXR\".\n";
}
} else if (option == "meta_xr_features/use_anchor_sharing") {
if (!openxr_enabled && _get_bool_option(option)) {
return "\"Use anchor sharing\" is only valid when \"XR Mode\" is \"OpenXR\".\n";
}
} else if (option == "meta_xr_features/use_scene_api") {
if (!openxr_enabled && _get_bool_option(option)) {
return "\"Use scene API\" is only valid when \"XR Mode\" is \"OpenXR\".\n";
Expand Down Expand Up @@ -406,6 +420,12 @@ String MetaEditorExportPlugin::_get_android_manifest_element_contents(const Ref<
contents += " <uses-permission android:name=\"com.oculus.permission.USE_ANCHOR_API\" />\n";
}

// Check for anchor sharing
bool use_anchor_sharing = _get_bool_option("meta_xr_features/use_anchor_sharing");
if (use_anchor_sharing) {
contents += " <uses-permission android:name=\"com.oculus.permission.IMPORT_EXPORT_IOT_MAP_DATA\" />\n";
}

// Check for scene api
bool use_scene_api = _get_bool_option("meta_xr_features/use_scene_api");
if (use_scene_api) {
Expand Down
1 change: 1 addition & 0 deletions plugin/src/main/cpp/include/export/meta_export_plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class MetaEditorExportPlugin : public OpenXREditorExportPlugin {
Dictionary _passthrough_option;
Dictionary _render_model_option;
Dictionary _use_anchor_api_option;
Dictionary _use_anchor_sharing_option;
Dictionary _use_scene_api_option;
Dictionary _use_overlay_keyboard_option;
Dictionary _use_experimental_features_option;
Expand Down

0 comments on commit f9096c0

Please sign in to comment.