Skip to content

Commit bc0591d

Browse files
author
David Kline
authored
Merge pull request #6722 from microsoft/prerelease/2.2.0_stabilization
Prerelease/2.2.0 stabilization -> dev
2 parents dadc47d + 4ad49f0 commit bc0591d

File tree

66 files changed

+810
-382
lines changed

Some content is hidden

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

66 files changed

+810
-382
lines changed

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,10 @@ doc/
9292
/MSBuild/
9393
/PackagesCopy/
9494
!/scripts/Packaging/NuGetRestoreProject.csproj
95+
96+
# ========================= #
97+
# MSBuildForUnity generated #
98+
# ========================= #
99+
Assets/MixedRealityToolkit.Providers/WindowsMixedReality/DotNetAdapter/Plugins*
100+
MSBuildForUnity.Common.props
101+
.obj

Assets/MixedReality.Toolkit.Foundation.nuspec

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
<copyright>© Microsoft Corporation. All rights reserved.</copyright>
1313
<releaseNotes>$releaseNotes$</releaseNotes>
1414
<tags>Unity MixedReality</tags>
15+
<dependencies>
16+
<dependency id="Microsoft.Windows.MixedReality.DotNetWinRT" version="0.5.1034" />
17+
</dependencies>
1518
<contentFiles>
1619
<files include="any\any\.PkgSrc\**" buildAction="None" copyToOutput="false" />
1720
</contentFiles>

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/DotNetAdapter.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<Project ToolsVersion="15.0">
2+
<Import Project="$([MSBuild]::GetPathOfFileAbove(MSBuildForUnity.Common.props))" Condition="Exists('$([MSBuild]::GetPathOfFileAbove(MSBuildForUnity.Common.props))')" />
3+
4+
<PropertyGroup Condition="'$(UnityCurrentTargetFramework)' == ''">
5+
<TargetFramework>netstandard2.0</TargetFramework>
6+
</PropertyGroup>
7+
8+
<PropertyGroup Condition="'$(UnityCurrentTargetFramework)' != ''">
9+
<TargetFramework>$(UnityCurrentTargetFramework)</TargetFramework>
10+
</PropertyGroup>
11+
12+
<PropertyGroup>
13+
<!-- Make sure Unity ignores the contents of the intermediate output path. -->
14+
<BaseIntermediateOutputPath>.obj</BaseIntermediateOutputPath>
15+
<OutputPath>Plugins</OutputPath>
16+
</PropertyGroup>
17+
18+
<ItemGroup>
19+
<PackageReference Include="Microsoft.Windows.MixedReality.DotNetWinRT">
20+
<Version>0.5.1034</Version>
21+
</PackageReference>
22+
<PackageReference Include="MSBuildForUnity">
23+
<Version>0.8.1</Version>
24+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
25+
<PrivateAssets>all</PrivateAssets>
26+
</PackageReference>
27+
</ItemGroup>
28+
29+
<!-- Note that this is the special "NoTarget" SDK to prevent this project from producing a dll. -->
30+
<Import Project="Sdk.props" Sdk="Microsoft.Build.NoTargets" Version="1.0.80" />
31+
32+
<Import Project="Sdk.targets" Sdk="Microsoft.Build.NoTargets" Version="1.0.80" />
33+
</Project>

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/DotNetAdapter/DotNetAdapter.csproj.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<add key="NuGet" value="https://api.nuget.org/v3/index.json" />
5+
<add key="MSBuildForUnity" value="https://pkgs.dev.azure.com/UnityDeveloperTools/MSBuildForUnity/_packaging/UnityDeveloperTools/nuget/v3/index.json" />
6+
</packageSources>
7+
<disabledPackageSources />
8+
<activePackageSource>
9+
<add key="All" value="(Aggregate source)" />
10+
</activePackageSource>
11+
</configuration>

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/DotNetAdapter/NuGet.config.meta

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/MixedRealityToolkit.Providers/WindowsMixedReality/WindowsMixedRealityArticulatedHand.cs

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,24 @@
55
using Microsoft.MixedReality.Toolkit.Input;
66

