Skip to content

Commit

Permalink
Release v1.1.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nihav-Jain committed Nov 9, 2022
1 parent 4d559e4 commit 46ef92a
Show file tree
Hide file tree
Showing 71 changed files with 1,642 additions and 775 deletions.
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# Changelog

## [1.1.0]

### Features
- Unity Magic Leap XR Plugin dependency updated to 7.0.0-pre.1
- Using Segmented Dimmer now requires an explicit `MLSegmentedDimmer.Activate()` call in order to request the Graphics API provide AlphaBlend frames.
- Per-frame intrinsics via for Mixed Reality Configured MLWebRTC/MLCamera are now available.
- Controller 6dof state filtering is now available.
- Unity XRI haptics now supported.
- `SettingsIntentsLauncher` can be used to open certain Android Settings views directly from Unity.
- Added new `MLMediaPlayer` `OnVideoRendererInitialized` callback for when video renderer is fully initialized
- Added `GetData` function to `AudioInputBufferClip` that does not automatically wrap the audio data and instead sends you exactly what is in the audio buffer.

### Bugfixes
- Fixed bug in WebRTC where toggling local video off and then back on during a connected session did not work.
- Fixed bug in WebRTC which prevented a session from persisting between scene changes.
- Fixed bug in WebRTC where Mixed Reality capture showed a transparent vertical bar on the side of the image.
- Fixed `MLSegmentedDimmer` behavior where disabling dimmers using the `IsEnabled` property did not work as expected. The property has been marked `Obsolete` and replaced with a `SetEnabled()` method which turns on and off the MeshRenderers for objects on your Segmented Dimmer layer.
- Fixed issue with WebView's first tab loading before service is connected.
- Fixed Meshing Subsystem using invalid handles if device headpose gets reset
- Corrected some `MLCamera` event delegates being incorrectly defined.
- Fixed issue in WebView where adding too many tabs caused them to begin rendering outside of UI bounds.
- `MagicLEapHandDevice` is no longer derived from `XRController`

### Deprecations & Removals
- Numerous MLSegmentedDimmer API properties have been marked `Obsolete` as they are non-functional and will be removed in a future release.

## [1.0.0]

### Features
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -72,25 +72,6 @@ private void OnRemoteChecksUI()
{
GUILayout.Label("Magic Leap App Simulator Requirements", EditorStyles.boldLabel);

using (new GUILayout.HorizontalScope())
{
GUILayout.Label("Rendering API:");
GUILayout.Label(SystemInfo.graphicsDeviceType.ToString(), GUI.skin.textField);
using (new EditorGUI.DisabledScope(!NeedToSwitchToGLCore))
{
if (GUILayout.Button("Restart w/ OpenGL"))
{
if (EditorUtility.DisplayDialog("Editor Restart Required",
string.Format(
"To use Magic Leap App Simulator for Unity within the editor, the editor must restart using OpenGL."),
"Restart", "Do Not Restart"))
{
Restart("-force-glcore");
}
}
}
}

using (new GUILayout.HorizontalScope())
{
if (GUILayout.Button("Import MagicLeap unitypackage"))
Expand All @@ -104,7 +85,6 @@ private void OnRemoteChecksUI()
// show options as a drop down.
versions.DropDown(rect);
}

}
}

Expand Down Expand Up @@ -138,7 +118,7 @@ private static void ShowProgressDialog()
}
}

