Skip to content

Commit

Permalink
Release v1.12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kgrinberg-ml committed Nov 8, 2023
1 parent 9e4553b commit 17cf096
Show file tree
Hide file tree
Showing 238 changed files with 846 additions and 1,082 deletions.
186 changes: 100 additions & 86 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Editor/APKBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ private System.IO.FileInfo GetBuildFolder()
string outDir = "Build";
TryGetArgValue(Arg_OutDir, ref outDir);

System.IO.FileInfo buildFolder = new System.IO.FileInfo(System.IO.Path.Combine(outDir, EditorUserBuildSettings.activeBuildTarget.ToString()));
System.IO.FileInfo buildFolder = new System.IO.FileInfo(outDir);
buildFolder.Directory.Create();

return buildFolder;
Expand Down
4 changes: 2 additions & 2 deletions Editor/BuildPreprocessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using UnityEditor.XR.Management;
using System.Linq;
using UnityEngine.XR.MagicLeap;
#if UNITY_OPENXR_1_7_0_OR_NEWER
#if UNITY_OPENXR_1_9_0_OR_NEWER
using UnityEngine.XR.OpenXR;
#endif

Expand Down Expand Up @@ -101,7 +101,7 @@ private bool IsMagicLeapLoaderEnabled()

private bool IsOpenXRLoaderEnabled()
{
#if UNITY_OPENXR_1_7_0_OR_NEWER
#if UNITY_OPENXR_1_9_0_OR_NEWER
var settings = XRGeneralSettingsPerBuildTarget.XRGeneralSettingsForBuildTarget(BuildTargetGroup.Android);
if (settings != null && settings.Manager != null && settings.Manager.activeLoaders.Where(l => l is OpenXRLoader).Count() > 0)
{
Expand Down
4 changes: 2 additions & 2 deletions Editor/MLAppSim/AppSimShimLibSupport.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
using UnityEngine.XR.MagicLeap;
using UnityEngine.XR.Management;
using UnityEditor.XR.Management;
#if UNITY_OPENXR_1_7_0_OR_NEWER
#if UNITY_OPENXR_1_9_0_OR_NEWER
using UnityEngine.XR.OpenXR;
#endif

Expand Down Expand Up @@ -46,7 +46,7 @@ private static void CheckForLibrarySearchPaths()
bool foundSupportedLoader = false;
#if UNITY_XR_MAGICLEAP_PROVIDER
foundSupportedLoader = settings.Manager.activeLoaders.Any(l => l is MagicLeapLoader);
#elif UNITY_OPENXR_1_7_0_OR_NEWER
#elif UNITY_OPENXR_1_9_0_OR_NEWER
foundSupportedLoader = settings.Manager.activeLoaders.Any(l => l is OpenXRLoader);
#endif

Expand Down
8 changes: 4 additions & 4 deletions Editor/MagicLeap.SDK.Editor.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"GUID:1fc69d160eafe774ab0a8e5191500311",
"GUID:e40ba710768534012815d3193fa296cb",
"GUID:f9fe0089ec81f4079af78eb2287a6163",
"GUID:96aa6ba065960476598f8f643e7252b6",
"GUID:4847341ff46394e83bb78fbd0652937e"
"GUID:4847341ff46394e83bb78fbd0652937e",
"GUID:96aa6ba065960476598f8f643e7252b6"
],
"includePlatforms": [
"Editor"
Expand All @@ -22,8 +22,8 @@
"versionDefines": [
{
"name": "com.unity.xr.openxr",
"expression": "1.7.0-ml.exp.x64",
"define": "UNITY_OPENXR_1_7_0_OR_NEWER"
"expression": "1.9.0-preview.1",
"define": "UNITY_OPENXR_1_9_0_OR_NEWER"
},
{
"name": "com.unity.xr.magicleap",
Expand Down
2 changes: 1 addition & 1 deletion Editor/OpenXR/AndroidBootConfig.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
Expand Down
6 changes: 1 addition & 5 deletions Editor/OpenXR/MagicLeapFeatureGroup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// ---------------------------------------------------------------------
// %BANNER_END%

#if UNITY_OPENXR_1_7_0_OR_NEWER
#if UNITY_OPENXR_1_9_0_OR_NEWER
using UnityEditor;
using UnityEditor.XR.OpenXR.Features;

Expand All @@ -21,12 +21,8 @@ namespace UnityEngine.XR.OpenXR.Features.MagicLeapSupport
SupportedBuildTargets = new [] { BuildTargetGroup.Android, BuildTargetGroup.Standalone },
FeatureIds = new [] {
MagicLeapFeature.featureId ,
#if XR_HANDS
MagicLeapHandTrackingFeature.featureId,
#endif
MagicLeapRenderingExtensionsFeature.featureId,
MagicLeapReferenceSpacesFeature.featureId,
MagicLeapClippingPlaneEnforcementFeature.featureId,
MagicLeapPlanesFeature.FeatureId,
MagicLeapUserCalibrationFeature.featureId,
}
Expand Down
2 changes: 1 addition & 1 deletion Editor/OpenXR/OpenXRBuildProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using UnityEditor.Build.Reporting;
using UnityEditor.XR.MagicLeap;

#if UNITY_OPENXR_1_7_0_OR_NEWER
#if UNITY_OPENXR_1_9_0_OR_NEWER
using UnityEngine.XR.OpenXR.Features.MagicLeapSupport;

namespace UnityEditor.XR.OpenXR.Features.MagicLeapSupport
Expand Down
2 changes: 1 addition & 1 deletion Editor/OpenXR/SegmentedDimmerMenuItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// ---------------------------------------------------------------------
// %BANNER_END%

#if UNITY_OPENXR_1_7_0_OR_NEWER
#if UNITY_OPENXR_1_9_0_OR_NEWER
using UnityEngine;
using UnityEngine.XR.OpenXR.Features.MagicLeapSupport;

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/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.
35 changes: 34 additions & 1 deletion Runtime/APIs/Anchors/MLAnchors.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,28 @@ public enum MappingMode
ARCloud,
};

/// <summary>
/// The quality of the local space around the anchor.
/// This can change over time as the user continues to scan the space.
/// </summary>
public enum Quality
{
/// <summary>
/// Low quality, this anchor can be expected to move significantly.
/// </summary>
Low,

/// <summary>
/// Medium quality, this anchor may move slightly.
/// </summary>
Medium,

/// <summary>
/// High quality, this anchor is stable and suitable for digital content attachment.
/// </summary>
High,
}

/// <summary>
/// Maximum size for the name of the space in the #MLSpatialAnchorLocalizationInfo structure.
/// </summary>
Expand Down Expand Up @@ -297,6 +319,11 @@ public static MLResult DeleteAnchorWithId(string anchorId)
/// </summary>
public string SpaceId => this.spaceId.ToString();

/// <summary>
/// The quality of the local space that this anchor occupies. This value may change over time.
/// </summary>
public string Quality => this.quality.ToString();

/// <summary>
/// Pose.
/// </summary>
Expand Down Expand Up @@ -330,6 +357,11 @@ public static MLResult DeleteAnchorWithId(string anchorId)
/// </summary>
internal readonly MagicLeapNativeBindings.MLCoordinateFrameUID cfuid;

/// <summary>
/// The quality of the local space that this anchor occupies. This value may change over time.
/// </summary>
internal readonly Quality quality;

public MLResult Publish()
{
var resultCode = MLAnchors.Instance.PublishAnchor(this);
Expand Down Expand Up @@ -369,6 +401,7 @@ internal Anchor(NativeBindings.MLSpatialAnchor nativeAnchor)
MagicLeapXrProviderNativeBindings.GetUnityPose(nativeAnchor.Cfuid, out this.Pose);
this.ExpirationTimeStamp = nativeAnchor.ExpirationTimeStamp;
this.IsPersisted = nativeAnchor.IsPersisted;
this.quality = nativeAnchor.Quality;
}

public static bool operator ==(Anchor one, Anchor two)
Expand Down Expand Up @@ -397,7 +430,7 @@ public override int GetHashCode()
return this.Id.GetHashCode();
}

public override string ToString() => $"id: {Id},\nPose: {Pose},\nExpirationTimeStamp: {ExpirationTimeStamp},\nIsPersisted: {IsPersisted},\nSpaceId: {SpaceId}";
public override string ToString() => $"id: {Id},\nPose: {Pose}, \nQuality: {Quality}, \nExpirationTimeStamp: {ExpirationTimeStamp},\nIsPersisted: {IsPersisted},\nSpaceId: {SpaceId}";
}

/// <summary>
Expand Down
11 changes: 9 additions & 2 deletions Runtime/APIs/Anchors/MLAnchorsNativeBindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,24 +76,31 @@ public readonly struct MLSpatialAnchor
/// </summary>
public readonly MLUUIDBytes SpaceId;

/// <summary>
/// The quality of the local space that this anchor occupies. This value may change over time.
/// </summary>
public readonly Quality Quality;

public MLSpatialAnchor(MLAnchors.Anchor anchor)
{
this.Version = 1;
this.Version = 2;
this.Id = anchor.id;
this.Cfuid = anchor.cfuid;
this.ExpirationTimeStamp = anchor.ExpirationTimeStamp;
this.IsPersisted = anchor.IsPersisted;
this.SpaceId = anchor.spaceId;
this.Quality = anchor.quality;
}

public MLSpatialAnchor(MLAnchors.Anchor anchor, ulong expirationTimeStamp)
{
this.Version = 1;
this.Version = 2;
this.Id = anchor.id;
this.Cfuid = anchor.cfuid;
this.ExpirationTimeStamp = expirationTimeStamp;
this.IsPersisted = anchor.IsPersisted;
this.SpaceId = anchor.spaceId;
this.Quality = anchor.quality;
}
};

