Skip to content

Commit ea709a1

Browse files
committed
Release v1.12.0
1 parent 4687f1e commit ea709a1

14 files changed

+127
-96
lines changed

Assets/MagicLeap/Examples/Scenes/MarkerTracking.unity

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -312,12 +312,12 @@ PrefabInstance:
312312
- target: {fileID: 1359980009267695964, guid: 6906f74934047d24e9a47bbdd1afb57a,
313313
type: 3}
314314
propertyPath: m_AnchorMax.x
315-
value: 1
315+
value: 0
316316
objectReference: {fileID: 0}
317317
- target: {fileID: 1359980009267695964, guid: 6906f74934047d24e9a47bbdd1afb57a,
318318
type: 3}
319319
propertyPath: m_AnchorMax.y
320-
value: 1
320+
value: 0
321321
objectReference: {fileID: 0}
322322
- target: {fileID: 5355557165450182212, guid: 6906f74934047d24e9a47bbdd1afb57a,
323323
type: 3}
@@ -567,10 +567,10 @@ PrefabInstance:
567567
- target: {fileID: 9144045080803666705, guid: 6906f74934047d24e9a47bbdd1afb57a,
568568
type: 3}
569569
propertyPath: m_Text
570-
value: '<color=#B7B7B8><b>Trigger</b></color>
570+
value: '<color=#B7B7B8><b>Bumper</b></color>
571571
572-
If tracking was not
573-
set to enabled in the inspector settings, holding the trigger will toggle
572+
If Always On was not
573+
set to enabled in the inspector settings, holding the bumper will toggle
574574
the tracker to be enabled.'
575575
objectReference: {fileID: 0}
576576
- target: {fileID: 9144045080852108117, guid: 6906f74934047d24e9a47bbdd1afb57a,
@@ -2722,12 +2722,6 @@ CanvasRenderer:
27222722
m_PrefabAsset: {fileID: 0}
27232723
m_GameObject: {fileID: 907428589}
27242724
m_CullTransparentMesh: 0
2725-
--- !u!1 &920891312 stripped
2726-
GameObject:
2727-
m_CorrespondingSourceObject: {fileID: 5589497132891496769, guid: fe799b2d0a84dfe43b001b56276fd2fb,
2728-
type: 3}
2729-
m_PrefabInstance: {fileID: 957753390}
2730-
m_PrefabAsset: {fileID: 0}
27312725
--- !u!1 &957632325
27322726
GameObject:
27332727
m_ObjectHideFlags: 0
@@ -3785,16 +3779,15 @@ MonoBehaviour:
37853779
m_Script: {fileID: 11500000, guid: b2c42b3ea8c3b2f41add049147d57601, type: 3}
37863780
m_Name:
37873781
m_EditorClassIdentifier:
3782+
AlwaysOn: 0
37883783
statusText: {fileID: 80860511}
37893784
markerVisualPrefab: {fileID: 1901461232108414532, guid: f442d62da6611e44cb6847b0cfe52aa1,
37903785
type: 3}
3791-
markersRoot: {fileID: 920891312}
37923786
removeMarkersUsingTimeStamps: 0
37933787
markerTrackerTimeout: 0.5
37943788
MarkerTypes: -1
37953789
ArucoDicitonary: 0
37963790
ArucoMarkerSize: 0.1
3797-
ArucoTrackingCamera: 1
37983791
QRCodeSize: 0.1
37993792
TrackerProfile: 0
38003793
EnableMarkerScanning: 1

Assets/MagicLeap/Examples/Scripts/AudioCaptureExample.cs

Lines changed: 16 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ [SerializeField] [Tooltip("The text to display the recording status.")]
6969

7070
private bool hasPermission;
7171

72-
private MLAudioInput.MicCaptureType micCaptureType = MLAudioInput.MicCaptureType.VoiceCapture;
72+
private MLAudioInput.MicCaptureType micCaptureType = MLAudioInput.MicCaptureType.VoiceComm;
7373
private MLAudioInput.BufferClip mlAudioBufferClip;
7474
private MLAudioInput.StreamingClip mlAudioStreamingClip;
7575

@@ -204,33 +204,22 @@ private void StartMicrophone()
204204
}
205205

