Skip to content

Commit efe1add

Browse files
Merge branch 'release/5.10.0' into 'main'
Release 5.10.0 See merge request xr/integrations/unityplugin!259
2 parents 8555115 + a90c146 commit efe1add

File tree

144 files changed

+26804
-433
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

144 files changed

+26804
-433
lines changed

.gitlab-ci.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,6 +385,7 @@ export-unitypackages:
385385

386386
PACKAGE_IMPORT_PATH_Tracking_Preview: "$UNITYPLUGIN_ASSETS_PATH/Tracking Preview"
387387
EXAMPLES_SUBPATH_Tracking_Preview: "Examples~"
388+
OVRPROVIDER_SUBPATH_Tracking_Preview: "OVR Provider~"
388389
UNITYPACKAGE_OUTPUT_PATH_Tracking_Preview: "$UNITYPACKAGES_OUTPUT_PATH/Tracking Preview.unitypackage"
389390

390391
PACKAGE_IMPORT_PATH_Tracking_OpenXR: "$UNITYPLUGIN_ASSETS_PATH/Tracking OpenXR"
@@ -420,11 +421,11 @@ export-unitypackages:
420421
#########################
421422
# Export .unitypackages #
422423
#########################
423-
- Export-UnityPackage -PackageRootPath "$PACKAGE_PATH_Tracking" -PackageImportPath "$PACKAGE_IMPORT_PATH_Tracking" -PackageOutputPath "$UNITYPACKAGE_OUTPUT_PATH_Tracking" -ExamplesSubPath "$EXAMPLES_SUBPATH_Tracking" -ErrorVariable ExportErrors
424+
- Export-UnityPackage -PackageRootPath "$PACKAGE_PATH_Tracking" -PackageImportPath "$PACKAGE_IMPORT_PATH_Tracking" -PackageOutputPath "$UNITYPACKAGE_OUTPUT_PATH_Tracking" -ExtraHiddenSubPaths "$EXAMPLES_SUBPATH_Tracking" -ErrorVariable ExportErrors
424425
- if ($ExportErrors) { echo "Failed to generate Tracking.unitypackage"; exit 1; }
425-
- Export-UnityPackage -PackageRootPath "$PACKAGE_PATH_Tracking_Preview" -PackageImportPath "$PACKAGE_IMPORT_PATH_Tracking_Preview" -PackageOutputPath "$UNITYPACKAGE_OUTPUT_PATH_Tracking_Preview" -ExamplesSubPath "$EXAMPLES_SUBPATH_Tracking_Preview" -ErrorVariable ExportErrors
426+
- Export-UnityPackage -PackageRootPath "$PACKAGE_PATH_Tracking_Preview" -PackageImportPath "$PACKAGE_IMPORT_PATH_Tracking_Preview" -PackageOutputPath "$UNITYPACKAGE_OUTPUT_PATH_Tracking_Preview" -ExtraHiddenSubPaths "$EXAMPLES_SUBPATH_Tracking_Preview","$OVRPROVIDER_SUBPATH_Tracking_Preview" -ErrorVariable ExportErrors
426427
- if ($ExportErrors) { echo "Failed to generate Tracking Preview.unitypackage"; exit 1; }
427-
- Export-UnityPackage -PackageRootPath "$PACKAGE_PATH_Tracking_OpenXR" -PackageImportPath "$PACKAGE_IMPORT_PATH_Tracking_OpenXR" -PackageOutputPath "$UNITYPACKAGE_OUTPUT_PATH_Tracking_OpenXR" -ExamplesSubPath "$EXAMPLES_SUBPATH_Tracking_OpenXR" -ErrorVariable ExportErrors
428+
- Export-UnityPackage -PackageRootPath "$PACKAGE_PATH_Tracking_OpenXR" -PackageImportPath "$PACKAGE_IMPORT_PATH_Tracking_OpenXR" -PackageOutputPath "$UNITYPACKAGE_OUTPUT_PATH_Tracking_OpenXR" -ExtraHiddenSubPaths "$EXAMPLES_SUBPATH_Tracking_OpenXR" -ErrorVariable ExportErrors
428429
- if ($ExportErrors) { echo "Failed to generate Tracking OpenXR.unitypackage"; exit 1; }
429430

430431
############################

CI/Scripts/ExportUnityPackage.ps1

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function global:Export-VersionTxt
2121
}
2222