internal static void LaunchLabDriver(string filename, string args, Action<bool, string> onComplete, bool importCommand = false, bool useVirtualDevice = false)
internal static void LaunchLabDriver(List<string> args, Action<bool, string> onComplete, bool importCommand = false, bool useVirtualDevice = false)
{
EditorApplication.update += ShowProgressDialog;

Expand All @@ -150,13 +130,26 @@ internal static void LaunchLabDriver(string filename, string args, Action<bool,
var startInfo = new ProcessStartInfo
{
UseShellExecute = false,
FileName = filename,
Arguments = args,
#if UNITY_EDITOR_WIN
FileName = "cmd.exe",
#else // OSX or Linux
FileName = "/bin/sh",
#endif
CreateNoWindow = true,
RedirectStandardOutput = true,
RedirectStandardError = true
};

// copy arguments into new-style ArgumentList, which handles spaces properly
#if UNITY_EDITOR_WIN
// i.e. "cmd /C labdriver ..." runs this command rather than an interactive shell
startInfo.ArgumentList.Add("/C");
#endif
foreach (string arg in args)
{
startInfo.ArgumentList.Add(arg);
}

if (useVirtualDevice)
{
if (!startInfo.EnvironmentVariables.ContainsKey("ML_ZI_ROOT"))
Expand Down Expand Up @@ -184,7 +177,7 @@ internal static void LaunchLabDriver(string filename, string args, Action<bool,
s_Process.BeginErrorReadLine();
}

private static void LaunchLabDriverCommand(string commands, Action<bool, string> onComplete)
private static void LaunchLabDriverCommand(List<string> commands, Action<bool, string> onComplete)
{
var sdkPath = MagicLeapSDKUtil.SdkPath;
if (string.IsNullOrEmpty(sdkPath))
Expand All @@ -199,12 +192,13 @@ private static void LaunchLabDriverCommand(string commands, Action<bool, string>
}
if (!s_LabdriverIsRunning)
{
UnityEngine.Debug.Log("Launching labdriver with: " + commands);
#if UNITY_EDITOR_OSX
LaunchLabDriver("/bin/bash", $"\"{sdkPath}/labdriver\" -pretty " + commands, onComplete);
#elif UNITY_EDITOR_WIN
LaunchLabDriver("cmd.exe", $"/C \"{sdkPath}/labdriver.cmd\" -pretty " + commands, onComplete);
UnityEngine.Debug.Log("Launching labdriver with: " + string.Join(" ", commands));
#if UNITY_EDITOR_WIN
commands.InsertRange(0, new List<string>{$"{sdkPath}/labdriver.cmd", "-pretty"});
#else // OSX or Linux
commands.InsertRange(0, new List<string>{$"{sdkPath}/labdriver", "-pretty"});
#endif
LaunchLabDriver(commands, onComplete);
}
else
{
Expand All @@ -223,7 +217,7 @@ private static void HandleLabDriverResult(bool success, string json)
[MenuItem("Magic Leap/Launch Magic Leap Hub")]
private static void LaunchHub()
{
LaunchLabDriverCommand("start-gui", HandleLabDriverResult);
LaunchLabDriverCommand(new List<string>{"start-gui"}, HandleLabDriverResult);
}

[MenuItem("Magic Leap/Save Diagnostic Logs...")]
Expand Down Expand Up @@ -257,45 +251,33 @@ void OpenLogFile(bool success, string json)
}

// reveal file in explorer/finder
string revealName;
string revealArguments;
ProcessStartInfo startInfo = null;
#if UNITY_EDITOR_OSX
revealName = "/usr/bin/open";
revealArguments = $"-R \"{tempFilePath}\"";
startInfo = new ProcessStartInfo
{
UseShellExecute = false,
FileName = "/usr/bin/open",
ArgumentList = { "-R", tempFilePath },
CreateNoWindow = true
};
#elif UNITY_EDITOR_WIN
revealName = "explorer.exe";
revealArguments = $"/select, \"${tempFilePath}\"";
#endif

var startInfo = new ProcessStartInfo
startInfo = new ProcessStartInfo
{
UseShellExecute = true,
FileName = revealName,
Arguments = revealArguments,
UseShellExecute = false,
FileName = "explorer.exe",
ArgumentList = { "/select,", tempFilePath }, // the embedded comma is needed
CreateNoWindow = true
};

var process = new System.Diagnostics.Process();
process.StartInfo = startInfo;
process.Start();
#endif
if (startInfo != null)
{
var process = new System.Diagnostics.Process();
process.StartInfo = startInfo;
process.Start();
}
}

LaunchLabDriverCommand($"save-logs \"{tempFilePath}\"", OpenLogFile);
}

private static void Restart(params string[] args)
{
EditorApplication.OpenProject(ProjectPath, args);
}

private static string ProjectPath
{
get { return Path.GetDirectoryName(Application.dataPath); }
}

private static bool NeedToSwitchToGLCore
{
get { return SystemInfo.graphicsDeviceType != GraphicsDeviceType.OpenGLCore; }
LaunchLabDriverCommand(new List<string>{"save-logs", tempFilePath}, OpenLogFile);
}

private static void WaitForComplete()
Expand Down
File renamed without changes.
17 changes: 15 additions & 2 deletions Editor/SettingsProviders/Preferences/MagicLeapEditorPreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,16 @@ private static void ZIOverrideToggleChanged(ChangeEvent<bool> evt)

private static void ZIPathBrowseBtn_clicked()
{
string startingPath = Path.IsPathFullyQualified(ziInputField.value) ? Path.GetFullPath(ziInputField.value) : Directory.GetCurrentDirectory();
string startingPath;
if (string.IsNullOrEmpty(ziInputField.value))
{
startingPath = Directory.GetCurrentDirectory();
}
else
{
startingPath = Path.IsPathFullyQualified(ziInputField.value) ? Path.GetFullPath(ziInputField.value) : Directory.GetCurrentDirectory();
}

if(!Directory.Exists(startingPath))
{
startingPath = "";
Expand All @@ -207,7 +216,7 @@ private static void ZIPathBrowseBtn_clicked()

private static void ZIPathChanged(ChangeEvent<string> textFieldChangedEvt)
{
if(ziPathOverrideToggle.value)
if (ziPathOverrideToggle.value)
{
usingLabdriverFoundPath = false;
ziRuntimePath = textFieldChangedEvt.newValue;
Expand All @@ -217,6 +226,8 @@ private static void ZIPathChanged(ChangeEvent<string> textFieldChangedEvt)
EditorPrefs.SetString(UserCustomZIBackendPath, textFieldChangedEvt.newValue);
}
}

MagicLeapEditorPreferencesProvider.OnZIPathChanged?.Invoke(textFieldChangedEvt.newValue);
}

private static void SdkPathChanged(ChangeEvent<string> textFieldChangedEvt)
Expand All @@ -226,6 +237,8 @@ private static void SdkPathChanged(ChangeEvent<string> textFieldChangedEvt)
{
SaveNewSDKPath(textFieldChangedEvt.newValue);
}

MagicLeapEditorPreferencesProvider.OnSDKPathChanged?.Invoke(textFieldChangedEvt.newValue);
}

private static void SdkPathBrowseBtn_clicked()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) 2022 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;

namespace UnityEditor.XR.MagicLeap
{
public static class MagicLeapEditorPreferencesProvider
{
public static Action<string> OnSDKPathChanged = null;
public static Action<string> OnZIPathChanged = null;
}
}

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

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_systrace_plugin.so
Binary file not shown.
Binary file modified Plugins/Android/libml_unity_native_logging.so
Binary file not shown.
Binary file modified Plugins/Android/libml_ycbcr_renderer.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_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_unity_native_logging.dll
Binary file not shown.
17 changes: 16 additions & 1 deletion Runtime/APIs/Audio/MLAudioInputBufferClip.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ protected override void OnReceiveSamples(float[] samples)
}
}