206206
playbackAudioSource.Stop();
207-
switch (captureMode)
207+
if (captureMode != CaptureMode.Realtime)
208208
{
209-
case CaptureMode.Realtime:
210-
if (mlAudioStreamingClip == null)
211-
{
212-
mlAudioStreamingClip = new MLAudioInput.StreamingClip(micCaptureType, 3, MLAudioInput.GetSampleRate(micCaptureType));
213-
playbackAudioSource.pitch = 1;
214-
}
215-
216-
playbackAudioSource.clip = mlAudioStreamingClip.UnityAudioClip;
217-
playbackAudioSource.loop = true;
218-
playbackAudioSource.Play();
219-
break;
220-
case CaptureMode.Interactive:
221-
CreateInteractiveAudioBuffer();
222-
playbackAudioSource.pitch = 1;
223-
playbackAudioSource.clip = null;
224-
playbackAudioSource.loop = false;
225-
break;
209+
return;
210+
}
211+
212+
if (mlAudioStreamingClip == null)
213+
{
214+
mlAudioStreamingClip = new MLAudioInput.StreamingClip(micCaptureType, 3, MLAudioInput.GetSampleRate(micCaptureType));
215+
playbackAudioSource.pitch = 1;
226216
}
227-
}
228217

229-
private void CreateInteractiveAudioBuffer()
230-
{
231-
mlAudioBufferClip = new MLAudioInput.BufferClip(micCaptureType, AudioClipLengthSeconds, MLAudioInput.GetSampleRate(micCaptureType));
218+
playbackAudioSource.clip = mlAudioStreamingClip.UnityAudioClip;
219+
playbackAudioSource.loop = true;
220+
playbackAudioSource.Play();
232221
}
233-
222+
234223
private void VisualizeRecording()
235224
{
236225
rmsVisualizerMaterial.color = isCapturingInteractiveAudio ? Color.green : Color.white;
@@ -257,9 +246,10 @@ private void VisualizePlayback()
257246
private void StopCapture()
258247
{
259248
isCapturingInteractiveAudio = false;
249+
currentRecordedAudioLength = 0;
260250

261251
mlAudioStreamingClip?.ClearBuffer();
262-
252+
263253
mlAudioBufferClip?.Dispose();
264254
mlAudioBufferClip = null;
265255

@@ -295,10 +285,7 @@ private void BeginInteractiveCapture()
295285
{
296286
playbackAudioSource.Stop();
297287
isCapturingInteractiveAudio = true;
298-
if (mlAudioBufferClip == null)
299-
{
300-
CreateInteractiveAudioBuffer();
301-
}
288+
mlAudioBufferClip = new MLAudioInput.BufferClip(micCaptureType, AudioClipLengthSeconds, MLAudioInput.GetSampleRate(micCaptureType));
302289
}
303290

304291
private void StopInteractiveCapture()

Assets/MagicLeap/Examples/Scripts/CVCameraExample.cs

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public class CVCameraExample : MonoBehaviour
5252
private readonly MLPermissions.Callbacks permissionCallbacks = new MLPermissions.Callbacks();
5353

5454
private StringBuilder statusText = new();
55-
55+
private Coroutine enableCameraCoroutine;
56+
5657
/// <summary>
5758
/// Using Awake so that Permissions is set before PermissionRequester Start.
5859
/// </summary>
@@ -75,6 +76,8 @@ void Awake()
7576
mlInputs = new MagicLeapInputs();
7677
mlInputs.Enable();
7778
controllerActions = new MagicLeapInputs.ControllerActions(mlInputs);
79+
80+
controllerActions.Bumper.performed += OnButtonDown;
7881

7982
isCapturing = false;
8083

@@ -93,14 +96,13 @@ void OnDisable()
9396
permissionCallbacks.OnPermissionGranted -= OnPermissionGranted;
9497
permissionCallbacks.OnPermissionDenied -= OnPermissionDenied;
9598
permissionCallbacks.OnPermissionDeniedAndDontAskAgain -= OnPermissionDenied;
96-
97-
controllerActions.Bumper.performed -= OnButtonDown;
98-
mlInputs.Dispose();
99-
10099
if (colorCamera != null && isCameraConnected)
101100
{
102101
DisableMLCamera();
103102
}
103+
controllerActions.Bumper.performed -= OnButtonDown;
104+
mlInputs.Dispose();
105+
104106
}
105107

106108
/// <summary>
@@ -123,6 +125,10 @@ private void UpdateStatusText()
123125
{
124126
statusText.AppendLine($"\nStream width: {selectedCapability.Width} \nStream height{selectedCapability.Height}");
125127
}
128+
else
129+
{
130+
statusText.AppendLine("Camera Disconnected");
131+
}
126132
if (!string.IsNullOrEmpty(poseText))
127133
{
128134
statusText.AppendLine(poseText);
@@ -136,6 +142,25 @@ private void UpdateStatusText()
136142
_statusText.text = statusText.ToString();
137143
}
138144

145+
private void CheckAndStopPreviousCoroutine()
146+
{
147+
if (enableCameraCoroutine == null) return;
148+
StopCoroutine(enableCameraCoroutine);
149+
enableCameraCoroutine = null;
150+
}
151+
152+
private void OnApplicationPause(bool pauseStatus)
153+
{
154+
if (pauseStatus)
155+
{
156+
colorCamera.OnRawVideoFrameAvailable -= OnCaptureRawVideoFrameAvailable;
157+
}
158+
else
159+
{
160+
colorCamera.OnRawVideoFrameAvailable += OnCaptureRawVideoFrameAvailable;
161+
}
162+
}
163+
139164
/// <summary>
140165
/// Captures a still image using the device's camera and returns
141166
/// the data path where it is saved.
@@ -173,7 +198,7 @@ private void StopVideoCapture()
173198
colorCamera.CaptureVideoStop();
174199
cameraCaptureVisualizer.HideRenderer();
175200
}
176-
201+
177202
isCapturing = false;
178203
}
179204