2323
# Exports a unitypackage at the package root path with the given ImportPath when importing into unity.
24-
# Optionally provide an examples subpath with trailing '~' - examples will be exported as a second unitypackage.
24+
# Optionally provide extra subpaths with trailing '~' - these will be exported as extra unitypackages.
2525
# Example:
2626
# Export-UnityPackage "Packages/MyPackage" "Assets/ThirdParty" "MyPackage.unitypackage" "Examples~"
2727
# This will create bundle the content of "Packages/MyPackage" into the output package file "MyPackage.unitypackage".
@@ -33,9 +33,23 @@ function global:Export-UnityPackage
3333
[Parameter(Mandatory)][string] $PackageRootPath,
3434
[Parameter(Mandatory)][string] $PackageImportPath,
3535
[Parameter(Mandatory)][string] $PackageOutputPath,
36-
[ValidateScript({[string]::IsNullOrEmpty($_) -or $($(Test-Path $(Join-Path $PackageRootPath $_) -PathType Container) -and $_.EndsWith('~'))}, ErrorMessage = "If provided, example path must be an existing subdirectory hidden with a trailing '~'")]
37-
[string]
38-
$ExamplesSubPath = $null
36+
[ValidateScript(
37+
{
38+
foreach($item in $_)
39+
{
40+
if([string]::IsNullOrEmpty($item) -or $($(Test-Path $(Join-Path $PackageRootPath $item) -PathType Container) -and $item.EndsWith('~')))
41+
{
42+
$true
43+
}
44+
else
45+
{
46+
throw "Could not find hidden subpath '$item'."
47+
}
48+
}
49+
},
50+
ErrorMessage = "If provided, hidden folder paths must be an existing subdirectory with a trailing '~'")]
51+
[string[]]
52+
$ExtraHiddenSubPaths = $null
3953
)
4054
function Export-UnityPackage-Impl
4155
{
@@ -135,17 +149,23 @@ function global:Export-UnityPackage
135149

136150
Export-UnityPackage-Impl -ExportPath $PackageRootPath -ImportPath $PackageImportPath -Output $PackageOutputPath
137151

138-
if ($ExamplesSubPath)
152+
if ($ExtraHiddenSubPaths)
139153
{
140-
$ExamplesUnhiddenSubPath = $ExamplesSubPath.TrimEnd('~')
141-
$ExamplesHiddenPath = Join-Path $PackageRootPath $ExamplesSubPath
142-
$ExamplesRootPath = Join-Path $PackageRootPath $ExamplesUnhiddenSubPath
154+
foreach ($SubPath in $ExtraHiddenSubPaths)
155+
{
156+
$UnhiddenSubPath = $SubPath.TrimEnd('~')
157+
158+
$OriginalPath = Join-Path $PackageRootPath $SubPath
159+
$NewPath = Join-Path $PackageRootPath $UnhiddenSubPath
143160

144-
Move-Item $ExamplesHiddenPath $ExamplesRootPath
161+
Move-Item $OriginalPath $NewPath
145162

146-
$ExamplesImportPath = Join-Path $PackageImportPath $ExamplesUnhiddenSubPath
147-
$ExamplesOutputPath = $PackageOutputPath.Replace(".unitypackage", " Examples.unitypackage")
163+
$ExtraUnitypackageImportPath = Join-Path $PackageImportPath $UnhiddenSubPath
164+
# Appends the subpath within the package to the name of the generated unitypackage so it's unique
165+
$ExtraUnitypackageOutputPath = $PackageOutputPath.Replace(".unitypackage", " $UnhiddenSubPath.unitypackage")
148166

149-
Export-UnityPackage-Impl -ExportPath $ExamplesRootPath -ImportPath $ExamplesImportPath -Output $ExamplesOutputPath
167+
Export-UnityPackage-Impl -ExportPath $NewPath -ImportPath $ExtraUnitypackageImportPath -Output $ExtraUnitypackageOutputPath
168+
}
150169
}
170+
# loop through list of samples and generate example packages
151171
}

Packages/Tracking OpenXR/CHANGELOG.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
[docs-website]: https://docs.ultraleap.com/ "Ultraleap Docs"
88

