Skip to content

Commit

Permalink
Release v1.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bsawyer-ml committed Jun 14, 2023
1 parent f108be2 commit 4cece36
Show file tree
Hide file tree
Showing 65 changed files with 2,912 additions and 43 deletions.
21 changes: 19 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,25 @@
# Changelog

## [1.8.0]
### Features
- `MLEyes`: Updated `leftEyeOpenAmount` and `rightEyeOpenAmount` on `UnityEngine.InputSystem.XR.Eyes` to return values between 0.0 and 1.0.
- Added support for `EyeHeightMax` and `EyeWidthMax` in `MLGazeRecognitionStaticData`
- `MLSpace`: Added a new API for importing and exporting spaces without the need for scanning the environment.
- `MLDepthCamera`: Added `RawDepthImage` to support raw camera stream with IR Projector ON.
- Added `MLEyeCamera` API.
- `MLPowerManager`: Added a new API to obtain current controller state and control controller state transitions.
- `MLHeadTracking`: Modified headpose lost notifications with new API for MLHeadTrackingStateEx.

### Bugfixes

### Deprecations & Removals
- `MLHeadTracking`: MLHeadTrackingState and related dependencies marked Obsolete.

### Known Issues
- `MLWebRTC`: When disconnecting from a session, the camera does not shut down cleanly if the NativeSurface buffer format was used, causing the application to hang for as much as 30 seconds.

## [1.7.0]
### Features
- Minimum ML API level updated to `26`.

### Bugfixes
- Fixed compiler errors when the package `com.unity.xr.openxr` is also installed.
Expand All @@ -18,7 +35,7 @@
- Fixed caching logic for `CustomHapticsPattern`s to avoid using incorrect cached patterns.
- Fixed `MLVoice.IntentEvent`'s EventSlotsUsed list within the `OnVoiceEvent` so it properly lists all Slots used in the voice command.
- Optimized `MLMeshing` API and components to reduce memory usage.
- Fixed spamming errors caused by not detecting eyes in the eye tracking example.
- Fixed spamming errors caused by not detecting eyes in eye tracking.

### Deprecations & Removals
- The MLMediaDRM API has been marked as `Obsolete` and will be removed in a future release.
Expand Down
12 changes: 7 additions & 5 deletions Editor/APKBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,16 +148,18 @@ private void BuildAllScenes()
activeScenes.Add(scene.path);
}

string apkName = PlayerSettings.applicationIdentifier;
if (IsArgSet(Arg_Development))
{
apkName = $"{apkName}-dev";
}

BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
buildPlayerOptions.target = EditorUserBuildSettings.activeBuildTarget;
#if UNITY_2022_2_OR_NEWER
buildPlayerOptions.targetGroup = BuildTargetGroup.Android;
#else
buildPlayerOptions.targetGroup = BuildTargetToGroup[EditorUserBuildSettings.activeBuildTarget];
#endif
buildPlayerOptions.options = GetBuildOptions();
buildPlayerOptions.scenes = activeScenes.ToArray();
buildPlayerOptions.locationPathName = System.IO.Path.Combine(GetBuildFolder().FullName, $"{PlayerSettings.applicationIdentifier}.apk");
buildPlayerOptions.locationPathName = System.IO.Path.Combine(GetBuildFolder().FullName, $"{apkName}.apk");