@@ -226,7 +251,6 @@ private IEnumerator EnableMLCamera()
226251

227252
Debug.Log("Camera device received stream caps");
228253
colorCamera.OnRawVideoFrameAvailable += OnCaptureRawVideoFrameAvailable;
229-
controllerActions.Bumper.performed += OnButtonDown;
230254
}
231255
}
232256

@@ -253,7 +277,7 @@ private void DisableMLCamera()
253277
/// <param name="button">The button that is being pressed.</param>
254278
private void OnButtonDown(InputAction.CallbackContext obj)
255279
{
256-
if (colorCamera.IsPaused)
280+
if (colorCamera is { IsPaused: true } || !isCameraConnected)
257281
{
258282
return;
259283
}
@@ -274,6 +298,10 @@ private void OnButtonDown(InputAction.CallbackContext obj)
274298
/// <param name="imageData">The raw data of the image.</param>
275299
private void OnCaptureRawVideoFrameAvailable(MLCamera.CameraOutput capturedFrame, MLCamera.ResultExtras resultExtras, MLCamera.Metadata metadataHandle)
276300
{
301+
if (colorCamera is { IsPaused: true })
302+
{
303+
return;
304+
}
277305
cameraCaptureVisualizer.OnCaptureDataReceived(resultExtras, capturedFrame);
278306

279307
if (MLCVCamera.GetFramePose(resultExtras.VCamTimestamp, out Matrix4x4 cameraTransform).IsOk)
@@ -293,7 +321,7 @@ private void OnPermissionDenied(string permission)
293321

294322
private void OnPermissionGranted(string permission)
295323
{
296-
StartCoroutine(EnableMLCamera());
324+
enableCameraCoroutine = StartCoroutine(EnableMLCamera());
297325
}
298326
}
299327
}

Assets/MagicLeap/Examples/Scripts/CameraCapture/CameraCaptureExample.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
// ---------------------------------------------------------------------
99
// %BANNER_END%
1010

11+
// Disabling MLMedia deprecated warning for the internal project
12+
#pragma warning disable 618
13+
1114
using System;
1215
using System.Collections;
1316
using System.Collections.Generic;

Assets/MagicLeap/Examples/Scripts/Editor/MarkerTrackingExampleEditor.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public class MarkerTrackingExampleEditor : Editor
2525
SerializedProperty QRCodeSize;
2626
SerializedProperty ArucoMarkerSize;
2727
SerializedProperty ArucoDicitonary;
28-
SerializedProperty ArucoTrackingCamera;
2928
SerializedProperty TrackerProfile;
3029
SerializedProperty EnableMarkerScanning;
3130
SerializedProperty FPSHint;
@@ -41,7 +40,6 @@ private void OnEnable()
4140
QRCodeSize = serializedObject.FindProperty("QRCodeSize");
4241
ArucoMarkerSize = serializedObject.FindProperty("ArucoMarkerSize");
4342
ArucoDicitonary = serializedObject.FindProperty("ArucoDicitonary");
44-
ArucoTrackingCamera = serializedObject.FindProperty("ArucoTrackingCamera");
4543
TrackerProfile = serializedObject.FindProperty("TrackerProfile");
4644
EnableMarkerScanning = serializedObject.FindProperty("EnableMarkerScanning");
4745
FPSHint = serializedObject.FindProperty("FPSHint");
@@ -77,7 +75,6 @@ public override void OnInspectorGUI()
7775
{
7876
EditorGUILayout.PropertyField(ArucoMarkerSize);
7977
EditorGUILayout.PropertyField(ArucoDicitonary);
80-
EditorGUILayout.PropertyField(ArucoTrackingCamera);
8178
}
8279

8380
EditorGUILayout.PropertyField(TrackerProfile);

0 commit comments

Comments
 (0)