FE2 terms (#112)

* FE2 terms

* SendComponent

* Removed terminology switching
This commit is contained in:
Jedd Morgan
2024-03-14 10:41:07 +00:00
committed by GitHub
parent 8e32a0214e
commit 00c4a43c3a
4 changed files with 56 additions and 14 deletions
@@ -1,4 +1,3 @@
#nullable enable
using System;
using System.Collections.Concurrent;
using System.Threading.Tasks;
@@ -13,6 +12,12 @@ namespace Speckle.ConnectorUnity.Components.Editor
[CustomEditor(typeof(SpeckleReceiver))]
public class SpeckleReceiverEditor : UnityEditor.Editor
{
private SerializedProperty _accountSelection;
private SerializedProperty _streamSelection;
private SerializedProperty _branchSelection;
private SerializedProperty _commitSelection;
#nullable enable
private static bool _generateAssets;
private bool _foldOutStatus = true;
private Texture2D? _previewImage;
@@ -21,7 +26,11 @@ namespace Speckle.ConnectorUnity.Components.Editor
{
var speckleReceiver = (SpeckleReceiver)target;
DrawDefaultInspector();
//Selection
EditorGUILayout.PropertyField(_accountSelection);
EditorGUILayout.PropertyField(_streamSelection, new GUIContent("Project"));
EditorGUILayout.PropertyField(_branchSelection, new GUIContent("Model"));
EditorGUILayout.PropertyField(_commitSelection, new GUIContent("Version"));
//Preview image
{
@@ -64,8 +73,8 @@ namespace Speckle.ConnectorUnity.Components.Editor
else if (userRequestedReceive)
{
var id = Progress.Start(
"Receiving Speckle data",
"Fetching commit data",
"Receiving Speckle Model",
"Fetching data from Speckle",
Progress.Options.Sticky
);
Progress.ShowDetails();
@@ -96,6 +105,19 @@ namespace Speckle.ConnectorUnity.Components.Editor
public void OnEnable()
{
Init();
_accountSelection = serializedObject.FindProperty(
$"<{nameof(SpeckleReceiver.Account)}>k__BackingField"
);
_streamSelection = serializedObject.FindProperty(
$"<{nameof(SpeckleReceiver.Stream)}>k__BackingField"
);
_branchSelection = serializedObject.FindProperty(
$"<{nameof(SpeckleReceiver.Branch)}>k__BackingField"
);
_commitSelection = serializedObject.FindProperty(
$"<{nameof(SpeckleReceiver.Commit)}>k__BackingField"
);
}
public void Reset()
@@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Immutable;
@@ -9,7 +10,6 @@ using UnityEngine;
using UnityEngine.SceneManagement;
using Component = UnityEngine.Component;
#nullable enable
namespace Speckle.ConnectorUnity.Components.Editor
{
public enum SelectionFilter
@@ -35,12 +35,32 @@ namespace Speckle.ConnectorUnity.Components.Editor
[CanEditMultipleObjects]
public class SpeckleSendEditor : UnityEditor.Editor
{
private SerializedProperty _accountSelection;
private SerializedProperty _streamSelection;
private SerializedProperty _branchSelection;
#nullable enable
private SelectionFilter _selectedFilter = SelectionFilter.Children;
public void OnEnable()
{
_accountSelection = serializedObject.FindProperty(
$"<{nameof(SpeckleSender.Account)}>k__BackingField"
);
_streamSelection = serializedObject.FindProperty(
$"<{nameof(SpeckleSender.Stream)}>k__BackingField"
);
_branchSelection = serializedObject.FindProperty(
$"<{nameof(SpeckleSender.Branch)}>k__BackingField"
);
}
public override async void OnInspectorGUI()
{
//Draw events in a collapsed region
DrawDefaultInspector();
//Selection
EditorGUILayout.PropertyField(_accountSelection);
EditorGUILayout.PropertyField(_streamSelection, new GUIContent("Project"));
EditorGUILayout.PropertyField(_branchSelection, new GUIContent("Model"));
bool shouldSend = GUILayout.Button("Send!");
_selectedFilter = (SelectionFilter)
@@ -79,7 +99,7 @@ namespace Speckle.ConnectorUnity.Components.Editor
if (data["@objects"] is IList l && l.Count == 0)
{
Debug.LogWarning($"Nothing to send", speckleSender);
Debug.LogWarning("Nothing to send", speckleSender);
return null;
}
@@ -46,7 +46,7 @@ namespace Speckle.ConnectorUnity.Wrappers.Selection.Editor
details = new (string, Func<Stream, string>)[]
{
("Stream id", s => s.id),
("Project id", s => s.id),
("Description", s => s.description),
("Is Public", s => s.isPublic.ToString()),
("Role", s => s.role),
@@ -88,7 +88,7 @@ namespace Speckle.ConnectorUnity.Wrappers.Selection.Editor
{
details = new (string, Func<Commit, string>)[]
{
("Commit Id", s => s.id),
("Version Id", s => s.id),
("Author Name", s => s.authorName),
("Created At", s => s.createdAt.ToString(CultureInfo.InvariantCulture)),
("Source Application", s => s.sourceApplication),
@@ -200,15 +200,15 @@ namespace Speckle.ConnectorUnity.Components
{
Client? selectedClient = Account.Client;
client =
selectedClient ?? throw new InvalidOperationException("Invalid account selection");
selectedClient ?? throw new InvalidOperationException("Invalid Speckle account selection");
Stream? selectedStream = Stream.Selected;
stream =
selectedStream ?? throw new InvalidOperationException("Invalid stream selection");
selectedStream ?? throw new InvalidOperationException("Invalid Speckle project selection");
Commit? selectedCommit = Commit.Selected;
commit =
selectedCommit ?? throw new InvalidOperationException("Invalid commit selection");
selectedCommit ?? throw new InvalidOperationException("Invalid Speckle version selection");
}
/// <summary>
@@ -445,7 +445,7 @@ namespace Speckle.ConnectorUnity.Components
}
#if UNITY_EDITOR
[ContextMenu("Open Speckle Stream in Browser")]
[ContextMenu("Open Speckle Model in Browser")]
protected void OpenUrlInBrowser()
{
Uri url = GetSelectedUrl();