UnityEditor.Build.Reporting.BuildReport report = UnityEditor.BuildPipeline.BuildPlayer(buildPlayerOptions);
if (report.summary.result == UnityEditor.Build.Reporting.BuildResult.Failed)
Expand Down
Binary file modified Plugins/Android/libMLAudioOutput.so
Binary file not shown.
Binary file modified Plugins/Android/libMagicLeapXrProvider.so
Binary file not shown.
Binary file modified Plugins/Android/libml_c_utils.so
Binary file not shown.
Binary file modified Plugins/Android/libml_sdk_loader.so
Binary file not shown.
Binary file modified Plugins/Android/libml_sdk_tests_provider.so
Binary file not shown.
Binary file modified Plugins/MacEditor/libMLAudioOutput.dylib
Binary file not shown.
Binary file modified Plugins/MacEditor/libMagicLeapXrProvider.dylib
Binary file not shown.
Binary file modified Plugins/MacEditor/libml_sdk_loader.dylib
Binary file not shown.
Binary file modified Plugins/MacEditor/libml_sdk_tests_provider.dylib
Binary file not shown.
Binary file modified Plugins/MacEditor/libml_unity_native_logging.dylib
Binary file not shown.
Binary file modified Plugins/WindowsEditor/MLAudioOutput.dll
Binary file not shown.
Binary file modified Plugins/WindowsEditor/MagicLeapXrProvider.dll
Binary file not shown.
Binary file modified Plugins/WindowsEditor/ml_sdk_loader.dll
Binary file not shown.
Binary file modified Plugins/WindowsEditor/ml_sdk_tests_provider.dll
Binary file not shown.
Binary file modified Plugins/WindowsEditor/ml_unity_native_logging.dll
Binary file not shown.
11 changes: 9 additions & 2 deletions Runtime/APIs/DepthCamera/MLDepthCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ public enum CaptureFlags
/// <summary>
/// Enable AmbientRawDepthImage. See <see cref="Data.AmbientRawDepthImage"/> for more details.
/// </summary>
AmbientRawDepthImage = 1 << 3
AmbientRawDepthImage = 1 << 3,

/// <summary>
/// Enable RawDepthImage. See <see cref="Data.RawDepthImage"/> for more details.
/// </summary>
RawDepthImage = 1 << 4
}

/// <summary>
Expand Down Expand Up @@ -489,6 +494,7 @@ FrameBuffer CreateFromPtr(IntPtr ptr)
var confidenceMap = CreateFromPtr(depthCamData.ConfidenceBufferFrameBufferPtr);
var depthFlags = CreateFromPtr(depthCamData.DepthFlagsBufferFrameBufferPtr);
var aiMap = CreateFromPtr(depthCamData.AmbientRawDepthImageFrameBufferPtr);
var depthImage = CreateFromPtr(depthCamData.RawDepthImageFrameBufferPtr);

data = new Data()
{
Expand All @@ -501,7 +507,8 @@ FrameBuffer CreateFromPtr(IntPtr ptr)
DepthImage = (depthMap.Data != null) ? depthMap : null,
ConfidenceBuffer = (confidenceMap.Data != null) ? confidenceMap : null,
DepthFlagsBuffer = (depthFlags.Data != null) ? depthFlags : null,
AmbientRawDepthImage = (aiMap.Data != null) ? aiMap : null
AmbientRawDepthImage = (aiMap.Data != null) ? aiMap : null,
RawDepthImage = (depthImage.Data != null) ? depthImage : null
};

// CAPI specifies that Release should be called exactly once for each successful call to GetLatest
Expand Down
7 changes: 7 additions & 0 deletions Runtime/APIs/DepthCamera/MLDepthCameraData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,13 @@ public sealed class Data
/// illumination and corresponds to the amount of ambient light incident on the sensor.
/// </summary>
public FrameBuffer? AmbientRawDepthImage { get; internal set; }

/// <summary>
/// This is the raw depth camera sensor data captured with the depth camera
/// illumination and corresponds to the amount of total light incident on the
/// sensor.
/// </summary>
public FrameBuffer? RawDepthImage { get; internal set; }
}
}
}
7 changes: 6 additions & 1 deletion Runtime/APIs/DepthCamera/MLDepthCameraNativeBindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,13 @@ public struct MLDepthCameraData

public IntPtr AmbientRawDepthImageFrameBufferPtr;

public IntPtr RawDepthImageFrameBufferPtr;

public static MLDepthCameraData Init()
{
return new MLDepthCameraData()
{
Version = 1
Version = 2
};
}

