1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-21 14:57:09 +00:00

Add support for Android XR devices to the Godot XR Editor

This commit is contained in:
Fredia Huya-Kouadio
2024-12-19 12:56:17 -08:00
parent bd2ca13c6f
commit 353c871160
8 changed files with 63 additions and 20 deletions

View File

@@ -15,7 +15,7 @@ ext.versions = [
// Also update 'platform/android/detect.py#get_ndk_version()' when this is updated. // Also update 'platform/android/detect.py#get_ndk_version()' when this is updated.
ndkVersion : '28.1.13356709', ndkVersion : '28.1.13356709',
splashscreenVersion: '1.0.1', splashscreenVersion: '1.0.1',
openxrVendorsVersion: '4.1.1-stable', openxrVendorsVersion: '4.2.0-stable',
junitVersion : '1.3.0', junitVersion : '1.3.0',
espressoCoreVersion: '3.7.0', espressoCoreVersion: '3.7.0',
kotlinTestVersion : '1.3.11', kotlinTestVersion : '1.3.11',

View File

@@ -203,6 +203,8 @@ dependencies {
implementation "androidx.constraintlayout:constraintlayout:2.2.1" implementation "androidx.constraintlayout:constraintlayout:2.2.1"
implementation "org.bouncycastle:bcprov-jdk15to18:1.78" implementation "org.bouncycastle:bcprov-jdk15to18:1.78"
// Android XR dependencies
androidImplementation "org.godotengine:godot-openxr-vendors-androidxr:$versions.openxrVendorsVersion"
// Meta dependencies // Meta dependencies
horizonosImplementation "org.godotengine:godot-openxr-vendors-meta:$versions.openxrVendorsVersion" horizonosImplementation "org.godotengine:godot-openxr-vendors-meta:$versions.openxrVendorsVersion"
// Pico dependencies // Pico dependencies

View File

@@ -0,0 +1,42 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-feature
android:name="android.software.xr.api.openxr"
android:required="false" />
<!-- 6dof motion controllers -->
<uses-feature android:name="android.hardware.xr.input.controller" android:required="false" />
<!-- Eye tracking -->
<uses-feature android:name="android.hardware.xr.input.eye_tracking" android:required="false" />
<uses-permission android:name="android.permission.EYE_TRACKING_FINE" />
<!-- Hand tracking -->
<uses-feature android:name="android.hardware.xr.input.hand_tracking" android:required="false" />
<uses-permission android:name="android.permission.HAND_TRACKING" />
<application>
<uses-native-library android:name="libopenxr.google.so" android:required="false" />
<property
android:name="android.window.PROPERTY_XR_BOUNDARY_TYPE_RECOMMENDED"
android:value="XR_BOUNDARY_TYPE_NO_RECOMMENDATION" />
<activity
android:name=".GodotXRGame"
android:exported="false"
tools:node="merge">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="org.khronos.openxr.intent.category.IMMERSIVE_HMD" />
</intent-filter>
<property
android:name="android.window.PROPERTY_XR_ACTIVITY_START_MODE"
android:value="XR_ACTIVITY_START_MODE_FULL_SPACE_UNMANAGED" />
</activity>
</application>
</manifest>

View File

@@ -33,6 +33,16 @@ package org.godotengine.editor
/** /**
* Primary window of the Godot Editor. * Primary window of the Godot Editor.
* *
* This is the implementation of the editor used when running on regular Android devices. * This is the implementation of the editor used when running on Android devices.
*/ */
open class GodotEditor : BaseGodotEditor() open class GodotEditor : BaseGodotEditor() {
override fun getXRRuntimePermissions(): MutableSet<String> {
val xrRuntimePermissions = super.getXRRuntimePermissions()
xrRuntimePermissions.add("android.permission.EYE_TRACKING_FINE")
xrRuntimePermissions.add("android.permission.HAND_TRACKING")
return xrRuntimePermissions
}
}

View File

@@ -115,6 +115,7 @@
android:configChanges="layoutDirection|locale|orientation|keyboardHidden|screenSize|smallestScreenSize|density|keyboard|navigation|screenLayout|uiMode" android:configChanges="layoutDirection|locale|orientation|keyboardHidden|screenSize|smallestScreenSize|density|keyboard|navigation|screenLayout|uiMode"
android:process=":GodotXRGame" android:process=":GodotXRGame"
android:launchMode="singleTask" android:launchMode="singleTask"
android:taskAffinity=":xr"
android:icon="@mipmap/ic_play_window" android:icon="@mipmap/ic_play_window"
android:label="@string/godot_game_activity_name" android:label="@string/godot_game_activity_name"
android:exported="false" android:exported="false"

View File

@@ -69,11 +69,7 @@ import org.godotengine.godot.error.Error
import org.godotengine.godot.utils.DialogUtils import org.godotengine.godot.utils.DialogUtils
import org.godotengine.godot.utils.PermissionsUtil import org.godotengine.godot.utils.PermissionsUtil
import org.godotengine.godot.utils.ProcessPhoenix import org.godotengine.godot.utils.ProcessPhoenix
import org.godotengine.godot.utils.isNativeXRDevice import org.godotengine.openxr.vendors.utils.*
import org.godotengine.godot.xr.HybridMode
import org.godotengine.godot.xr.getHybridAppLaunchMode
import org.godotengine.godot.xr.HYBRID_APP_PANEL_CATEGORY
import org.godotengine.godot.xr.HYBRID_APP_IMMERSIVE_CATEGORY
import kotlin.math.min import kotlin.math.min
/** /**
@@ -743,12 +739,8 @@ abstract class BaseGodotEditor : GodotActivity(), GameMenuFragment.GameMenuListe
return isNativeXRDevice(applicationContext) return isNativeXRDevice(applicationContext)
} }
if (featureTag == "horizonos") { if (featureTag == BuildConfig.FLAVOR) {
return BuildConfig.FLAVOR == "horizonos" return true
}
if (featureTag == "picoos") {
return BuildConfig.FLAVOR == "picoos"
} }
return super.supportsFeature(featureTag) return super.supportsFeature(featureTag)

View File

@@ -38,8 +38,7 @@ import org.godotengine.godot.GodotLib
import org.godotengine.godot.editor.utils.GameMenuUtils import org.godotengine.godot.editor.utils.GameMenuUtils
import org.godotengine.godot.utils.PermissionsUtil import org.godotengine.godot.utils.PermissionsUtil
import org.godotengine.godot.utils.ProcessPhoenix import org.godotengine.godot.utils.ProcessPhoenix
import org.godotengine.godot.xr.HYBRID_APP_FEATURE import org.godotengine.openxr.vendors.utils.*
import org.godotengine.godot.xr.isHybridAppEnabled
/** /**
* Base class for the Godot play windows. * Base class for the Godot play windows.

View File

@@ -43,11 +43,8 @@ import org.godotengine.editor.embed.GameMenuFragment
import org.godotengine.godot.GodotLib import org.godotengine.godot.GodotLib
import org.godotengine.godot.editor.utils.GameMenuUtils import org.godotengine.godot.editor.utils.GameMenuUtils
import org.godotengine.godot.utils.ProcessPhoenix import org.godotengine.godot.utils.ProcessPhoenix
import org.godotengine.godot.utils.isHorizonOSDevice
import org.godotengine.godot.utils.isNativeXRDevice
import org.godotengine.godot.xr.HYBRID_APP_PANEL_FEATURE
import org.godotengine.godot.xr.XRMode import org.godotengine.godot.xr.XRMode
import org.godotengine.godot.xr.isHybridAppEnabled import org.godotengine.openxr.vendors.utils.*
/** /**
* Drives the 'run project' window of the Godot Editor. * Drives the 'run project' window of the Godot Editor.