Expand Down
6 changes: 5 additions & 1 deletion Runtime/APIs/CVCamera/MLCVCamera.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ protected override MLResult.Code StopAPI()
/// </returns>
private MLResult InternalGetFramePose(NativeBindings.CameraID cameraId, MLTime vcamTimestamp, out Matrix4x4 outTransform)
{
if (!MagicLeapXrProviderNativeBindings.IsHeadTrackingAvailable())
{
outTransform = default;
return MLResult.Create(MLResult.Code.PoseNotFound, "HeadTracking is not available");
}
MagicLeapNativeBindings.MLTransform outInternalTransform = new MagicLeapNativeBindings.MLTransform();

MLResult.Code resultCode = NativeBindings.MLCVCameraGetFramePose(Handle, MagicLeapXrProviderNativeBindings.GetHeadTrackerHandle(), cameraId, vcamTimestamp.Value, ref outInternalTransform);
MLResult.DidNativeCallSucceed(resultCode, nameof(NativeBindings.MLCVCameraGetFramePose));
MLResult poseResult = MLResult.Create(resultCode);
Expand Down
2 changes: 1 addition & 1 deletion Runtime/APIs/Dimmers/DimmerCameraControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// ---------------------------------------------------------------------
// %BANNER_END%

#if UNITY_OPENXR_1_7_0_OR_NEWER
#if UNITY_OPENXR_1_9_0_OR_NEWER
namespace UnityEngine.XR.OpenXR.Features.MagicLeapSupport
{
[RequireComponent(typeof(Camera))]
Expand Down
16 changes: 0 additions & 16 deletions Runtime/APIs/Dimmers/MLGlobalDimmer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%
#if UNITY_OPENXR_1_7_0_OR_NEWER
using UnityEngine.XR.OpenXR.Features.MagicLeapSupport;
#endif

namespace UnityEngine.XR.MagicLeap
{
Expand All @@ -28,24 +25,11 @@ public static partial class MLGlobalDimmer
/// 0.0 corresponds no global dimming while 1.0 corresponds to max global
/// dimming.</param>
/// <param name="enabled">Enable or disable the global dimmer.</param>
#if UNITY_OPENXR_1_7_0_OR_NEWER
public static MLResult.Code SetValue(float dimmerValue, bool enabled)
{
float clampedValue = Mathf.Clamp(dimmerValue, 0.0f, 1.0f);
var dimmerInfoStruct = new NativeBindings.XrGlobalDimmerFrameEndInfoML(clampedValue, enabled);

var resultCode = NativeBindings.MLOpenXRSetGlobalDimmerFrameEndInfoParams(dimmerInfoStruct);
MLResult.DidNativeCallSucceed(resultCode, nameof(NativeBindings.MLOpenXRSetGlobalDimmerFrameEndInfoParams));

return resultCode;
}
#else
public static MLResult SetValue(float dimmerValue, bool enabled = true)
{
float clampedValue = Mathf.Clamp(dimmerValue, 0.0f, 1.0f);
NativeBindings.UnityMagicLeap_RenderingSetGlobalDimmerValue(clampedValue);
return MLResult.Create(MLResult.Code.Ok);
}
#endif
}
}
22 changes: 0 additions & 22 deletions Runtime/APIs/Dimmers/MLGlobalDimmerNativeBindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,34 +8,12 @@ public static partial class MLGlobalDimmer
{
private class NativeBindings : MagicLeapNativeBindings
{
public const int XR_TYPE_GLOBAL_DIMMER_FRAME_END_INFO_ML = 1000136000;

[StructLayout(LayoutKind.Sequential)]
public readonly struct XrGlobalDimmerFrameEndInfoML
{
public readonly int Type;
public readonly IntPtr Next;
public readonly float DimmerValue;
public readonly long EnabledFlag;

public XrGlobalDimmerFrameEndInfoML(float dimmerValue, bool enabled)
{
Type = XR_TYPE_GLOBAL_DIMMER_FRAME_END_INFO_ML;
Next = IntPtr.Zero;
DimmerValue = dimmerValue;
EnabledFlag = enabled ? 1L : 0L;
}
}

/// <summary>
/// Sets the GlobalDimmer value via the Magic Leap XR Plugin
/// </summary>
/// <param name="dimmerValue">Level of opacity, between 0 and 1, of global dimmer.</param>
[DllImport(UnityMagicLeapDll, CallingConvention = CallingConvention.Cdecl)]
public static extern void UnityMagicLeap_RenderingSetGlobalDimmerValue(float dimmerValue);

[DllImport(MagicLeapXrProviderNativeBindings.MagicLeapXrProviderDll, CallingConvention = CallingConvention.Cdecl)]
public static extern MLResult.Code MLOpenXRSetGlobalDimmerFrameEndInfoParams(XrGlobalDimmerFrameEndInfoML globalDimmerFrameEndInfoML);
}
}
}
Loading

0 comments on commit 17cf096

Please sign in to comment.