Expand Down Expand Up @@ -172,6 +174,9 @@ public static MLDepthCameraData Init(Data managed)
var aiFlagsPlaneInfo = MLDepthCameraFrameBuffer.Init(managed.AmbientRawDepthImage);
Marshal.StructureToPtr(aiFlagsPlaneInfo, data.AmbientRawDepthImageFrameBufferPtr, true);

var rawDepthImageInfo = MLDepthCameraFrameBuffer.Init(managed.RawDepthImage);
Marshal.StructureToPtr(rawDepthImageInfo, data.RawDepthImageFrameBufferPtr, true);

return data;
}
}
Expand Down
8 changes: 8 additions & 0 deletions Runtime/APIs/EyeCamera.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

84 changes: 84 additions & 0 deletions Runtime/APIs/EyeCamera/MLEyeCamera.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) 2022-2023 Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement, located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying this distribution may also be found in the top-level NOTICE file appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%

using System;
using System.Runtime.InteropServices;

namespace UnityEngine.XR.MagicLeap
{
public sealed partial class MLEyeCamera : MLAutoAPISingleton<MLEyeCamera>
{
/// <summary>
/// The maximum number of eye camera frames.
/// </summary>
public const int MaxFrameCount = 4;

/// <summary>
/// The enumerated value representing which eye cameras are currently active.
/// </summary>
/// <returns></returns>
public static MLEyeCameraIdentifier ActiveCameras => (MLEyeCameraIdentifier)Instance.settings.Cameras;

/// <summary>
/// The number of active eye cameras.
/// </summary>
/// <value></value>
public static int ActiveCamerasCount
{
get
{
int count = 0;

if (ActiveCameras.HasFlag(MLEyeCameraIdentifier.LeftTemple))
count++;
if (ActiveCameras.HasFlag(MLEyeCameraIdentifier.LeftNasal))
count++;
if (ActiveCameras.HasFlag(MLEyeCameraIdentifier.RightNasal))
count++;
if (ActiveCameras.HasFlag(MLEyeCameraIdentifier.RightTemple))
count++;

return count;
}
}

/// <summary>
/// Converts an image frame data pointer into a byte array.
/// </summary>
/// <param name="imageFrame">The associated eye camera frame buffer for an eye camera.</param>
/// <param name="byteArray">The image data from the native eye camera data as a byte array.</param>
public static void CopyImageFrameDataToByteArray(EyeCameraFrameBuffer imageFrame, ref byte[] byteArray) => Marshal.Copy(imageFrame.Data, byteArray, 0, byteArray.Length);

/// <summary>
/// Polls for Frames. Returns EyeCameraData with this latest data when available.
/// If there are no new camera frames within the timeout_ms duration then the API will return MLResult_Timeout.
/// </summary>
/// <param name="outData">Eye camera data to be output.</param>
/// <param name="timeoutMS">Timeout in milliseconds.</param>
/// <returns>
/// MLResult.Result will be <c>MLResult.Code.Ok</c> if succesfully fetched the camera frames and released the native data.
/// MLResult.Result will be <c>MLResult.Code.Timeout</c> returned because no new frame available at this time.
/// MLResult.Result will be <c>MLResult.Code.InvalidParam</c> if one of the parameters is invalid.
/// MLResult.Result will be <c>MLResult.Code.UnspecifiedFailure</c> if the operation failed due to an internal error.
/// </returns>
public static MLResult GetLatestCameraData(out EyeCameraData outData, UInt64 timeoutMS) => Instance.InternalMLEyeCameraGetLatestCameraData(out outData, timeoutMS);

/// <summary>
/// Update the eye camera settings.
/// </summary>
/// <param name="cameras">The specific eye cameras that will be active with the updated settings.</param>
/// <returns>
/// MLResult.Result will be <c>MLResult.Code.Ok</c> if the settings updated successfully.
/// MLResult.Result will be <c>MLResult.Code.InvalidParam</c> if one of the parameters is invalid.
/// MLResult.Result will be <c>MLResult.Code.UnspecifiedFailure</c> if the operation failed due to an internal error.
/// </returns>
public static MLResult UpdateSettings(MLEyeCameraIdentifier cameras) => Instance.InternalMLEyeCameraUpdateSettings(cameras);
}
}
11 changes: 11 additions & 0 deletions Runtime/APIs/EyeCamera/MLEyeCamera.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions Runtime/APIs/EyeCamera/MLEyeCameraEnums.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) 2022-2023 Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement, located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying this distribution may also be found in the top-level NOTICE file appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%