77
#if UNITY_WSA
8-
using UnityEngine;
98
using UnityEngine.XR.WSA.Input;
10-
#endif
11-
12-
#if WINDOWS_UWP
13-
using Microsoft.MixedReality.Toolkit.Windows.Utilities;
9+
#if WINDOWS_UWP || DOTNETWINRT_PRESENT
1410
using System;
1511
using System.Collections.Generic;
12+
using UnityEngine;
13+
#if WINDOWS_UWP
14+
using Windows.Foundation.Metadata;
1615
using Windows.Perception;
1716
using Windows.Perception.People;
1817
using Windows.UI.Input.Spatial;
18+
#elif DOTNETWINRT_PRESENT
19+
using Microsoft.Windows.Foundation.Metadata;
20+
using Microsoft.Windows.Perception;
21+
using Microsoft.Windows.Perception.People;
22+
using Microsoft.Windows.UI.Input.Spatial;
1923
#endif
24+
#endif // WINDOWS_UWP || DOTNETWINRT_PRESENT
25+
#endif // UNITY_WSA
2026

2127
namespace Microsoft.MixedReality.Toolkit.WindowsMixedReality.Input
2228
{
@@ -34,6 +40,9 @@ public class WindowsMixedRealityArticulatedHand : BaseWindowsMixedRealitySource,
3440
public WindowsMixedRealityArticulatedHand(TrackingState trackingState, Handedness controllerHandedness, IMixedRealityInputSource inputSource = null, MixedRealityInteractionMapping[] interactions = null)
3541
: base(trackingState, controllerHandedness, inputSource, interactions)
3642
{
43+
#if (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP
44+
articulatedHandApiAvailable = ApiInformation.IsMethodPresent("Windows.UI.Input.Spatial.SpatialInteractionSourceState", "TryGetHandPose");
45+
#endif
3746
}
3847

3948
/// <summary>
@@ -54,7 +63,7 @@ public WindowsMixedRealityArticulatedHand(TrackingState trackingState, Handednes
5463
/// <inheritdoc/>
5564
public bool TryGetJoint(TrackedHandJoint joint, out MixedRealityPose pose)
5665
{
57-
#if WINDOWS_UWP
66+
#if (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP
5867
return unityJointPoses.TryGetValue(joint, out pose);
5968
#else
6069
pose = MixedRealityPose.ZeroIdentity;
@@ -69,7 +78,7 @@ public override bool IsInPointingPose
6978
get
7079
{
7180
bool valid = true;
72-
#if WINDOWS_UWP
81+
#if (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP
7382
Vector3 palmNormal = unityJointOrientations[(int)HandJointKind.Palm] * (-1 * Vector3.up);
7483
if (CursorBeamBackwardTolerance >= 0)
7584
{
@@ -86,17 +95,16 @@ public override bool IsInPointingPose
8695
valid = false;
8796
}
8897
}
89-
#endif // WINDOWS_UWP
98+
#endif // (UNITY_WSA && DOTNETWINRT_PRESENT) || WINDOWS_UWP
9099
return valid;
91100
}
92101
}
93102

94103
#if UNITY_WSA
104+
#if WINDOWS_UWP || DOTNETWINRT_PRESENT
95105
private MixedRealityPose currentIndexPose = MixedRealityPose.ZeroIdentity;
96106

97-
private readonly HandRay handRay = new HandRay();
98-
99-
#if WINDOWS_UWP
107+
private SpatialInteractionManager spatialInteractionManager = null;
100108
private SpatialInteractionManager SpatialInteractionManager
101109
{
102110
get
@@ -113,15 +121,18 @@ private SpatialInteractionManager SpatialInteractionManager
113121
}
114122
}
115123

116-
private SpatialInteractionManager spatialInteractionManager = null;
124+
#if WINDOWS_UWP
117125
private HandMeshObserver handMeshObserver = null;
118126
private int[] handMeshTriangleIndices = null;
119127
private bool hasRequestedHandMeshObserver = false;
120128
private Vector2[] handMeshUVs;
129+
#endif // WINDOWS_UWP
121130