9+
## [1.0.0-pre.4] - 10/06/2022
10+
11+
### Fixed
12+
13+
- Fixed Hand data provided via the OpenXR Leap Provider was always relative to the scene origin. It now respects any parent transforms applied to the main camera and works correctly with `Tracked Pose Driver`
14+
15+
### Known issues
16+
17+
- Currently the Ultraleap Hand Tracking feature for OpenXR requires the New and Legacy input systems to be enabled, to simultaneously use OpenXR and the Ultraleap Unity Plugin's features.
18+
- The OpenXR Leap Provider does not currently support the following hand properties (and will return fixed values):
19+
- Hand and Finger: `FrameId`
20+
- Hand: `Confidence`
21+
- Hand: `GrabAngle`
22+
- Hand and Finger: `Id` & `HandId` will always return `0` and `1` for the left and right hand respectively
23+
- Hand and Finger: `TimeVisible`
24+
- Finger: `IsExtended`
25+
- The elbow joint is not currently tracked and the OpenXR Leap Provider infers the elbow/forearm from the hand-data.
26+
27+
928
## [1.0.0-pre.3] - 19/04/2022
1029

1130
### Added
@@ -22,7 +41,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2241

2342
### Known issues
2443

25-
- Hand data provided via the OpenXR Leap Provider is currently always relative to the scene origin. It will not respect any parent transforms applied to the main camera.
2644
- Currently the Ultraleap Hand Tracking feature for OpenXR requires the New and Legacy input systems to be enabled, to simultaneously use OpenXR and the Ultraleap Unity Plugin's features.
2745
- The OpenXR Leap Provider does not currently support the following hand properties (and will return fixed values):
2846
- Hand and Finger: `FrameId`
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,31 @@
11
using Leap.Unity;
22
using UnityEditor;
3+
using UnityEngine;
34

45
namespace Ultraleap.Tracking.OpenXR
56
{
6-
77
[CustomEditor(typeof(OpenXRLeapProvider))]
88
public class OpenXRLeapProviderEditor : CustomEditorBase
99
{
1010
private readonly string[] _testHandPoses = { "HeadMountedA", "HeadMountedB" };
11+
private SerializedProperty _mainCamera;
1112

1213
protected override void OnEnable()
1314
{
1415
base.OnEnable();
16+
17+
_mainCamera = serializedObject.FindProperty("_mainCamera");
18+
if (_mainCamera.objectReferenceValue == null)
19+
{
20+
_mainCamera.objectReferenceValue = MainCameraProvider.mainCamera;
21+
serializedObject.ApplyModifiedProperties();
22+
23+
if (_mainCamera.objectReferenceValue != null)
24+
{
25+
Debug.Log("Camera.Main automatically assigned");
26+
}
27+
}
28+
1529
specifyCustomDrawer("editTimePose", DrawCustomEnum);
1630
}
1731

@@ -20,6 +34,5 @@ private void DrawCustomEnum(SerializedProperty property)
2034
property.enumValueIndex = EditorGUILayout.Popup("Edit Time Pose", property.enumValueIndex, _testHandPoses);
2135
serializedObject.ApplyModifiedProperties();
2236
}
23-
2437
}
2538
}

Packages/Tracking OpenXR/Examples~/Capsule Hands (OpenXR).unity

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,10 @@ PrefabInstance:
431431
propertyPath: m_Name
432432
value: Service Provider (OpenXR)
433433
objectReference: {fileID: 0}
434+
- target: {fileID: 6382174844009596092, guid: d774afbb462004749918d3e350ef43ff, type: 3}
435+
propertyPath: _mainCamera
436+
value:
437+
objectReference: {fileID: 41947977}
434438
m_RemovedComponents: []
435439
m_SourcePrefab: {fileID: 100100000, guid: d774afbb462004749918d3e350ef43ff, type: 3}
436440
--- !u!1 &1966885502

Packages/Tracking OpenXR/Runtime/Prefabs/Service Provider (OpenXR).prefab

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Transform:
2727
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
2828
m_LocalPosition: {x: 0, y: 0, z: 0}
2929
m_LocalScale: {x: 1, y: 1, z: 1}
30+
m_ConstrainProportionsScale: 0
3031
m_Children: []
3132
m_Father: {fileID: 0}
3233
m_RootOrder: 0
@@ -44,3 +45,4 @@ MonoBehaviour:
4445
m_Name:
4546
m_EditorClassIdentifier:
4647
editTimePose: 0
48+
_mainCamera: {fileID: 0}

