-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #111 from specklesystems/dev
* 2.18 Update * fixed bug with selection not correctly restoring after deserializing * Bump core to 2.18.0-rc * FE2 terms (#112) * FE2 terms * SendComponent * Removed terminology switching * Bumped core version (#113)
- Loading branch information
Showing
28 changed files
with
1,176 additions
and
736 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,71 +1,67 @@ | ||
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; | ||
|
||
[AddComponentMenu("Speckle/Extras/Manual Receiver")] | ||
[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<RecursiveConverter>(); | ||
} | ||
|
||
|
||
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"); | ||
}); | ||
}); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.