Skip to content

Commit

Permalink
ARCore Extensions SDK v1.32.0
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyvc committed Jun 24, 2022
1 parent b9496c2 commit abb3767
Show file tree
Hide file tree
Showing 21 changed files with 166 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dependencies>
<iosPods>
<iosPod name="ARCore/CloudAnchors" version="~> 1.31.0" minTargetSdk="11.0">
<iosPod name="ARCore/CloudAnchors" version="~> 1.32.0" minTargetSdk="11.0">
</iosPod>
</iosPods>
</dependencies>
2 changes: 1 addition & 1 deletion Editor/BuildResources/ARCoreiOSDependencies.template
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dependencies>
<iosPods>
<iosPod name="ARCore/GARSession" version="~> 1.31.0" minTargetSdk="11.0">
<iosPod name="ARCore/GARSession" version="~> 1.32.0" minTargetSdk="11.0">
</iosPod>
</iosPods>
</dependencies>
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<dependencies>
<iosPods>
<iosPod name="ARCore/Geospatial" version="~> 1.31.0" minTargetSdk="11.0">
<iosPod name="ARCore/Geospatial" version="~> 1.32.0" minTargetSdk="11.0">
</iosPod>
</iosPods>
</dependencies>
Binary file modified Runtime/Plugins/ARPresto.aar
Binary file not shown.
Binary file modified Runtime/Plugins/arcore_client.aar
Binary file not shown.
37 changes: 36 additions & 1 deletion Runtime/Scripts/ARAnchorManagerExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ public static class ARAnchorManagerExtensions
public static ARCloudAnchor HostCloudAnchor(
this ARAnchorManager anchorManager, ARAnchor anchor)
{
if (ARCoreExtensions._instance.currentARCoreSessionHandle == IntPtr.Zero ||
anchor == null || anchor.nativePtr == IntPtr.Zero ||
anchor.AnchorHandle() == IntPtr.Zero)
{
return null;
}

// Create the underlying ARCore Cloud Anchor.
IntPtr cloudAnchorHandle = SessionApi.HostCloudAnchor(
ARCoreExtensions._instance.currentARCoreSessionHandle,
Expand Down Expand Up @@ -122,6 +129,13 @@ public static ARCloudAnchor HostCloudAnchor(
public static ARCloudAnchor HostCloudAnchor(
this ARAnchorManager anchorManager, ARAnchor anchor, int ttlDays)
{
if (ARCoreExtensions._instance.currentARCoreSessionHandle == IntPtr.Zero ||
anchor == null || anchor.nativePtr == IntPtr.Zero ||
anchor.AnchorHandle() == IntPtr.Zero)
{
return null;
}

if (ttlDays <= 0 || ttlDays > 365)
{
Debug.LogErrorFormat("Failed to host a Cloud Anchor with invalid TTL {0}. " +
Expand Down Expand Up @@ -167,12 +181,17 @@ public static void SetAuthToken(this ARAnchorManager anchorManager, string authT
{
// Only iOS needs AuthToken for Cloud Anchor persistence.
#if UNITY_IOS && ARCORE_EXTENSIONS_IOS_SUPPORT
if (ARCoreExtensions._instance.currentARCoreSessionHandle == IntPtr.Zero)
{
return;
}

if (!string.IsNullOrEmpty(RuntimeConfig.Instance.IOSCloudServicesApiKey))
{
Debug.LogError(
"Cannot set token in applications built using the 'API Key' " +
"authentication strategy. To use it, check Edit > Project Settings " +
"> XR > ARCore Extensions > iOS Support Enabled and " +
"> XR Plug-in Management > ARCore Extensions > iOS Support Enabled and " +
"set iOS Authentication Strategy to Authentication Token.");
return;
}
Expand Down Expand Up @@ -275,6 +294,12 @@ public static ARCloudReferencePoint AddCloudReferencePoint(
public static ARCloudAnchor ResolveCloudAnchorId(
this ARAnchorManager anchorManager, string cloudAnchorId)
{
if (ARCoreExtensions._instance.currentARCoreSessionHandle == IntPtr.Zero ||
string.IsNullOrEmpty(cloudAnchorId))
{
return null;
}

// Create the underlying ARCore Cloud Anchor.
IntPtr cloudAnchorHandle = SessionApi.ResolveCloudAnchor(
ARCoreExtensions._instance.currentARCoreSessionHandle,
Expand Down Expand Up @@ -352,6 +377,11 @@ public static ARCloudReferencePoint ResolveCloudReferenceId(
public static FeatureMapQuality EstimateFeatureMapQualityForHosting(
this ARAnchorManager anchorManager, Pose pose)
{
if (ARCoreExtensions._instance.currentARCoreSessionHandle == IntPtr.Zero)
{
return FeatureMapQuality.Insufficient;
}

return SessionApi.EstimateFeatureMapQualityForHosting(
ARCoreExtensions._instance.currentARCoreSessionHandle, pose);
}
Expand Down Expand Up @@ -403,6 +433,11 @@ public static ARGeospatialAnchor AddAnchor(
this ARAnchorManager anchorManager, double latitude, double longitude,
double altitude, Quaternion eunRotation)
{
if (ARCoreExtensions._instance.currentARCoreSessionHandle == IntPtr.Zero)
{
return null;
}

IntPtr earthHandle = SessionApi.AcquireEarth(
ARCoreExtensions._instance.currentARCoreSessionHandle);
if (earthHandle == IntPtr.Zero)
Expand Down
27 changes: 26 additions & 1 deletion Runtime/Scripts/ARCloudAnchor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ public string cloudAnchorId
{
get
{
if (ARCoreExtensions._instance.currentARCoreSessionHandle == IntPtr.Zero ||
_anchorHandle == IntPtr.Zero)
{
return null;
}

return AnchorApi.GetCloudAnchorId(
ARCoreExtensions._instance.currentARCoreSessionHandle,
_anchorHandle);
Expand All @@ -65,6 +71,12 @@ public CloudAnchorState cloudAnchorState
{
get
{
if (ARCoreExtensions._instance.currentARCoreSessionHandle == IntPtr.Zero ||
_anchorHandle == IntPtr.Zero)
{
return CloudAnchorState.None;
}

return AnchorApi.GetCloudAnchorState(
ARCoreExtensions._instance.currentARCoreSessionHandle,
_anchorHandle).ToCloudAnchorState();
Expand Down Expand Up @@ -100,6 +112,12 @@ public TrackingState trackingState
{
get
{
if (ARCoreExtensions._instance.currentARCoreSessionHandle == IntPtr.Zero ||
_anchorHandle == IntPtr.Zero)
{
return TrackingState.None;
}

return AnchorApi.GetTrackingState(
ARCoreExtensions._instance.currentARCoreSessionHandle,
_anchorHandle).ToTrackingState();
Expand All @@ -122,6 +140,12 @@ public IntPtr nativePtr
/// </summary>
public void Update()
{
if (ARCoreExtensions._instance.currentARCoreSessionHandle == IntPtr.Zero ||
_anchorHandle == IntPtr.Zero)
{
return;
}

// Get the current Pose.
ApiPose apiPose = AnchorApi.GetAnchorPose(
ARCoreExtensions._instance.currentARCoreSessionHandle,
Expand All @@ -140,7 +164,8 @@ public void Update()
/// </summary>
public void OnDestroy()
{
if (_anchorHandle != IntPtr.Zero)
if (ARCoreExtensions._instance.currentARCoreSessionHandle != IntPtr.Zero &&
_anchorHandle != IntPtr.Zero)
{
AnchorApi.Detach(
ARCoreExtensions._instance.currentARCoreSessionHandle,
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Scripts/AREarthManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ namespace Google.XR.ARCoreExtensions
/// <see cref="AREarthManager.IsGeospatialModeSupported"/> to find whether the current device
/// supports enabling this mode.
///
/// <c><see cref="AREarthManager.CameraGeospatialPose/></c> should only be used when
/// <c><see cref="AREarthManager.CameraGeospatialPose"/></c> should only be used when
/// <c><see cref="AREarthManager.EarthTrackingState"/></c> is <c>Tracking</c>, and otherwise
/// should not be used. If the <c>EarthTrackingState</c> does not become <c>Tracking</c>,
/// then <c><see cref="AREarthManager.EarthState"/></c> may contain more information on this
Expand Down
15 changes: 14 additions & 1 deletion Runtime/Scripts/ARGeospatialAnchor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ public TrackingState trackingState
{
get
{
if (ARCoreExtensions._instance.currentARCoreSessionHandle == IntPtr.Zero ||
_anchorHandle == IntPtr.Zero)
{
return TrackingState.None;
}

return AnchorApi.GetTrackingState(
ARCoreExtensions._instance.currentARCoreSessionHandle,
_anchorHandle).ToTrackingState();
Expand All @@ -91,6 +97,12 @@ public IntPtr nativePtr
/// </summary>
public void Update()
{
if (ARCoreExtensions._instance.currentARCoreSessionHandle == IntPtr.Zero ||
_anchorHandle == IntPtr.Zero)
{
return;
}

// Get the current Pose.
ApiPose apiPose = AnchorApi.GetAnchorPose(
ARCoreExtensions._instance.currentARCoreSessionHandle,
Expand All @@ -109,7 +121,8 @@ public void Update()
/// </summary>
public void OnDestroy()
{
if (_anchorHandle != IntPtr.Zero)
if (ARCoreExtensions._instance.currentARCoreSessionHandle != IntPtr.Zero &&
_anchorHandle != IntPtr.Zero)
{
AnchorApi.Detach(
ARCoreExtensions._instance.currentARCoreSessionHandle,
Expand Down
5 changes: 5 additions & 0 deletions Runtime/Scripts/ARPlaybackManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ public PlaybackStatus PlaybackStatus
{
get
{
if (ARCoreExtensions._instance.currentARCoreSessionHandle == IntPtr.Zero)
{
return PlaybackStatus.None;
}

return SessionApi.GetPlaybackStatus(
ARCoreExtensions._instance.currentARCoreSessionHandle);
}
Expand Down
15 changes: 15 additions & 0 deletions Runtime/Scripts/ARRecordingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public RecordingStatus RecordingStatus
{
get
{
if (ARCoreExtensions._instance.currentARCoreSessionHandle == IntPtr.Zero)
{
return RecordingStatus.None;
}

return SessionApi.GetRecordingStatus(
ARCoreExtensions._instance.currentARCoreSessionHandle);
}
Expand All @@ -52,6 +57,11 @@ public RecordingStatus RecordingStatus
/// cref="ARCoreRecordingConfig"/>.<c>AutoStopOnPause</c> is enabled), recording may
/// continue. During this time the camera feed will be recorded as a black screen, but
/// sensor data will continue to be captured.
///
/// Session recordings may contain sensitive information. See <a
/// href="https://developers.google.com/ar/develop/recording-and-playback#what%E2%80%99s_in_a_recording">documentation
/// on Recording and Playback</a> to learn which data is saved in a recording.
///
/// </summary>
/// <param name="config"><see cref="ARCoreRecordingConfig"/> containing the path to save the
/// dataset along with other recording options.</param>
Expand Down Expand Up @@ -81,6 +91,11 @@ public RecordingResult StartRecording(ARCoreRecordingConfig config)
/// an error.</returns>
public RecordingResult StopRecording()
{
if (ARCoreExtensions._instance.currentARCoreSessionHandle == IntPtr.Zero)
{
return RecordingResult.SessionNotReady;
}

return SessionApi.StopRecording(ARCoreExtensions._instance.currentARCoreSessionHandle);
}

Expand Down
3 changes: 2 additions & 1 deletion Runtime/Scripts/CloudAnchorState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public enum CloudAnchorState

/// <summary>
/// The app cannot communicate with the ARCore Cloud because of an invalid authentication.
/// Check Project Settings > XR > ARCore Extensions for a valid authentication strategy.
/// Check Project Settings > XR Plug-in Management > ARCore Extensions for a valid
/// authentication strategy.
/// </summary>
ErrorNotAuthorized,

Expand Down
2 changes: 1 addition & 1 deletion Runtime/Scripts/GeospatialMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public enum GeospatialMode
/// will be <see cref="UnityEngine.XR.ARSubsystems.TrackingState"/>.<c>None</c>.
///
/// For more information, see documentation on <a
/// href="https://developers.google.com/ar/develop/unity-arf/geospatial/developer-guide">the
/// href="https://developers.google.com/ar/develop/unity-arf/geospatial/developer-guide-android">the
/// Geospatial API on Google Developers</a>.
///
/// This mode is not compatible with the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ public override bool IsCompatible(
UnityEditor.BuildTarget buildTarget)
{
string optionFeaturesSettings =
"Edit > Project Settings > XR > ARCore Extensions > Optional Features";
"Edit > Project Settings > XR Plug-in Management > ARCore Extensions > " +
"Optional Features";
if (sessionConfig.CloudAnchorMode != CloudAnchorMode.Disabled &&
!settings.CloudAnchorEnabled)
{
Expand All @@ -96,7 +97,7 @@ public override bool IsCompatible(
{
string requirement = string.Empty;
string iosAuthSettings =
"Edit > Project Settings > XR > ARCore Extensions > " +
"Edit > Project Settings > XR Plug-in Management > ARCore Extensions > " +
"iOS Authentication Strategy";
if (sessionConfig.CloudAnchorMode == CloudAnchorMode.Enabled &&
settings.IOSAuthenticationStrategySetting ==
Expand Down Expand Up @@ -130,7 +131,7 @@ public override bool IsCompatible(
{
string requirement = string.Empty;
string androidAuthSettings =
"Edit > Project Settings > XR > ARCore Extensions > " +
"Edit > Project Settings > XR Plug-in Management > ARCore Extensions > " +
"Android Authentication Strategy";
if (sessionConfig.CloudAnchorMode == CloudAnchorMode.Enabled &&
settings.AndroidAuthenticationStrategySetting ==
Expand Down Expand Up @@ -207,7 +208,8 @@ public override string GetEnabledNotRequiredWarning(
"{0} Authentication is enabled in ARCore Extensions Project Settings " +
"but the feature is not used by any Scenes in Build.\n" +
"To turn off authentication, select Do Not Use in Edit > " +
"Project Settings > XR > ARCore Extensions > {0} Authentication Strategy.",
"Project Settings > XR Plug-in Management > ARCore Extensions > {0} " +
"Authentication Strategy.",
platformName);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ public override bool IsCompatible(
UnityEditor.BuildTarget buildTarget)
{
string optionFeaturesSettings =
"Edit > Project Settings > XR > ARCore Extensions > Optional Features";
"Edit > Project Settings > XR Plug-in Management > ARCore Extensions > " +
"Optional Features";
if (sessionConfig.GeospatialMode != GeospatialMode.Disabled &&
!settings.GeospatialEnabled)
{
Expand Down Expand Up @@ -150,7 +151,8 @@ public override string GetEnabledNotRequiredWarning(
return string.Format(
"{0} feature is checked in ARCore Extensions Project Settings, but " +
"it is not used by any Scenes in Build.\nTo turn off {0}, uncheck it in " +
"Edit > Project Settings > XR > ARCore Extensions > Optional Features > {0}.",
"Edit > Project Settings > XR Plug-in Management > ARCore Extensions > " +
"Optional Features > {0}.",
featureName);
}

Expand Down
5 changes: 4 additions & 1 deletion Runtime/Scripts/Internal/IOSSupportManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ public void UpdateCameraManager(ARCameraManager cameraManager)
}

_cameraManager = cameraManager;
_cameraManager.frameReceived += OnFrameUpdate;
if (_cameraManager != null)
{
_cameraManager.frameReceived += OnFrameUpdate;
}
}

public void ResetARCoreSession()
Expand Down
2 changes: 1 addition & 1 deletion Runtime/Scripts/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ public class VersionInfo
/// <summary>
/// The current ARCore Extensions package version.
/// </summary>
public static readonly string Version = "1.31.0";
public static readonly string Version = "1.32.0";
}
}
Loading

0 comments on commit abb3767

Please sign in to comment.