Packages/Tracking OpenXR/Runtime/Scripts/OpenXRLeapProvider.cs

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,78 @@ namespace Ultraleap.Tracking.OpenXR
1313
public class OpenXRLeapProvider : LeapProvider
1414
{
1515
private Frame _updateFrame = new Frame();
16+
private Frame _currentFrame = new Frame();
17+
1618
private Hand _leftHand = new Hand();
1719
private Hand _rightHand = new Hand();
1820

21+
[Tooltip("Specifies the main camera. Falls back to Camera.main if not set")]
22+
[SerializeField]
23+
private Camera _mainCamera; // Redundant backing field, used to present value in editor at parent level
24+
/// <summary>
25+
/// Specifies the main camera.
26+
/// Falls back to Camera.main if not set.
27+
/// </summary>
28+
public Camera mainCamera
29+
{
30+
get
31+
{
32+
if (_mainCamera != null && _mainCamera != MainCameraProvider.mainCamera)
33+
{
34+
MainCameraProvider.mainCamera = _mainCamera;
35+
}
36+
return _mainCamera;
37+
}
38+
set
39+
{
40+
_mainCamera = value;
41+
MainCameraProvider.mainCamera = value;
42+
}
43+
}
44+
45+
protected void OnEnable()
46+
{
47+
// Assign the main camera if it looks like one is available and it's not yet been set on the backing field
48+
// NB this may be the case if the provider is created via AddComponent, as in MRTK
49+
if (mainCamera == null && MainCameraProvider.mainCamera != null)
50+
{
51+
mainCamera = MainCameraProvider.mainCamera;
52+
}
53+
}
54+
1955
private void Update()
2056
{
2157
PopulateLeapFrame(FrameTime.OnUpdate, ref _updateFrame);
22-
DispatchUpdateFrameEvent(_updateFrame);
58+
59+
Pose trackerTransform = new Pose(Vector3.zero, Quaternion.identity);
60+
61+
#if XR_LEGACY_INPUT_AVAILABLE
62+
// Adjust for relative transform if it's in use.
63+
var trackedPoseDriver = mainCamera.GetComponent<UnityEngine.SpatialTracking.TrackedPoseDriver>();
64+
if (trackedPoseDriver != null && trackedPoseDriver.UseRelativeTransform)
65+
{
66+
trackerTransform.position += trackedPoseDriver.originPose.position;
67+
trackerTransform.rotation *= trackedPoseDriver.originPose.rotation;
68+
}
69+
#endif
70+
// Adjust for the camera parent transform if this camera is part of a rig.
71+
var parentTransform = mainCamera.transform.parent;
72+
if (parentTransform != null)
73+
{
74+
trackerTransform.position += parentTransform.position;
75+
trackerTransform.rotation *= parentTransform.rotation;
76+
}
77+
78+
_currentFrame = _updateFrame.TransformedCopy(new LeapTransform(
79+
trackerTransform.position.ToVector(),
80+
trackerTransform.rotation.ToLeapQuaternion()));
81+
82+
DispatchUpdateFrameEvent(_currentFrame);
2383
}
2484

25-
void FixedUpdate()
85+
private void FixedUpdate()
2686
{
27-
DispatchFixedFrameEvent(_updateFrame);
87+
DispatchFixedFrameEvent(_currentFrame);
2888
}
2989

3090
private void PopulateLeapFrame(FrameTime frameTime, ref Frame leapFrame)
@@ -244,9 +304,9 @@ public override Frame CurrentFrame
244304
get
245305
{
246306
#if UNITY_EDITOR
247-
return !Application.isPlaying ? EditTimeFrame : _updateFrame;
307+
return !Application.isPlaying ? EditTimeFrame : _currentFrame;
248308
#else
249-
return _updateFrame;
309+
return _currentFrame;
250310
#endif
251311
}
252312
}
@@ -266,7 +326,7 @@ private Frame EditTimeFrame
266326
(_backingUntransformedEditTimeFrame ??= new Frame()).Hands.Clear();
267327
_backingUntransformedEditTimeFrame.Hands.Add(EditTimeLeftHand);
268328
_backingUntransformedEditTimeFrame.Hands.Add(EditTimeRightHand);
269-
_backingEditTimeFrame.CopyFrom(_backingUntransformedEditTimeFrame).Transform(transform.GetLeapMatrix());
329+
_backingEditTimeFrame = _backingUntransformedEditTimeFrame.TransformedCopy(mainCamera.transform.GetLeapMatrix());
270330
return _backingEditTimeFrame;
271331
}
272332
}