122131
private readonly float CursorBeamBackwardTolerance = 0.5f;
123132
private readonly float CursorBeamUpTolerance = 0.8f;
124-
#endif // WINDOWS_UWP
133+
134+
private readonly bool articulatedHandApiAvailable = false;
135+
#endif // WINDOWS_UWP || DOTNETWINRT_PRESENT
125136

126137
#region Update data functions
127138

@@ -194,19 +205,19 @@ private async void SetHandMeshObserver(SpatialInteractionSourceState sourceState
194205
{
195206
handMeshObserver = await sourceState.Source.TryCreateHandMeshObserverAsync();
196207
}
197-
#endif
208+
#endif // WINDOWS_UWP
198209

199210
/// <summary>
200211
/// Update the hand data from the device.
201212
/// </summary>
202213
/// <param name="interactionSourceState">The InteractionSourceState retrieved from the platform.</param>
203214
private void UpdateHandData(InteractionSourceState interactionSourceState)
204215
{
205-
#if WINDOWS_UWP
216+
#if WINDOWS_UWP || DOTNETWINRT_PRESENT
206217
// Articulated hand support is only present in the 18362 version and beyond Windows
207218
// SDK (which contains the V8 drop of the Universal API Contract). In particular,
208219
// the HandPose related APIs are only present on this version and above.
209-
if (!WindowsApiChecker.UniversalApiContractV8_IsAvailable)
220+
if (!articulatedHandApiAvailable)
210221
{
211222
return;
212223
}
@@ -219,6 +230,7 @@ private void UpdateHandData(InteractionSourceState interactionSourceState)
219230
{
220231
HandPose handPose = sourceState.TryGetHandPose();
221232

233+
#if WINDOWS_UWP
222234
if (CoreServices.InputSystem.InputSystemProfile.HandTrackingProfile.EnableHandMeshVisualization)
223235
{
224236
// Accessing the hand mesh data involves copying quite a bit of data, so only do it if application requests it.
@@ -301,6 +313,7 @@ private void UpdateHandData(InteractionSourceState interactionSourceState)
301313
handMeshObserver = null;
302314
}
303315
}
316+
#endif // WINDOWS_UWP
304317

305318
if (handPose != null && handPose.TryGetJoints(WindowsMixedRealityUtilities.SpatialCoordinateSystem, jointIndices, jointPoses))
306319
{
@@ -334,12 +347,12 @@ private void UpdateHandData(InteractionSourceState interactionSourceState)
334347
}
335348
}
336349
}
337-
#endif // WINDOWS_UWP
350+
#endif // WINDOWS_UWP || DOTNETWINRT_PRESENT
338351
}
339352

340353
private void UpdateIndexFingerData(InteractionSourceState interactionSourceState, MixedRealityInteractionMapping interactionMapping)
341354
{
342-
#if WINDOWS_UWP
355+
#if WINDOWS_UWP || DOTNETWINRT_PRESENT
343356
UpdateCurrentIndexPose();
344357

345358
// Update the interaction data source
@@ -351,12 +364,12 @@ private void UpdateIndexFingerData(InteractionSourceState interactionSourceState
351364
// Raise input system event if it's enabled
352365
CoreServices.InputSystem?.RaisePoseInputChanged(InputSource, ControllerHandedness, interactionMapping.MixedRealityInputAction, currentIndexPose);
353366
}
354-
#endif // WINDOWS_UWP
367+
#endif // WINDOWS_UWP || DOTNETWINRT_PRESENT
355368
}
356369

357370
#endregion Update data functions
358371

359-
#if WINDOWS_UWP
372+
#if WINDOWS_UWP || DOTNETWINRT_PRESENT
360373
private static readonly HandJointKind[] jointIndices = new HandJointKind[]
361374
{
362375
HandJointKind.Palm,
@@ -446,7 +459,7 @@ protected void UpdateCurrentIndexPose()
446459

447460
#endregion Private InputSource Helpers
448461

449-
#endif // WINDOWS_UWP
462+
#endif // WINDOWS_UWP || DOTNETWINRT_PRESENT
450463
#endif // UNITY_WSA
451464
}
452465
}

0 commit comments

Comments
 (0)