diff --git a/Assets/Extra/AttachSpecklePropertiesExample.cs b/Assets/Extra/AttachSpecklePropertiesExample.cs index 9c4af9c..146cb78 100644 --- a/Assets/Extra/AttachSpecklePropertiesExample.cs +++ b/Assets/Extra/AttachSpecklePropertiesExample.cs @@ -23,7 +23,7 @@ public class AttachSpecklePropertiesExample : MonoBehaviour public virtual void Start() { - Client speckleClient = new(AccountManager.GetDefaultAccount()); + Client speckleClient = new(AccountManager.GetDefaultAccount()!); StartCoroutine(AttachSpeckleProperties(speckleClient, streamId, objectId)); } diff --git a/Assets/Extra/ManualReceive.cs b/Assets/Extra/ManualReceive.cs index 7536110..8293c49 100644 --- a/Assets/Extra/ManualReceive.cs +++ b/Assets/Extra/ManualReceive.cs @@ -1,10 +1,10 @@ -using System; using System.Collections; using System.Threading.Tasks; using Speckle.ConnectorUnity; using Speckle.ConnectorUnity.Components; using Speckle.Core.Api; using Speckle.Core.Credentials; +using Speckle.Core.Models; using Speckle.Core.Transports; using UnityEngine; @@ -12,60 +12,56 @@ using UnityEngine; [RequireComponent(typeof(RecursiveConverter))] public class ManualReceive : MonoBehaviour { - public string authToken; public string serverUrl; - public string streamId, objectId; - - private RecursiveConverter receiver; + public string streamId, + objectId; + private RecursiveConverter receiver; void Awake() { receiver = GetComponent(); } - IEnumerator Start() { Debug.developerConsoleVisible = true; - if(Time.timeSinceLevelLoad > 20) yield return null; + if (Time.timeSinceLevelLoad > 20) + yield return null; Receive(); } - + [ContextMenu(nameof(Receive))] public void Receive() { var account = new Account() { token = authToken, - serverInfo = new ServerInfo() {url = serverUrl}, + serverInfo = new ServerInfo() { url = serverUrl }, }; Task.Run(async () => { - var transport = new ServerTransport(account, streamId); - var localTransport = new MemoryTransport(); - - var @base = await Operations.Receive( + using ServerTransport transport = new(account, streamId); + MemoryTransport localTransport = new(); + + Base speckleObject = await Operations.Receive( objectId, remoteTransport: transport, - localTransport: localTransport, - onErrorAction: (m, e) => Debug.LogError(m + e), - disposeTransports: true + localTransport: localTransport ); - - if (@base == null) throw new Exception("received data was null!"); - - Dispatcher.Instance().Enqueue(() => - { - var parentObject = new GameObject(name); - - receiver.RecursivelyConvertToNative_Sync(@base, parentObject.transform); - Debug.Log($"Receive {objectId} completed"); - }); + Dispatcher + .Instance() + .Enqueue(() => + { + var parentObject = new GameObject(name); + + receiver.RecursivelyConvertToNative_Sync(speckleObject, parentObject.transform); + + Debug.Log($"Receive {objectId} completed"); + }); }); } } - diff --git a/Assets/Extra/PerformanceTestSender.cs b/Assets/Extra/PerformanceTestSender.cs index 5b0cd99..5713fd7 100644 --- a/Assets/Extra/PerformanceTestSender.cs +++ b/Assets/Extra/PerformanceTestSender.cs @@ -2,6 +2,7 @@ using System.Threading; using System.Threading.Tasks; using Speckle.ConnectorUnity.Components; using Speckle.Core.Api; +using Speckle.Core.Credentials; using Speckle.Core.Models; using Speckle.Core.Transports; using UnityEngine; @@ -18,24 +19,25 @@ namespace Extra { [Range(0, 100)] public int numberOfIterations = 10; - + public Vector3 translation = Vector3.forward * 100; public GameObject objectToSend; private SpeckleSender sender; + private void Awake() { sender = GetComponent(); } - + public async Task SendIterations() { GameObject go = new GameObject(); for (int i = 0; i < numberOfIterations; i++) { Instantiate(objectToSend, translation * i, Quaternion.identity, go.transform); - + Base b = sender.Converter.RecursivelyConvertToSpeckle(go, _ => true); await Send(b, $"{i}"); } @@ -44,20 +46,23 @@ namespace Extra private async Task Send(Base data, string branchName) { - var client = sender.Account.Client; - var stream = sender.Stream.Selected; - ServerTransport transport = new ServerTransport(sender.Account.Selected, stream!.id); - - await client.BranchCreate(new BranchCreateInput(){streamId = stream.id, name = branchName}); - - return await SpeckleSender.SendDataAsync(CancellationToken.None, + Client client = sender.Account.Client!; + Stream stream = sender.Stream.Selected; + Account selectedAccount = sender.Account.Selected!; + + using ServerTransport transport = new(selectedAccount, stream!.id); + + string branchId = await client.BranchCreate( + new BranchCreateInput() { streamId = stream.id, name = branchName } + ); + + return await SpeckleSender.SendDataAsync( remoteTransport: transport, - data: data, - client: client!, - branchName: branchName, - createCommit: true, - onProgressAction: null, - onErrorAction: (m, e) => throw e); + data, + client, + branchId, + true + ); } } @@ -68,7 +73,7 @@ namespace Extra public override async void OnInspectorGUI() { DrawDefaultInspector(); - + if (GUILayout.Button("Create and send")) { await ((PerformanceTestSender)target).SendIterations(); diff --git a/Assets/SpeckleExamples.cs b/Assets/SpeckleExamples.cs index 9e81af3..1512c8b 100644 --- a/Assets/SpeckleExamples.cs +++ b/Assets/SpeckleExamples.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using UnityEngine; using Speckle.Core.Credentials; using System.Linq; -using UnityEngine.Events; using UnityEngine.UI; using Stream = Speckle.Core.Api.Stream; diff --git a/Packages/manifest.json b/Packages/manifest.json index 12e4bad..f3eabad 100644 --- a/Packages/manifest.json +++ b/Packages/manifest.json @@ -1,14 +1,14 @@ { "dependencies": { "com.unity.2d.sprite": "1.0.0", - "com.unity.collab-proxy": "2.0.5", + "com.unity.collab-proxy": "2.0.7", "com.unity.ide.rider": "3.0.24", "com.unity.ide.visualstudio": "2.0.18", "com.unity.ide.vscode": "1.2.5", "com.unity.test-framework": "1.1.33", "com.unity.textmeshpro": "3.0.6", "com.unity.timeline": "1.6.5", - "com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.2", + "com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.4", "com.unity.ugui": "1.0.0", "com.unity.modules.ai": "1.0.0", "com.unity.modules.androidjni": "1.0.0", diff --git a/Packages/packages-lock.json b/Packages/packages-lock.json index 05ee984..41145c2 100644 --- a/Packages/packages-lock.json +++ b/Packages/packages-lock.json @@ -7,7 +7,7 @@ "dependencies": {} }, "com.unity.collab-proxy": { - "version": "2.0.5", + "version": "2.0.7", "depth": 0, "source": "registry", "dependencies": {}, @@ -94,12 +94,12 @@ "url": "https://packages.unity.com" }, "com.unity.toolchain.win-x86_64-linux-x86_64": { - "version": "2.0.2", + "version": "2.0.4", "depth": 0, "source": "registry", "dependencies": { - "com.unity.sysroot": "2.0.3", - "com.unity.sysroot.linux-x86_64": "2.0.2" + "com.unity.sysroot": "2.0.5", + "com.unity.sysroot.linux-x86_64": "2.0.4" }, "url": "https://packages.unity.com" }, diff --git a/Packages/systems.speckle.speckle-unity/Editor/Components/SpeckleReceiverEditor.cs b/Packages/systems.speckle.speckle-unity/Editor/Components/SpeckleReceiverEditor.cs index be631c8..5b77fa0 100644 --- a/Packages/systems.speckle.speckle-unity/Editor/Components/SpeckleReceiverEditor.cs +++ b/Packages/systems.speckle.speckle-unity/Editor/Components/SpeckleReceiverEditor.cs @@ -163,7 +163,7 @@ namespace Speckle.ConnectorUnity.Components.Editor bool BeforeConvert(TraversalContext context) { - Base b = context.current; + Base b = context.Current; //NOTE: progress wont reach 100% because not all objects are convertable float progress = (childrenConverted + childrenFailed) / totalChildrenFloat; diff --git a/Packages/systems.speckle.speckle-unity/Editor/Components/SpeckleSendEditor.cs b/Packages/systems.speckle.speckle-unity/Editor/Components/SpeckleSendEditor.cs index 38bdfa6..0b6c862 100644 --- a/Packages/systems.speckle.speckle-unity/Editor/Components/SpeckleSendEditor.cs +++ b/Packages/systems.speckle.speckle-unity/Editor/Components/SpeckleSendEditor.cs @@ -77,7 +77,6 @@ namespace Speckle.ConnectorUnity.Components.Editor ), }; - //TODO onError action? if (data["@objects"] is IList l && l.Count == 0) { Debug.LogWarning($"Nothing to send", speckleSender); diff --git a/Packages/systems.speckle.speckle-unity/Runtime/Components/Deprecated/Sender.cs b/Packages/systems.speckle.speckle-unity/Runtime/Components/Deprecated/Sender.cs index 25a6bb9..9b156d3 100644 --- a/Packages/systems.speckle.speckle-unity/Runtime/Components/Deprecated/Sender.cs +++ b/Packages/systems.speckle.speckle-unity/Runtime/Components/Deprecated/Sender.cs @@ -64,7 +64,7 @@ namespace Speckle.ConnectorUnity cancellationTokenSource = new CancellationTokenSource(); - var client = new Client(account ?? AccountManager.GetDefaultAccount()); + var client = new Client(account ?? AccountManager.GetDefaultAccount()!); transport = new ServerTransport(client.Account, streamId); transport.CancellationToken = cancellationTokenSource.Token; diff --git a/Packages/systems.speckle.speckle-unity/Runtime/Components/ReceiveFromURL.cs b/Packages/systems.speckle.speckle-unity/Runtime/Components/ReceiveFromURL.cs index 690d44b..07d2a01 100644 --- a/Packages/systems.speckle.speckle-unity/Runtime/Components/ReceiveFromURL.cs +++ b/Packages/systems.speckle.speckle-unity/Runtime/Components/ReceiveFromURL.cs @@ -49,7 +49,8 @@ namespace Speckle.ConnectorUnity.Components ); var accountTask = new Utils.Utils.WaitForTask( - async () => await GetAccount(sw) + async () => await GetAccount(sw), + _tokenSource.Token ); yield return accountTask; @@ -57,8 +58,10 @@ namespace Speckle.ConnectorUnity.Components using Client c = new(accountTask.Result); var objectIdTask = new Utils.Utils.WaitForTask<(string, Commit?)>( - async () => await GetObjectID(sw, c) + async () => await GetObjectID(sw, c), + _tokenSource.Token ); + yield return objectIdTask; (string objectId, Commit? commit) = objectIdTask.Result; @@ -72,7 +75,8 @@ namespace Speckle.ConnectorUnity.Components objectId, commit, cancellationToken: _tokenSource.Token - ) + ), + _tokenSource.Token ); yield return receiveTask; diff --git a/Packages/systems.speckle.speckle-unity/Runtime/Components/RecursiveConverter.ToNative.cs b/Packages/systems.speckle.speckle-unity/Runtime/Components/RecursiveConverter.ToNative.cs index d750b3a..1441b73 100644 --- a/Packages/systems.speckle.speckle-unity/Runtime/Components/RecursiveConverter.ToNative.cs +++ b/Packages/systems.speckle.speckle-unity/Runtime/Components/RecursiveConverter.ToNative.cs @@ -92,7 +92,7 @@ namespace Speckle.ConnectorUnity.Components public bool WasSuccessful() => this.exception == null; - public Base SpeckleObject => traversalContext.current; + public Base SpeckleObject => traversalContext.Current; } public partial class RecursiveConverter @@ -143,7 +143,7 @@ namespace Speckle.ConnectorUnity.Components var objectsToConvert = traversalFunc .Traverse(rootObject) - .Where(x => ConverterInstance.CanConvertToNative(x.current)) + .Where(x => ConverterInstance.CanConvertToNative(x.Current)) .Where(x => userPredicate(x)); Dictionary created = new(); @@ -186,9 +186,9 @@ namespace Speckle.ConnectorUnity.Components { Transform? currentParent = GetParent(tc, outCreatedObjects) ?? parent; - var converted = ConvertToNative(tc.current, currentParent); + var converted = ConvertToNative(tc.Current, currentParent); result = new ConversionResult(tc, converted); - outCreatedObjects.TryAdd(tc.current, result.converted); + outCreatedObjects.TryAdd(tc.Current, result.converted); } catch (Exception ex) { @@ -209,11 +209,11 @@ namespace Speckle.ConnectorUnity.Components if (tc == null) return null; //We've reached the root object, and still not found a converted parent - if (createdObjects.TryGetValue(tc.current, out GameObject? p) && p != null) + if (createdObjects.TryGetValue(tc.Current, out GameObject? p) && p != null) return p.transform; //Go one level up, and repeat! - return GetParent(tc.parent, createdObjects); + return GetParent(tc.Parent, createdObjects); } protected GameObject ConvertToNative(Base speckleObject, Transform? parentTransform) @@ -327,7 +327,18 @@ namespace Speckle.ConnectorUnity.Components { object? converted = null; if (predicate(baseObject)) - converted = ConverterInstance.ConvertToNative(baseObject); + { + try + { + converted = ConverterInstance.ConvertToNative(baseObject); + } + catch (Exception ex) when (!ex.IsFatal()) + { + Debug.LogWarning( + $"Failed to convert {baseObject.speckle_type} - {baseObject.id}\n{ex}" + ); + } + } // Handle new GameObjects Transform? nextParent = parent; diff --git a/Packages/systems.speckle.speckle-unity/Runtime/Components/SpeckleReceiver.cs b/Packages/systems.speckle.speckle-unity/Runtime/Components/SpeckleReceiver.cs index fef544f..b9a32b8 100644 --- a/Packages/systems.speckle.speckle-unity/Runtime/Components/SpeckleReceiver.cs +++ b/Packages/systems.speckle.speckle-unity/Runtime/Components/SpeckleReceiver.cs @@ -259,42 +259,20 @@ namespace Speckle.ConnectorUnity.Components CancellationToken cancellationToken = default ) { - using var transport = new ServerTransportV2(client.Account, streamId); + using var transport = new ServerTransport(client.Account, streamId); transport.CancellationToken = cancellationToken; cancellationToken.ThrowIfCancellationRequested(); - Base? requestedObject = await Operations + Base requestedObject = await Operations .Receive( - objectId: objectId, - cancellationToken: cancellationToken, - remoteTransport: transport, - onProgressAction: onProgressAction, - onErrorAction: (s, ex) => - { - //Don't wrap cancellation exceptions! - if (ex is OperationCanceledException) - throw ex; - - //HACK: Sometimes, the task was cancelled, and Operations.Receive doesn't fail in a reliable way. In this case, the exception is often simply a symptom of a cancel. - if (cancellationToken.IsCancellationRequested) - { - SpeckleLog.Logger.Warning( - ex, - "A task was cancelled, ignoring potentially symptomatic exception" - ); - cancellationToken.ThrowIfCancellationRequested(); - } - - //Treat all operation errors as fatal - throw new SpeckleException( - $"Failed to receive requested object {objectId} from server: {s}", - ex - ); - }, - onTotalChildrenCountKnown: onTotalChildrenCountKnown, - disposeTransports: false + objectId, + transport, + null, + onProgressAction, + onTotalChildrenCountKnown, + cancellationToken ) .ConfigureAwait(false); @@ -317,9 +295,6 @@ namespace Speckle.ConnectorUnity.Components } ); - if (requestedObject == null) - throw new SpeckleException($"Operation {nameof(Operations.Receive)} returned null"); - cancellationToken.ThrowIfCancellationRequested(); //Read receipt @@ -340,10 +315,10 @@ namespace Speckle.ConnectorUnity.Components ) .ConfigureAwait(false); } - catch (Exception e) + catch (Exception ex) { // Do nothing! - Debug.LogWarning($"Failed to send read receipt\n{e}"); + Debug.LogWarning($"Failed to send read receipt\n{ex}"); } return requestedObject; @@ -447,12 +422,9 @@ namespace Speckle.ConnectorUnity.Components /// /// Fetches the commit preview for the currently selected commit /// - /// when , will fetch 360 degree preview image /// Callback function to be called when the web request completes /// The executing or if , , or was - public Coroutine? GetPreviewImage( /*bool allAngles,*/ - Action callback - ) + public Coroutine? GetPreviewImage(Action callback) { Account? account = Account.Selected; if (account == null) @@ -476,25 +448,25 @@ namespace Speckle.ConnectorUnity.Components [ContextMenu("Open Speckle Stream in Browser")] protected void OpenUrlInBrowser() { - string url = GetSelectedUrl(); - Application.OpenURL(url); + Uri url = GetSelectedUrl(); + Application.OpenURL(url.ToString()); } #endif - public string GetSelectedUrl() + public Uri GetSelectedUrl() { - string serverUrl = Account.Selected!.serverInfo.url; - string? streamId = Stream.Selected?.id; - string? branchName = Branch.Selected?.name; - string? commitId = Commit.Selected?.id; + Account selectedAccount = Account.Selected!; + StreamWrapper sw = + new() + { + ServerUrl = selectedAccount.serverInfo.url, + StreamId = Stream.Selected!.id, + BranchName = Branch.Selected?.id, + CommitId = Commit.Selected?.id + }; + sw.SetAccount(selectedAccount); - if (string.IsNullOrEmpty(streamId)) - return serverUrl; - if (!string.IsNullOrEmpty(commitId)) - return $"{serverUrl}/streams/{streamId}/commits/{commitId}"; - if (!string.IsNullOrEmpty(branchName)) - return $"{serverUrl}/streams/{streamId}/branches/{branchName}"; - return $"{serverUrl}/streams/{streamId}"; + return sw.ToServerUri(); } public void Awake() diff --git a/Packages/systems.speckle.speckle-unity/Runtime/Components/SpeckleSender.cs b/Packages/systems.speckle.speckle-unity/Runtime/Components/SpeckleSender.cs index cb74d88..c723b32 100644 --- a/Packages/systems.speckle.speckle-unity/Runtime/Components/SpeckleSender.cs +++ b/Packages/systems.speckle.speckle-unity/Runtime/Components/SpeckleSender.cs @@ -36,6 +36,7 @@ namespace Speckle.ConnectorUnity.Components [HideInInspector] public BranchSelectionEvent OnBranchSelectionChange; + [Obsolete("No longer used")] [HideInInspector] public ErrorActionEvent OnErrorAction; @@ -61,40 +62,44 @@ namespace Speckle.ConnectorUnity.Components ) throw new SpeckleException(error); - ServerTransport transport = new ServerTransport(client.Account, stream.id); + using ServerTransport transport = new(client.Account, stream.id); transport.CancellationToken = CancellationTokenSource.Token; return await SendDataAsync( - CancellationTokenSource.Token, remoteTransport: transport, - data: data, - client: client, - branchName: branch.name, - createCommit: createCommit, - onProgressAction: dict => OnSendProgressAction.Invoke(dict), - onErrorAction: (m, e) => OnErrorAction.Invoke(m, e) + data, + client, + branch.id, + createCommit, + dict => OnSendProgressAction.Invoke(dict), + CancellationTokenSource.Token ); } + /// The transport to send to + /// The data to send + /// An authenticated Speckle Client + /// The branch name or id + /// when will call , otherwise only the object data is sent + /// Called every progress tick of the + /// Optional cancellation token + /// The id (hash) of the object sent public static async Task SendDataAsync( - CancellationToken cancellationToken, ServerTransport remoteTransport, Base data, Client client, - string branchName, + string branchId, bool createCommit, Action>? onProgressAction = null, - Action? onErrorAction = null + CancellationToken cancellationToken = default ) { string res = await Operations.Send( data, - cancellationToken: cancellationToken, - new List { remoteTransport }, - useDefaultCache: true, - disposeTransports: true, - onProgressAction: onProgressAction, - onErrorAction: onErrorAction + remoteTransport, + true, + onProgressAction, + cancellationToken ); Analytics.TrackEvent( @@ -115,15 +120,26 @@ namespace Speckle.ConnectorUnity.Components string commitMessage = $"Sent {data.totalChildrenCount} objects from {unityVer}"; string commitId = await CreateCommit( - cancellationToken, data, client, streamId, - branchName, + branchId, res, - commitMessage + commitMessage, + cancellationToken ); - string url = $"{client.ServerUrl}/streams/{streamId}/commits/{commitId}"; + + StreamWrapper sw = + new() + { + ServerUrl = client.ServerUrl, + StreamId = streamId, + BranchName = branchId, + CommitId = commitId, + }; + sw.SetAccount(client.Account); + + string url = sw.ToServerUri().GetLeftPart(UriPartial.Path); Debug.Log($"Data successfully sent to {url}"); } @@ -131,13 +147,13 @@ namespace Speckle.ConnectorUnity.Components } public static async Task CreateCommit( - CancellationToken cancellationToken, Base data, Client client, string streamId, string branchName, string objectId, - string message + string message, + CancellationToken cancellationToken ) { string commitId = await client.CommitCreate( @@ -249,5 +265,28 @@ namespace Speckle.ConnectorUnity.Components { Initialise(); } + + [Obsolete("use other overload")] + public static async Task SendDataAsync( + CancellationToken cancellationToken, + ServerTransport remoteTransport, + Base data, + Client client, + string branchName, + bool createCommit, + Action>? onProgressAction = null, + Action? onErrorAction = null + ) + { + return await SendDataAsync( + remoteTransport, + data, + client, + branchName, + createCommit, + onProgressAction, + cancellationToken + ); + } } } diff --git a/Packages/systems.speckle.speckle-unity/Runtime/Converter/Unity/ConverterUnity.Mesh.cs b/Packages/systems.speckle.speckle-unity/Runtime/Converter/Unity/ConverterUnity.Mesh.cs index 9553607..c19ef4c 100644 --- a/Packages/systems.speckle.speckle-unity/Runtime/Converter/Unity/ConverterUnity.Mesh.cs +++ b/Packages/systems.speckle.speckle-unity/Runtime/Converter/Unity/ConverterUnity.Mesh.cs @@ -10,9 +10,7 @@ using UnityEngine.Rendering; using Material = UnityEngine.Material; using Mesh = UnityEngine.Mesh; using SMesh = Objects.Geometry.Mesh; -using SColor = System.Drawing.Color; using Transform = UnityEngine.Transform; -using STransform = Objects.Other.Transform; #nullable enable namespace Objects.Converter.Unity diff --git a/Packages/systems.speckle.speckle-unity/Runtime/Converter/Unity/ConverterUnity.RenderMaterial.cs b/Packages/systems.speckle.speckle-unity/Runtime/Converter/Unity/ConverterUnity.RenderMaterial.cs index 0becaea..088dd9d 100644 --- a/Packages/systems.speckle.speckle-unity/Runtime/Converter/Unity/ConverterUnity.RenderMaterial.cs +++ b/Packages/systems.speckle.speckle-unity/Runtime/Converter/Unity/ConverterUnity.RenderMaterial.cs @@ -8,7 +8,6 @@ using UnityEngine; using Material = UnityEngine.Material; using SMesh = Objects.Geometry.Mesh; using SColor = System.Drawing.Color; -using STransform = Objects.Other.Transform; namespace Objects.Converter.Unity { @@ -76,7 +75,7 @@ namespace Objects.Converter.Unity // 3. Otherwise, convert fresh! string name = CoreUtils.GenerateObjectName(renderMaterial); Color diffuse = renderMaterial.diffuse.ToUnityColor(); - bool isOpaque = Math.Abs(renderMaterial.opacity - 1d) < Constants.Eps; + bool isOpaque = Math.Abs(renderMaterial.opacity - 1d) < Constants.EPS; Color color = new(diffuse.r, diffuse.g, diffuse.b, (float)renderMaterial.opacity); float metalic = (float)renderMaterial.metalness; float gloss = 1f - (float)renderMaterial.roughness; diff --git a/Packages/systems.speckle.speckle-unity/Runtime/Core/SpeckleCore2.dll b/Packages/systems.speckle.speckle-unity/Runtime/Core/SpeckleCore2.dll index 9fb890e..7acc999 100644 Binary files a/Packages/systems.speckle.speckle-unity/Runtime/Core/SpeckleCore2.dll and b/Packages/systems.speckle.speckle-unity/Runtime/Core/SpeckleCore2.dll differ diff --git a/Packages/systems.speckle.speckle-unity/Runtime/Core/SpeckleCore2.pdb b/Packages/systems.speckle.speckle-unity/Runtime/Core/SpeckleCore2.pdb index e524281..e853b63 100644 Binary files a/Packages/systems.speckle.speckle-unity/Runtime/Core/SpeckleCore2.pdb and b/Packages/systems.speckle.speckle-unity/Runtime/Core/SpeckleCore2.pdb differ diff --git a/Packages/systems.speckle.speckle-unity/Runtime/Core/SpeckleCore2.xml b/Packages/systems.speckle.speckle-unity/Runtime/Core/SpeckleCore2.xml index 0886003..115876d 100644 --- a/Packages/systems.speckle.speckle-unity/Runtime/Core/SpeckleCore2.xml +++ b/Packages/systems.speckle.speckle-unity/Runtime/Core/SpeckleCore2.xml @@ -16,6 +16,11 @@ https://www.apollographql.com/docs/apollo-server/v2/data/errors/#forbidden + + "FORBIDDEN" on "UNAUTHORIZED" response from server + All other request errors + The requested a cancel + Gets the activity of a stream @@ -403,7 +408,6 @@ Subscribe to events of streams removed for the current user - @@ -446,6 +450,20 @@ The limited user profile of another (non active user) + + + This field is not returned from the GQL API, + it should populated on construction from the response headers. + see + + + + + This field is not returned from the GQL API, + it should populated on construction. + see + + OS @@ -458,48 +476,17 @@ NOTE: do not edit order and only append new items as they are serialized to ints - - - Envirenment Variable that allows to overwrite the - /// - - - - Returns the correct location of the Speckle installation folder. Usually this would be the user's %appdata%/Speckle folder, unless the install was made for all users. - - The location of the Speckle installation folder - - - - Returns the correct location of the Speckle folder for the current user. Usually this would be the user's %appdata%/Speckle folder. - - The location of the Speckle installation folder - - - - Returns the correct location of the AppData folder where Speckle is installed. Usually this would be the user's %appdata% folder, unless the install was made for all users. - This folder contains Kits and othe data that can be shared among users of the same machine. - - The location of the AppData folder where Speckle is installed - - - - Returns the location of the User Application Data folder for the current roaming user, which contains user specific data such as accounts and cache. - - The location of the user's `%appdata%` folder. - - + Helper method to Receive from a Speckle Server. Stream URL or Id to receive from. If the URL contains branchName, commitId or objectId those will be used, otherwise the latest commit from main will be received. Account to use. If not provided the default account will be used. Action invoked on progress iterations. - Action invoked on internal errors. Action invoked once the total count of objects is known. - + Helper method to Send to a Speckle Server. @@ -508,7 +495,6 @@ Account to use. If not provided the default account will be used. Toggle for the default cache. If set to false, it will only send to the provided transports. Action invoked on progress iterations. - Action invoked on internal errors. @@ -529,31 +515,136 @@ A Human readable string - + + + Exposes several key methods for interacting with Speckle.Core. + Serialize/Deserialize + Push/Pull (methods to serialize and send data to one or more servers) + + Convenience method to instantiate an instance of the default object serializer and settings pre-populated with it. - - + - Receives an object from a transport. + Factory for progress actions used internally inside send and receive methods. + + + + + + + Receives an object (and all its sub-children) from the two provided s. +
+ Will first try and find objects using the (the faster transport) + If not found, will attempt to copy the objects from the into the before deserialization +
+ + If Transports are properly implemented, there is no hard distinction between what is a local or remote transport; it's still just an . +
So, for example, if you want to receive an object without actually writing it first to a local transport, you can just pass a as a local transport. +
This is not recommended, but shows what you can do. Another tidbit: the local transport does not need to be disk-bound; it can easily be an in . In memory transports are the fastest ones, but they're of limited use for larger datasets +
+ The id of the object to receive + The remote transport (slower). If , will assume all objects are present in + The local transport (faster). If , will use a default cache + Action invoked on progress iterations + Action invoked once the total count of objects is known + + Failed to retrieve objects from the provided transport(s) + Deserialization of the requested object(s) failed + requested cancel + The requested Speckle Object +
+ + + Try and get the object from the local transport. If it's there, we assume all its children are there + This assumption is hard-wired into the - The transport to receive from. - Leave null to use the default cache. - Action invoked on progress iterations. - Action invoked on internal errors. - Action invoked once the total count of objects is known. + + + + + + + + Copies the requested object and all its children from to + + + + + + + + Remote transport was not specified + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Receives an object from a transport. + + This overload is deprecated. You should consider using + +
+ The new overload no longer support switching as v1 is now deprecated. +
+ We also no longer offer the option to . + You should instead handle disposal yourself + using conventional mechanisms like the using keyword or try finally block
+
+ This function overload will be kept around for several releases, but will eventually be removed. +
- A cancellation token that can be used by other objects or threads to send notice of cancellation. The transport to receive from. Leave null to use the default cache. Action invoked on progress iterations. @@ -561,54 +652,105 @@ Action invoked once the total count of objects is known.
- + - Sends an object via the provided transports. Defaults to the local cache. + Sends a Speckle Object to the provided and (optionally) the default local cache - The object you want to send. - Where you want to send them. - Toggle for the default cache. If set to false, it will only send to the provided transports. - Action that gets triggered on every progress tick (keeps track of all transports). - Use this to capture and handle any errors from within the transports. - The id (hash) of the object. + + + When , an additional will be included + The or was + + using ServerTransport destination = new(account, streamId); + string objectId = await Send(mySpeckleObject, destination, true); + + + + + Sends a Speckle Object to the provided + + Only sends to the specified transports, the default local cache won't be used unless you also pass it in + The id (hash) of the object sent + The object you want to send + Where you want to send them + Action that gets triggered on every progress tick (keeps track of all transports) + + No transports were specified + The was + Serialization or Send operation was unsuccessful + One or more failed to send + The requested cancellation + + + + + + + + + + + + + + + Sends an object via the provided transports. Defaults to the local cache. + + This overload is deprecated. You should consider using +
+
or +
+
+ These new overloads no longer support switching as v1 is now deprecated. +
+ We also no longer offer the option to . + You should instead handle disposal yourself + using conventional mechanisms like the using keyword.
+
+ This function overload will be kept around for several releases, but will eventually be removed. +
The object you want to send. A cancellation token that can be used by other objects or threads to send notice of cancellation. Where you want to send them. Toggle for the default cache. If set to false, it will only send to the provided transports. Action that gets triggered on every progress tick (keeps track of all transports). Use this to capture and handle any errors from within the transports. + + The id (hash) of the object.
- - - Serializes a given object. - - if you want to save and persist an object to a Speckle Transport or Server, - please use any of the "Send" methods. - See - - - - A json string representation of the object. - - + Serializes a given object. If you want to save and persist an object to Speckle Transport or Server, please use any of the "Send" methods. - + - - Propagates notification that operations should be canceled. + The object to serialise + A json string representation of the object. + + + Note: if you want to pull an object from a Speckle Transport or Server, + please use + + + The json string representation of a speckle object that you want to deserialize + + + was null + was not valid JSON + cannot be deserialised to type + contains closure references (see Remarks) + Serializes a list of objects. Note: if you want to save and persist objects to speckle, please use any of the "Send" methods. @@ -623,44 +765,6 @@ - - - Deserializes a given object. - - - Note: if you want to pull an object from a Speckle Transport or Server, - please use any of the - - The json string representation of a speckle object that you want to deserialise. - - - - - Deserializes a given object. - - - Note: if you want to pull an object from a Speckle Transport or Server, - please use any of the - . - - The json string representation of a speckle object that you want to deserialise. - Propagates notification that operations should be canceled. - - - - - Deserializes a list of objects into an array. Note: if you want to pull an object from speckle (either local or remote), please use any of the "Receive" methods. - - - - - - - Deserializes a dictionary object. Note: if you want to pull an object from speckle (either local or remote), please use any of the "Receive" methods. - - - - Defines the limits for specific API calls on the Speckle Server. @@ -670,19 +774,45 @@ ⚠️ Not all limits are reflected here! + + + Retrieves the local identifier for the current user. + + + Returns a object representing the local identifier for the current user. + The local identifier is created by appending the user ID as a query parameter to the server URL. + + + Notice that the generated Uri is not intended to be used as a functioning Uri, but rather as a + unique identifier for a specific account in a local environment. The format of the Uri, containing a query parameter with the user ID, + serves this specific purpose. Therefore, it should not be used for forming network requests or + expecting it to lead to an actual webpage. The primary intent of this Uri is for unique identification in a Uri format. + + + This sample shows how to call the GetLocalIdentifier method. + + Uri localIdentifier = GetLocalIdentifier(); + Console.WriteLine(localIdentifier); + + For a fictional `User ID: 123` and `Server: https://speckle.xyz`, the output might look like this: + + https://speckle.xyz?id=123 + + + Manage accounts locally for desktop applications. - + Gets the basic information about a server. Server URL - + Gets basic user information given a token and a server. @@ -690,7 +820,7 @@ Server URL - + Gets basic user and server information given a token and a server. @@ -748,6 +878,23 @@ + + + Retrieves the local identifier for the specified account. + + The account for which to retrieve the local identifier. + The local identifier for the specified account in the form of "SERVER_URL?u=USER_ID". + + + + + + + Gets the account that corresponds to the given local identifier. + + The local identifier of the account. + The account that matches the local identifier, or null if no match is found. + Adds an account by propting the user to log in via a web flow @@ -755,6 +902,21 @@ Server to use to add the account, if not provied the default Server will be used + + + Sends a simple get request to the , and checks the response headers for a "x-speckle-frontend-2" value + + Server endpoint to get header + if response contains FE2 header and the value was + response contained FE2 header, but the value was , empty, or not parseable to a + Request to failed to send or response was not successful + + + + + + + Creates a StreamWrapper from a stream url or a stream id @@ -770,12 +932,15 @@ + + May be an ID instead for FE2 urls + Determines if the current stream wrapper contains a valid stream. - + The ReGex pattern to determine if a URL's AbsolutePath is a Frontend2 URL or not. This is used in conjunction with to extract the correct values into the instance. @@ -785,7 +950,7 @@ Parses a FrontEnd2 URL Regex match and assigns it's data to this StreamWrapper instance. - A regex match coming from + A regex match coming from Will throw when the URL is not properly formatted. Will throw when the URL is correct, but is not currently supported by the StreamWrapper class. @@ -803,24 +968,35 @@ Gets a valid account for this stream wrapper. Note: this method ensures that the stream exists and/or that the user has an account which has access to that stream. If used in a sync manner, make sure it's not blocking. - Throws exception if account fetching failed. This could be due to non-existent account or stream. + Throws exception if account fetching failed. This could be due to non-existent account or stream. The valid account object for this stream. - + - Policy for retrying failing Http requests + Verifies that the state of the stream wrapper represents a valid Speckle resource e.g. points to a valid stream/branch etc. + The account to use to verify the current state of the stream wrapper + The of the provided is invalid or does not match the 's + You are not connected to the internet + Verification of the current state of the stream wrapper with provided was unsuccessful. The could be invalid, or lack permissions for the , or the or are invalid - - - Policy for retrying failing Http requests - + + the value to hash + NumericFormat + + + the hash string + is not a recognised numeric format + + + + + MD5 is a broken cryptographic algorithm and should be used subject to review see CA5351 Checks if the user has a valid internet connection by first pinging cloudfare (fast) and then trying get from the default Speckle server (slower) - Each check is retried 3 times True if the user is connected to the internet, false otherwise. @@ -831,12 +1007,16 @@ The hostname or address to ping. True if the the status code is 200, false otherwise. - + - Pings and tries gettign data from a specific address to verify it's online. Retries 3 times. + Sends a GET request to the provided - The address to use - True if the the status code is successful, false otherwise. + The URI that should be pinged + Request to failed + + + requested cancel + Send request failed @@ -1031,36 +1211,40 @@ Converts a native object to a Speckle one - Native object to convert + Native object to convert + Converts a list of objects to Speckle. - + + Checks if it can convert a native object to a Speckle one - Native object to convert + Native object to convert Converts a Speckle object to a native one - Speckle object to convert + Speckle object to convert + Converts a list of Speckle objects to a native ones. - + + @@ -1076,14 +1260,14 @@ In this case, deciding which to use is dependent on each connector developer. Preferably, should be used as a fallback to the logic. - Speckle object to convert - The native object that resulted after converting the input + Speckle object to convert + The native object that resulted after converting the input Checks if it can convert a Speckle object to a native one - Speckle object to convert + Speckle object to convert @@ -1097,7 +1281,7 @@ Preferably, should be used as a fallback to the logic. Objects found in the 'displayValue' property are assumed to be universally convertible by all converters and the viewer, but are not guaranteed to be so. - Speckle object to convert + Speckle object to convert True if the object is "displayable" and the converter supports native conversion of the given speckle object in particular. @@ -1255,6 +1439,50 @@ The reference assembly name. A boolean value indicating if there is a reference. + + International Foot + + + US Survey foot + Considered an obsolete unit, superseded by the international foot + + + + if is a recognised/supported unit string, otherwise + + + + Gets the conversion factor from one unit system to another + + Semantic unit string for the units to convert from + Semantic unit string for the units to convert to + A + The scaling factor to convert from the units to the units, or 1 if either unit param is null or none + + + + Given , maps several friendly unit aliases to a a semantic unit string + + + The semantic unit string, if is + Unit string is not a supported unit (see ) + + + + Maps semantic unit strings to a numeric encoding + + + non-recognised unit encodings will be silently mapped to 0 + + + + + Maps a numeric encoding to the semantic unit string + + numeric encoded unit + non-recognised unit encodings will be silently mapped to + Semantic unit string + Anonymous telemetry to help us understand how to make a better Speckle. @@ -1316,6 +1544,12 @@ Cached server URL + + + when the DEBUG pre-processor directive is , otherwise + + This must be kept as a computed property, not a compile time const + Tracks an event without specifying the email and server. @@ -1346,6 +1580,31 @@ Additional parameters to pass to the event True if it's an action performed by a logged user + + + Helper function for catch blocks to avoid catching and handling/wrapping of some critical exception types that are unlikely to be truly handleable + + + We should aim to always catch specific exception types, and have all functions document the types they may throw. + However, this is not always achievable. + e.g. when dealing with legacy code, some third-party APIs, or in cases where we want to prevent a host app crash. + In these cases, we often want to catch all exceptions, and opt out only of the ones that definitely shouldn't be handled + + + + try + { + SomethingSketchy(); + } + catch (Exception ex) when (!IsFatal(ex)) + { + throw new SpeckleException("Failed to do something", ex); + } + + + + for types that are unlikely to ever be recoverable + Anonymous telemetry to help us understand how to make a better Speckle. @@ -1367,7 +1626,7 @@ Configuration object for the Speckle logging system. - + Flag to enable enhanced log context. This adds the following enrich calls: - WithClientAgent @@ -1375,37 +1634,37 @@ - WithExceptionDetails - + Flag to enable console sink - + Flag to enable File sink - + Flag to enable Sentry sink - + Flag to enable Seq sink - + Log events bellow this level are silently dropped - + Flag to override the default Sentry DNS - + Default SpeckleLogConfiguration constructor. These are the sane defaults we should be using across connectors. @@ -1441,6 +1700,71 @@ These are exceptions who's message is not user friendly + + + A simple wrapper to keep track of the relationship between speckle objects and their host-application siblings in cases where the + cannot correspond with the (ie, on receiving operations). + + + + + ID of the object from host application that generated it. + + + + + The container for the object in the native application + + + + + Indicates if conversion is supported by the converter + + + + + The fallback values if direct conversion is not available, typically displayValue + + + + + The Speckle id (on receive) or native id (on send) + + + Used to retrieve this object in ProgressReport.GetReportObject(), typically to pass between connectors and converters + + + + + A descriptive string to describe the object. Use the object type as default. + + + + + The created object ids associated with this object + + + On send, this is currently left empty as generating Speckle ids would be performance expensive + + + + + Conversion status of object + + + + + Conversion notes or other important information to expose to the user + + + + + Converted objects corresponding to this object + + + Used during receive for convenience, corresponds to CreatedIds + + Flags an object's property as being detachable. @@ -1454,7 +1778,7 @@ If set to true the default serialiser will persist it separately, and add a reference to the property's value in the original object. Only applies to properties of types derived from the Base class. - Wether to detach the property or not. + Whether to detach the property or not. @@ -1474,7 +1798,7 @@ - A speckle object's id is an unique hash based on its properties. NOTE: this field will be null unless the object was deserialised from a source. Use the function to get it. + A speckle object's id is an unique hash based on its properties. NOTE: this field will be null unless the object was deserialised from a source. Use the function to get it. @@ -1493,14 +1817,17 @@ from its assembly name and inheritance. - + - Gets the id (a unique hash) of this object. ⚠️ This method fully serializes the object, which in the case of large objects (with many sub-objects), has a tangible cost. Avoid using it! - Hint: Objects that are retrieved/pulled from a server/local cache do have an id (hash) property pre-populated. - Note:The hash of a decomposed object differs from the hash of a non-decomposed object. + Calculates the id (a unique hash) of this object. - If true, will decompose the object in the process of hashing. - + + This method fully serialize the object and any referenced objects. This has a tangible cost and should be avoided.
+ Objects retrieved from a already have a property populated
+ The hash of a decomposed object differs from the hash of a non-decomposed object. +
+ If , will decompose the object in the process of hashing. + the resulting id (hash)
@@ -1516,6 +1843,12 @@ A shallow copy of the original object. + + + + + + For blobs, the id is the same as the file hash. Please note, when deserialising, the id will be set from the original hash generated on sending. @@ -1524,7 +1857,7 @@ A simple container for organising objects within a model and preserving object hierarchy. - A container is defined by a human-readable , a unique , and its list of contained . + A container is defined by a human-readable , a unique , and its list of contained . The can include an unrestricted number of objects including additional nested s. @@ -1537,6 +1870,7 @@ Constructor for a basic collection. The human-readable name of this collection + @@ -1561,17 +1895,17 @@ Abstract Builder class for a root commit object. - The native object data type needed as input for building + The native object data type needed as input for building It is designed to be inherited by a host app specific implementation, to give connectors flexibility in constructing their objects. Inheritors should also create some function to add - + Special appId symbol for the root object - + app id -> base @@ -1579,7 +1913,7 @@ - Given the parameters, builds connector specific + Given the parameters, builds connector specific to be applied when is called. @@ -1591,22 +1925,22 @@ Can be overriden to adjust exactly which objects get automatically applied, - or to inject additional items into the dict that should not be automatically applied. + or to inject additional items into the dict that should not be automatically applied. Sets information on how a given object should be nested in the commit tree. - encodes the order in which we should try and nest the given - when is called + encodes the order in which we should try and nest the given + when is called The object to be nested - Information about how the object ideally should be nested, in order of priority + Information about how the object ideally should be nested, in order of priority - For each object in + For each object in @@ -1615,18 +1949,18 @@ Will attempt to find and nest the object - under the first valid parent according to the dictionary. + under the first valid parent according to the dictionary. A parent is considered valid if 1. Is non null - 2. Is in the dictionary - 3. Has (or can dynamically accept) a typed property with the propName specified by the item - 4. Said can accept the object's type + 2. Is in the dictionary + 3. Has (or can dynamically accept) a typed property with the propName specified by the item + 4. Said can accept the object's type - Thrown when no valid parent was found for given + Thrown when no valid parent was found for given @@ -1635,31 +1969,32 @@ https://weblog.west-wind.com/posts/2012/feb/08/creating-a-dynamic-extensible-c-expando-object - + Default value for - + The actual property bag, where dynamically added props are stored. - Sets and gets properties using the key accessor pattern. E.g.: -
((dynamic)myObject)["superProperty"] = 42;
+ Sets and gets properties using the key accessor pattern.
+ + myObject["superProperty"] = 42; +
+ Gets properties via the dot syntax. -
((dynamic)myObject).superProperty;
+ ((dynamic)myObject).superProperty;
- -
@@ -1795,7 +2130,20 @@ Value to set - + + + Returns if the given has an instance prop of the same name + otherwise returns with a '@' prefix for dynamic detaching. + + + These functions are workarounds for '@' prefixed property names being treated as unique keys. + And is useful in circumstances where you want to get/set detached properties without caring about the derived class definition + This behaviour, and these functions may be changed in future releases. + + + the property name to check for + detached property name + Checks if an object "is displayable" i.e. has a displayValue property that is a list of base. @@ -1837,72 +2185,6 @@ In short, this helps you chunk big things into smaller things. See the following reference. - - - - - A simple wrapper to keep track of the relationship between speckle objects and their host-application siblings in cases where the - cannot correspond with the (ie, on receiving operations). - - - - - ID of the object from host application that generated it. - - - - - The container for the object in the native application - - - - - Indicates if conversion is supported by the converter - - - - - The fallback values if direct conversion is not available, typically displayValue - - - - - The Speckle id (on receive) or native id (on send) - - - Used to retrieve this object in ProgressReport.GetReportObject(), typically to pass between connectors and converters - - - - - A descriptive string to describe the object. Use the object type as default. - - - - - The created object ids associated with this object - - - On send, this is currently left empty as generating Speckle ids would be performance expensive - - - - - Conversion status of object - - - - - Conversion notes or other important information to expose to the user - - - - - Converted objects corresponding to this object - - - Used during receive for convenience, corresponds to CreatedIds - @@ -1938,7 +2220,7 @@ Traverses until finds a convertable object then HALTS deeper traversal - Current does traversal, + Current Revit connector does traversal, so this traversal is a shallow traversal for directly convertable objects, and a deep traversal for all other types @@ -2065,7 +2347,7 @@ - + Property that describes the type of the object. @@ -2078,10 +2360,23 @@ The JSON string of the object to be deserialized A typed object deserialized from the - Thrown when - Thrown when deserializes to a type other than + Thrown when + was null + cannot be deserialised to type + + + + The deserialized object + was null + was not valid JSON + Failed to deserialize to the target type + + + + Json converter that handles base speckle objects. Enables detachment and + simultaneous transport (persistence) of objects. + - Property that describes the type of the object. @@ -2118,17 +2413,21 @@ Dictionary of object if and its subsequent closure table (a dictionary of hashes and min depth at which they are found). - - - Property that describes the type of the object. - - - - The sync transport. This transport will be used synchronously. - + The sync transport. This transport will be used synchronously. - + + The current total elapsed time spent serializing + + + The object to serialize + The serialized JSON + The serializer is busy (already serializing an object) + Failed to save object in one or more + Failed to extract (pre-serialize) properties from the + One or more 's cancellation token requested cancel + + Flushes kit's (discriminator, type) cache. Useful if you're dynamically loading more kits at runtime, that provide better coverage of what you're deserialising, and it's now somehow poisoned because the higher level types were not originally available. @@ -2175,12 +2474,12 @@ - Optional: signals to the transport that writes are about to begin. + Signals to the transport that writes are about to begin. - Optional: signals to the transport that no more items will need to be written. + Signals to the transport that no more items will need to be written. @@ -2188,14 +2487,19 @@ Saves an object.
The hash of the object. - The full string representation of the object. + The full string representation of the object + Failed to save object + requested cancel
- Saves an object, retrieving its serialised version from the provided transport. + + Retrieving its serialised version from the provided transport. - The hash of the object. + The transport from where to retrieve it. + Failed to save object + requested cancel @@ -2206,7 +2510,7 @@ The object's hash. The serialized object data, or if the transport cannot find the object - + requested cancel @@ -2216,9 +2520,9 @@ The transport you want to copy the object to. (Optional) an that will be invoked once, when the number of object children to be copied over is known. The string representation of the root object. - The transport was in an invalid state The provided arguments are not valid - + The transport could not complete the operation + requested cancel @@ -2226,6 +2530,8 @@ List of object ids to check A dictionary with the specified object ids as keys and boolean values, whether each object is present in the transport or not + The transport could not complete the operation + requested cancel @@ -2244,20 +2550,41 @@ - + https://cymbeline.ch/2014/03/16/gzip-encoding-an-http-post-request-body/ - + Callback when sending batches. Parameters: object count, total bytes sent + + + + + Defaults to + was not formatted as valid stream id + Timer that ensures queue is consumed if less than MAX_TRANSACTION_SIZE objects are being sent. + + + Connects to an SQLite DB at {}/{}/{}.db + Will attempt to create db + directory structure as needed + + defaults to if + defaults to "Speckle" if + defaults to "Data" if + Failed to initialize a connection to the db + Path was invalid or could not be created + + + Failed to initialize connection to the SQLite DB + Returns all the objects in the store. Note: do not use for large collections. @@ -2283,7 +2610,7 @@ - + Returns true if the current write queue is empty and comitted. @@ -2310,6 +2637,11 @@ + + The Json object + The closure table + Failed to deserialize the object into + Waits until the provided function returns true. diff --git a/Packages/systems.speckle.speckle-unity/Runtime/Dispatcher.cs b/Packages/systems.speckle.speckle-unity/Runtime/Dispatcher.cs index 5f669e1..18dccd4 100644 --- a/Packages/systems.speckle.speckle-unity/Runtime/Dispatcher.cs +++ b/Packages/systems.speckle.speckle-unity/Runtime/Dispatcher.cs @@ -98,7 +98,7 @@ namespace Speckle.ConnectorUnity yield return null; } - private static Dispatcher _instance = null; + private static Dispatcher _instance; public static bool Exists() { diff --git a/Packages/systems.speckle.speckle-unity/Runtime/Objects/Objects.dll b/Packages/systems.speckle.speckle-unity/Runtime/Objects/Objects.dll index 55f9e5c..c76c39d 100644 Binary files a/Packages/systems.speckle.speckle-unity/Runtime/Objects/Objects.dll and b/Packages/systems.speckle.speckle-unity/Runtime/Objects/Objects.dll differ diff --git a/Packages/systems.speckle.speckle-unity/Runtime/Utils/Utils.cs b/Packages/systems.speckle.speckle-unity/Runtime/Utils/Utils.cs index ea646aa..57f8f3e 100644 --- a/Packages/systems.speckle.speckle-unity/Runtime/Utils/Utils.cs +++ b/Packages/systems.speckle.speckle-unity/Runtime/Utils/Utils.cs @@ -1,6 +1,7 @@ #nullable enable using System; using System.Collections; +using System.Threading; using System.Threading.Tasks; using UnityEngine; using UnityEngine.Networking; @@ -111,9 +112,9 @@ namespace Speckle.ConnectorUnity.Utils public readonly Task Task; public override bool keepWaiting => !Task.IsCompleted; - public WaitForTask(Func function) + public WaitForTask(Func function, CancellationToken cancellationToken = default) { - Task = Task.Run(function); + Task = Task.Run(function, cancellationToken); } } @@ -124,9 +125,12 @@ namespace Speckle.ConnectorUnity.Utils public TResult Result => Task.Result; public override bool keepWaiting => !Task.IsCompleted; - public WaitForTask(Func> function) + public WaitForTask( + Func> function, + CancellationToken cancellationToken = default + ) { - this.Task = System.Threading.Tasks.Task.Run(function); + this.Task = System.Threading.Tasks.Task.Run(function, cancellationToken); } } } diff --git a/Packages/systems.speckle.speckle-unity/Runtime/Wrappers/Selection/AccountSelection.cs b/Packages/systems.speckle.speckle-unity/Runtime/Wrappers/Selection/AccountSelection.cs index fd3dce8..587a807 100644 --- a/Packages/systems.speckle.speckle-unity/Runtime/Wrappers/Selection/AccountSelection.cs +++ b/Packages/systems.speckle.speckle-unity/Runtime/Wrappers/Selection/AccountSelection.cs @@ -30,7 +30,7 @@ namespace Speckle.ConnectorUnity.Wrappers.Selection if (value is null) return null; - return value.id + Crypt.Hash(value.serverInfo.url ?? ""); + return value.id + Crypt.Md5(value.serverInfo.url ?? "", "X2"); } public override void RefreshOptions() diff --git a/Packages/systems.speckle.speckle-unity/package.json b/Packages/systems.speckle.speckle-unity/package.json index 8154070..a2c6dd3 100644 --- a/Packages/systems.speckle.speckle-unity/package.json +++ b/Packages/systems.speckle.speckle-unity/package.json @@ -1,6 +1,6 @@ { "name": "systems.speckle.speckle-unity", - "version": "2.17.1", + "version": "2.18.0-rc1", "displayName": "Speckle Unity Connector", "description": "AEC Interoperability for Unity through Speckle", "unity": "2021.1", @@ -21,4 +21,4 @@ "email": "hello@speckle.systems", "url": "https://speckle.systems" } -} \ No newline at end of file +} diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index f8251a7..cd32c29 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1,2 +1,2 @@ -m_EditorVersion: 2021.3.22f1 -m_EditorVersionWithRevision: 2021.3.22f1 (b6c551784ba3) +m_EditorVersion: 2021.3.30f1 +m_EditorVersionWithRevision: 2021.3.30f1 (b4360d7cdac4)