Packages/Tracking OpenXR/Runtime/Ultraleap.Tracking.OpenXR.asmdef

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@
55
"GUID:4847341ff46394e83bb78fbd0652937e",
66
"GUID:96aa6ba065960476598f8f643e7252b6",
77
"GUID:cec9848704c49724192ff47f9b3e9156",
8-
"GUID:2ee0542102ac1084e8d9a910885c1e81"
8+
"GUID:2ee0542102ac1084e8d9a910885c1e81",
9+
"GUID:ba171b3dd2a51234ab864770f99741a5"
910
],
1011
"includePlatforms": [
1112
"Android",
@@ -18,6 +19,12 @@
1819
"precompiledReferences": [],
1920
"autoReferenced": true,
2021
"defineConstraints": [],
21-
"versionDefines": [],
22+
"versionDefines": [
23+
{
24+
"name": "com.unity.xr.legacyinputhelpers",
25+
"expression": "1.0",
26+
"define": "XR_LEGACY_INPUT_AVAILABLE"
27+
}
28+
],
2229
"noEngineReferences": false
2330
}

Packages/Tracking OpenXR/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "com.ultraleap.tracking.openxr",
3-
"version": "1.0.0-pre.3",
3+
"version": "1.0.0-pre.4",
44
"displayName": "Ultraleap Tracking OpenXR",
55
"description": "Support for OpenXR Hand Tracking",
66
"unity": "2020.3",

Packages/Tracking Preview/AggregationProviders/Editor/AggregationProviderConfidenceInterpolationEditor.cs

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,54 @@ namespace Leap.Unity
1313
{
1414

1515
[CustomEditor(typeof(AggregationProviderConfidenceInterpolation))]
16-
public class AggregationProviderConfidenceInterpolationEditor : CustomEditorBase
16+
public class AggregationProviderConfidenceInterpolationEditor : CustomEditorBase<AggregationProviderConfidenceInterpolation>
1717
{
1818

1919
protected override void OnEnable()
2020
{
2121
base.OnEnable();
2222

2323
specifyCustomDrawer("jointOcclusionFactor", drawJointOcclusionWarning);
24+
25+
drawFoldoutInLine();
26+
27+
addPropertyToFoldout("palmPosFactor", "Palm Factors");
28+
addPropertyToFoldout("palmRotFactor", "Palm Factors");
29+
addPropertyToFoldout("palmVelocityFactor", "Palm Factors");
30+
31+
addPropertyToFoldout("jointRotFactor", "Joint Factors");
32+
addPropertyToFoldout("jointRotToPalmFactor", "Joint Factors");
33+
addPropertyToFoldout("jointOcclusionFactor", "Joint Factors");
34+
35+
specifyConditionalDrawing("debugJointOrigins",
36+
"debugHandLeft",
37+
"debugHandRight",
38+
"debugColors");
2439
}
2540

2641
private void drawJointOcclusionWarning(SerializedProperty property)
2742
{
2843
EditorGUILayout.PropertyField(property, true);
2944

45+
3046
if (property.floatValue != 0)
3147
{
32-
EditorGUILayout.HelpBox("To use jointOcclusion, you must add a Layer for each ServiceProvider named 'JointOcclusion[idx]'. (eg. Add 'JointOcclusion0' and 'JointOcclusion1' when using two source providers.)", MessageType.Warning);
48+
bool showWarning = false;
49+
string warningText = "To use jointOcclusion, you must add the following Layers: ";
50+
for (int i = 0; i < target.providers.Length; i++)
51+
{
52+
string layerName = "JointOcclusion" + i.ToString();
53+
if (LayerMask.NameToLayer(layerName) == -1)
54+
{
55+
showWarning = true;
56+
warningText += layerName + ", ";
57+
}
58+
}
59+
60+
if (showWarning)
61+
{
62+
EditorGUILayout.HelpBox(warningText.TrimEnd(' ', ','), MessageType.Warning);
63+
}
3364
}
3465
}
3566

0 commit comments

Comments
 (0)