namespace UnityEngine.XR.MagicLeap
{
using System;

public sealed partial class MLEyeCamera
{
/// <summary>
/// Enumeration of all the available eye camera sensors.
/// </summary>
[Flags]
public enum MLEyeCameraIdentifier
{
/// <summary>
/// None.
/// </summary>
None = 0,

/// <summary>
/// Left temple eye camera.
/// </summary>
LeftTemple = 1 << 0,

/// <summary>
/// Left nasal eye camera.
/// </summary>
LeftNasal = 1 << 1,

/// <summary>
/// Right nasal eye camera.
/// </summary>
RightNasal = 1 << 2,

/// <summary>
/// Right temple eye camera.
/// </summary>
RightTemple = 1 << 3,

/// <summary>
/// All Eye cameras.
/// </summary>
All = LeftTemple | LeftNasal | RightNasal | RightTemple
}
}
}
11 changes: 11 additions & 0 deletions Runtime/APIs/EyeCamera/MLEyeCameraEnums.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

64 changes: 64 additions & 0 deletions Runtime/APIs/EyeCamera/MLEyeCameraInternal.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) 2022-2023 Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement, located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying this distribution may also be found in the top-level NOTICE file appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%

namespace UnityEngine.XR.MagicLeap
{
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using Native;
public sealed partial class MLEyeCamera
{
private NativeBindings.MLEyeCameraSettings settings;

protected override MLResult.Code StartAPI()
{
Instance.settings = new NativeBindings.MLEyeCameraSettings(1, MLEyeCameraIdentifier.All);

var resultCode = NativeBindings.MLEyeCameraConnect(ref settings, ref Instance.Handle);
MLResult.DidNativeCallSucceed(resultCode, nameof(NativeBindings.MLEyeCameraConnect));
return resultCode;
}

protected override MLResult.Code StopAPI()
{
var resultCode = NativeBindings.MLEyeCameraDisconnect(Instance.Handle);
MLResult.DidNativeCallSucceed(resultCode, nameof(NativeBindings.MLEyeCameraDisconnect));
return resultCode;
}

private MLResult InternalMLEyeCameraGetLatestCameraData(out EyeCameraData outData, UInt64 timeoutMS)
{
NativeBindings.MLEyeCameraData eyeCameraData = new NativeBindings.MLEyeCameraData(1);

var resultCode = NativeBindings.MLEyeCameraGetLatestCameraData(Instance.Handle, timeoutMS, ref eyeCameraData);

outData = new EyeCameraData(eyeCameraData);

if (!MLResult.DidNativeCallSucceed(resultCode, nameof(NativeBindings.MLEyeCameraGetLatestCameraData)))
return MLResult.Create(resultCode);

resultCode = NativeBindings.MLEyeCameraReleaseCameraData(Instance.Handle, ref eyeCameraData);
MLResult.DidNativeCallSucceed(resultCode, nameof(NativeBindings.MLEyeCameraReleaseCameraData));

return MLResult.Create(resultCode);
}

private MLResult InternalMLEyeCameraUpdateSettings(MLEyeCameraIdentifier cameras)
{
Instance.settings = new NativeBindings.MLEyeCameraSettings(1, cameras);

var resultCode = NativeBindings.MLEyeCameraUpdateSettings(Instance.Handle, ref Instance.settings);
MLResult.DidNativeCallSucceed(resultCode, nameof(NativeBindings.MLEyeCameraUpdateSettings));

return MLResult.Create(resultCode);
}
}
}
11 changes: 11 additions & 0 deletions Runtime/APIs/EyeCamera/MLEyeCameraInternal.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 4cece36

Please sign in to comment.