Skip to content

Commit

Permalink
Release v1.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
bsawyer-ml committed May 22, 2023
1 parent 1fc9526 commit 10dfef9
Show file tree
Hide file tree
Showing 18 changed files with 274 additions and 151 deletions.
118 changes: 114 additions & 4 deletions Assets/MagicLeap/Examples/Scenes/MediaPlayer.unity
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.18028386, g: 0.22571427, b: 0.3069231, a: 1}
m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -155,6 +155,18 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &425463606 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1212932027842687027, guid: 0ffd6c0636c54b94cb445a6bcd349bf1,
type: 3}
m_PrefabInstance: {fileID: 1530880107}
m_PrefabAsset: {fileID: 0}
--- !u!1 &437861588 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1212932027842687027, guid: 0ffd6c0636c54b94cb445a6bcd349bf1,
type: 3}
m_PrefabInstance: {fileID: 1319996495}
m_PrefabAsset: {fileID: 0}
--- !u!114 &618107767 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 9144045081349396371, guid: 6906f74934047d24e9a47bbdd1afb57a,
Expand Down Expand Up @@ -200,6 +212,12 @@ Transform:
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1029815186 stripped
GameObject:
m_CorrespondingSourceObject: {fileID: 1212932027842687027, guid: 0ffd6c0636c54b94cb445a6bcd349bf1,
type: 3}
m_PrefabInstance: {fileID: 1672931625}
m_PrefabAsset: {fileID: 0}
--- !u!1001 &1144542540
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -980,23 +998,69 @@ PrefabInstance:
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6669455948576777451, guid: 0ffd6c0636c54b94cb445a6bcd349bf1,
type: 3}
propertyPath: prepareAfterStop
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 1212932027842687027, guid: 0ffd6c0636c54b94cb445a6bcd349bf1,
type: 3}
insertIndex: -1
addedObject: {fileID: 1319996498}
m_SourcePrefab: {fileID: 100100000, guid: 0ffd6c0636c54b94cb445a6bcd349bf1, type: 3}
--- !u!4 &1319996496 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1349745745868055630, guid: 0ffd6c0636c54b94cb445a6bcd349bf1,
type: 3}
m_PrefabInstance: {fileID: 1319996495}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1319996498
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 437861588}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 47e4e021355edcc449ac2d9cca5b9105, type: 3}
m_Name:
m_EditorClassIdentifier:
mediaPlayerBehavior: {fileID: 1432346203}
--- !u!23 &1370325391 stripped
MeshRenderer:
m_CorrespondingSourceObject: {fileID: 3131652113458425602, guid: 0ffd6c0636c54b94cb445a6bcd349bf1,
type: 3}
m_PrefabInstance: {fileID: 1530880107}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1370325394 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6669455948576777451, guid: 0ffd6c0636c54b94cb445a6bcd349bf1,
type: 3}
m_PrefabInstance: {fileID: 1530880107}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9e09ce4a5f1fc4144a50a63bff73dc6b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1432346203 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6669455948576777451, guid: 0ffd6c0636c54b94cb445a6bcd349bf1,
type: 3}
m_PrefabInstance: {fileID: 1319996495}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9e09ce4a5f1fc4144a50a63bff73dc6b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1 &1462129510
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1251,14 +1315,43 @@ PrefabInstance:
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 1212932027842687027, guid: 0ffd6c0636c54b94cb445a6bcd349bf1,
type: 3}
insertIndex: -1
addedObject: {fileID: 1530880110}
m_SourcePrefab: {fileID: 100100000, guid: 0ffd6c0636c54b94cb445a6bcd349bf1, type: 3}
--- !u!4 &1530880108 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1349745745868055630, guid: 0ffd6c0636c54b94cb445a6bcd349bf1,
type: 3}
m_PrefabInstance: {fileID: 1530880107}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1530880110
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 425463606}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 47e4e021355edcc449ac2d9cca5b9105, type: 3}
m_Name:
m_EditorClassIdentifier:
mediaPlayerBehavior: {fileID: 1370325394}
--- !u!114 &1659751857 stripped
MonoBehaviour:
m_CorrespondingSourceObject: {fileID: 6669455948576777451, guid: 0ffd6c0636c54b94cb445a6bcd349bf1,
type: 3}
m_PrefabInstance: {fileID: 1672931625}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9e09ce4a5f1fc4144a50a63bff73dc6b, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!1001 &1672931625
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -1405,14 +1498,31 @@ PrefabInstance:
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_AddedComponents:
- targetCorrespondingSourceObject: {fileID: 1212932027842687027, guid: 0ffd6c0636c54b94cb445a6bcd349bf1,
type: 3}
insertIndex: -1
addedObject: {fileID: 1672931628}
m_SourcePrefab: {fileID: 100100000, guid: 0ffd6c0636c54b94cb445a6bcd349bf1, type: 3}
--- !u!4 &1672931626 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 1349745745868055630, guid: 0ffd6c0636c54b94cb445a6bcd349bf1,
type: 3}
m_PrefabInstance: {fileID: 1672931625}
m_PrefabAsset: {fileID: 0}
--- !u!114 &1672931628
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1029815186}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 47e4e021355edcc449ac2d9cca5b9105, type: 3}
m_Name:
m_EditorClassIdentifier:
mediaPlayerBehavior: {fileID: 1659751857}
--- !u!1001 &1710279060
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down
2 changes: 1 addition & 1 deletion Assets/MagicLeap/Examples/Scripts/CVCameraExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ private void UpdateStatusText()
}
if (!string.IsNullOrEmpty(poseText))
{
_statusText.text += poseText;
_statusText.text += "\n" + poseText;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ public class CameraCaptureExample : MonoBehaviour
[SerializeField, Tooltip("Button that disconnect from MLCamera")]
private Button disconnectButton;

private Coroutine recordingRoutine;

private bool IsCameraConnected => captureCamera != null && captureCamera.ConnectionEstablished;

private List<MLCamera.StreamCapability> streamCapabilities;
Expand Down Expand Up @@ -149,6 +151,8 @@ private void OnApplicationPause(bool isPaused)
{
if (isPaused && IsCameraConnected)
{
StopCoroutine(recordingRoutine);
StopVideoCapture();
DisconnectCamera();
}
else
Expand Down Expand Up @@ -302,7 +306,7 @@ private void OnCaptureButtonClicked()
GetStreamCapability().CaptureType == MLCamera.CaptureType.Preview)
{
StartVideoCapture();
StartCoroutine(StopVideo());
recordingRoutine = StartCoroutine(StopVideo());
}

RefreshUI();
Expand Down Expand Up @@ -604,9 +608,11 @@ private void OnCaptureRawVideoFrameAvailable(MLCamera.CameraOutput capturedFrame
captureInfoText.text = capturedFrame.ToString();
}

if (OutputFormat == MLCamera.OutputFormat.RGBA_8888 && FrameRate == MLCamera.CaptureFrameRate._30FPS && GetStreamCapability().Width >= 4096)
if (OutputFormat == MLCamera.OutputFormat.RGBA_8888 && FrameRate == MLCamera.CaptureFrameRate._30FPS && GetStreamCapability().Width >= 3840)
{
// cameraCaptureVisualizer cannot handle throughput of RGBA_8888 4096x3072 at 30 fps
// cameraCaptureVisualizer cannot handle throughput of:
// 1) RGBA_8888 3840x2160 at 30 fps
// 2) RGBA_8888 4096x3072 at 30 fps
skipFrame = !skipFrame;
if (skipFrame)
{
Expand Down
2 changes: 2 additions & 0 deletions Assets/MagicLeap/Examples/Scripts/ControlExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ private void UpdateStatus()

StringBuilder strBuilder = new StringBuilder();
strBuilder.Append($"Position: <i>{controllerActions.Position.ReadValue<Vector3>().ToString("n2")}</i>\n");
strBuilder.Append($"Velocity: <i>{controllerActions.Velocity.ReadValue<Vector3>().ToString("n2")}</i>\n");
strBuilder.Append($"AngularVelocity: <i>{controllerActions.AngularVelocity.ReadValue<Vector3>().ToString("n2")}</i>\n");
strBuilder.Append($"Acceleration: <i>{controllerActions.Acceleration.ReadValue<Vector3>().ToString("n2")}</i>\n");
strBuilder.Append($"AngularAcceleration: <i>{controllerActions.AngularAcceleration.ReadValue<Vector3>().ToString("n2")}</i>\n");

Expand Down
50 changes: 30 additions & 20 deletions Assets/MagicLeap/Examples/Scripts/DepthCameraExample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ public class DepthCameraExample : MonoBehaviour

private bool permissionGranted;
private bool isFrameAvailable = false;
private MLDepthCamera depthCamera = null;
private MLDepthCamera.Data lastData = null;

/// <summary>
Expand Down Expand Up @@ -48,6 +47,8 @@ public class DepthCameraExample : MonoBehaviour
private float confidenceMinDist;
private float confidenceMaxDist;

private bool isPerceptionSystemStarted;

[SerializeField, Tooltip("Timeout in milliseconds for data retrieval.")]
private ulong timeout = 0;

Expand Down Expand Up @@ -91,13 +92,6 @@ void Awake()

void Start()
{
var settings = new MLDepthCamera.Settings()
{
Mode = mode,
Flags = captureFlag
};
depthCamera = new MLDepthCamera(settings);

MLPermissions.RequestPermission(MLPermission.DepthCamera, permissionCallbacks);
}

Expand All @@ -108,18 +102,23 @@ private void OnEnable()

void Update()
{
if (!permissionGranted || depthCamera == null || !depthCamera.IsConnected)
if (!permissionGranted || !MLDepthCamera.IsConnected)
{
return;
}

var result = depthCamera.GetLatestDepthData(timeout, out MLDepthCamera.Data data);
var result = MLDepthCamera.GetLatestDepthData(timeout, out MLDepthCamera.Data data);
isFrameAvailable = result.IsOk;
if (result.IsOk)
{
lastData = data;
}

if (lastData == null)
{
return;
}

switch (captureFlag)
{
case MLDepthCamera.CaptureFlags.AmbientRawDepthImage:
Expand Down Expand Up @@ -171,7 +170,10 @@ private void OnDestroy()
permissionCallbacks.OnPermissionGranted -= OnPermissionGranted;
permissionCallbacks.OnPermissionDenied -= OnPermissionDenied;
permissionCallbacks.OnPermissionDeniedAndDontAskAgain -= OnPermissionDenied;
DisonnectCamera();
if (MLDepthCamera.IsConnected)
{
DisonnectCamera();
}
}

private void OnPermissionDenied(string permission)
Expand All @@ -190,16 +192,25 @@ private void OnPermissionGranted(string permission)
{
MLPluginLog.Debug($"Granted {permission}.");
permissionGranted = true;

var settings = new MLDepthCamera.Settings()
{
Mode = mode,
Flags = captureFlag
};
MLDepthCamera.SetSettings(settings);

ConnectCamera();
UpdateUI(0);
}

private void ConnectCamera()
{
var result = depthCamera.Connect();
if (result.IsOk && depthCamera.IsConnected)
var result = MLDepthCamera.Connect();
if (result.IsOk && MLDepthCamera.IsConnected)
{
Debug.Log($"Connected to new depth camera with mode = {depthCamera.CurrentSettings.Mode} and flags = {depthCamera.CurrentSettings.Flags}");
isPerceptionSystemStarted = true;
Debug.Log($"Connected to new depth camera with mode = {MLDepthCamera.CurrentSettings.Mode} and flags = {MLDepthCamera.CurrentSettings.Flags}");
}
else
{
Expand All @@ -209,10 +220,10 @@ private void ConnectCamera()

private void DisonnectCamera()
{
var result = depthCamera.Disconnect();
if (result.IsOk && !depthCamera.IsConnected)
var result = MLDepthCamera.Disconnect();
if (result.IsOk && !MLDepthCamera.IsConnected)
{
Debug.Log($"Disconnected depth camera with mode = {depthCamera.CurrentSettings.Mode} and flags = {depthCamera.CurrentSettings.Flags}");
Debug.Log($"Disconnected depth camera with mode = {MLDepthCamera.CurrentSettings.Mode} and flags = {MLDepthCamera.CurrentSettings.Flags}");
}
else
{
Expand All @@ -222,7 +233,6 @@ private void DisonnectCamera()

void UpdateUI(int _)
{

mode = cameraModeDropdown.GetSelected<MLDepthCamera.Mode>();
captureFlag = captureFlagsDropdown.GetSelected<MLDepthCamera.CaptureFlags>();

Expand Down Expand Up @@ -267,7 +277,7 @@ void UpdateUI(int _)

private void CheckAndCreateTexture(int width, int height)
{
if (ImageTexture == null || ImageTexture.width != width || ImageTexture.height != height)
if (ImageTexture == null || (ImageTexture != null && (ImageTexture.width != width || ImageTexture.height != height)))
{
ImageTexture = new Texture2D(width, height, TextureFormat.RFloat, false);
ImageTexture.filterMode = FilterMode.Bilinear;
Expand All @@ -292,6 +302,6 @@ private void UpdateSettings()
Flags = captureFlag
};

depthCamera.UpdateSettings(settings);
MLDepthCamera.UpdateSettings(settings);
}
}
Loading

0 comments on commit 10dfef9

Please sign in to comment.