// Automatically wraps the data past the BufferPosition index to be at the front of the given samples array.
public int GetData(float[] samples, int readPosition, out int nextReadPosition)
{
lock (bufferLock)
Expand All @@ -83,11 +84,25 @@ public int GetData(float[] samples, int readPosition, out int nextReadPosition)

nextReadPosition = samplesToRead - samplesToReadFromEnd;
System.Array.Copy(buffer, readPosition, samples, 0, samplesToReadFromEnd);
System.Array.Copy(buffer, 0, samples, 0, nextReadPosition);
System.Array.Copy(buffer, 0, samples, samplesToReadFromEnd, nextReadPosition);
return samplesToRead;
}
}
}

// Does not wrap any data, returns exactly what's in the buffer.
public int GetData(float[] samples, int readPosition)
{
lock (bufferLock)
{
if (readPosition > bufferSampleCount || readPosition < 0)
return 0;

int samplesToRead = Mathf.Min(bufferSampleCount - readPosition, samples.Length);
System.Array.Copy(buffer, readPosition, samples, 0, samplesToRead);
return samplesToRead;
}
}

public AudioClip FlushToClip()
{
Expand Down
6 changes: 3 additions & 3 deletions Runtime/APIs/Camera/API/MLCameraEvents.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private static int GetDeviceAvailabilitySubscriberCount()
/// </summary>
/// <param name="metadataHandle">Handle to metadata of captured frame.</param>
/// <param name="extra">Carries capture result information of current captured frame.</param>
public delegate void OnCaptureCompletedDelegate(ulong metadataHandle, ResultExtras extra);
public delegate void OnCaptureCompletedDelegate(Metadata metadataHandle, ResultExtras extra);

/// <summary>
/// Delegate to notify the app when the result of a preview capture is available.
Expand All @@ -205,14 +205,14 @@ private static int GetDeviceAvailabilitySubscriberCount()
/// </summary>
/// <param name="frameInfo">Frame data</param>
/// <param name="extra">Carries capture result information of current captured frame.</param>
public delegate void OnCapturedFrameAvailableDelegate(CameraOutput frameInfo, ResultExtras resultExtras);
public delegate void OnCapturedFrameAvailableDelegate(CameraOutput frameInfo, ResultExtras resultExtras, Metadata metadataHandle);

/// <summary>
/// Delegate to notify the app when the frame data of a preview is available.
/// </summary>
/// <param name="metadataHandle">Handle to metadata of captured frame.</param>
/// <param name="extra">Carries capture result information of current captured frame.</param>
public delegate void OnPreviewBufferAvailableDelegate(ulong metadataHandle, ResultExtras extra);
public delegate void OnPreviewBufferAvailableDelegate(Metadata metadataHandle, ResultExtras extra);

#endregion
}
Expand Down
4 changes: 2 additions & 2 deletions Runtime/APIs/Camera/Bindings/MLCameraNativeBindings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ internal partial class NativeBindings : Native.MagicLeapNativeBindings
/// </summary>
private const int MLCameraMaxStreams = 2;

#region V2
#region V2

[DllImport(MLCameraDll, CallingConvention = CallingConvention.Cdecl)]
public static extern MLResult.Code MLCameraInit(ref MLCameraDeviceAvailabilityStatusCallbacks deviceAvailabilityStatusCallback, IntPtr userData);
Expand Down Expand Up @@ -226,7 +226,7 @@ internal partial class NativeBindings : Native.MagicLeapNativeBindings
[DllImport(MLCameraDll, CallingConvention = CallingConvention.Cdecl)]
public static extern MLResult.Code MLCameraGetCameraCharacteristics(ulong contextHandle, out ulong outMetadataHandle);

#endregion
#endregion
}
}
}
Expand Down
Loading

0 comments on commit 46ef92a

Please sign in to comment.