diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/TrackableWindow.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/TrackableWindow.cs index acc8f552afe2a2b033951a349cf5e059aaee81e6..f6da0d87d4cc6ff8f44b91e4ec42199f1fd9a311 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/TrackableWindow.cs +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/TrackableWindow.cs @@ -40,6 +40,8 @@ namespace ETSI.ARF.WorldStorage.UI { public class TrackableWindow : EditorWindow { + static public TrackableWindow winSingleton; + [HideInInspector] public WorldStorageServer worldStorageServer; [HideInInspector] public WorldStorageUser worldStorageUser; @@ -64,11 +66,16 @@ namespace ETSI.ARF.WorldStorage.UI private Color ori; private GUIStyle gsTest; - public static void ShowWindow(WorldStorageServer ws, WorldStorageUser user) + public static void ShowWindow(WorldStorageServer ws, WorldStorageUser user, string UUID = "") { - TrackableWindow win = EditorWindow.GetWindow(typeof(TrackableWindow), false, WorldStorageWindow.winName) as TrackableWindow; - win.worldStorageServer = ws; - win.worldStorageUser = user; + winSingleton = EditorWindow.GetWindow(typeof(TrackableWindow), false, WorldStorageWindow.winName) as TrackableWindow; + winSingleton.worldStorageServer = ws; + winSingleton.worldStorageUser = user; + if (!string.IsNullOrEmpty(UUID)) + { + winSingleton.UUID = UUID; + winSingleton.GetTrackableParams(); + } } public TrackableWindow() @@ -114,41 +121,11 @@ namespace ETSI.ARF.WorldStorage.UI EditorGUILayout.Space(); GUI.backgroundColor = WorldStorageWindow.arfColors[1]; - if (GUILayout.Button("Get Parameters")) + if (GUILayout.Button("Read Parameters")) { - if (!customName.Contains("[")) UUID = customName; - else - { - // extract the UUID - UUID = customName.Split('[', ']')[1]; - } - Trackable obj = TrackableRequest.GetTrackable(worldStorageServer, UUID); - customName = obj.Name; - creatorUUID = obj.CreatorUUID.ToString(); - type = obj.TrackableType; - unit = obj.Unit; - if (obj.TrackableSize.Count == 3) - { - trackableSize = new Vector3((float)obj.TrackableSize[0], (float)obj.TrackableSize[1], (float)obj.TrackableSize[2]); - } - else trackableSize = Vector3.zero; - if (obj.LocalCRS.Count == 16) - { - Matrix4x4 localCRS = new Matrix4x4(); - localCRS.m00 = obj.LocalCRS[0]; localCRS.m01 = obj.LocalCRS[1]; localCRS.m02 = obj.LocalCRS[2]; localCRS.m03 = obj.LocalCRS[3]; - localCRS.m10 = obj.LocalCRS[4]; localCRS.m11 = obj.LocalCRS[5]; localCRS.m12 = obj.LocalCRS[6]; localCRS.m13 = obj.LocalCRS[7]; - localCRS.m20 = obj.LocalCRS[8]; localCRS.m21 = obj.LocalCRS[9]; localCRS.m22 = obj.LocalCRS[10]; localCRS.m23 = obj.LocalCRS[11]; - localCRS.m30 = obj.LocalCRS[12]; localCRS.m31 = obj.LocalCRS[13]; localCRS.m32 = obj.LocalCRS[14]; localCRS.m33 = obj.LocalCRS[15]; - localCRS_pos = localCRS.GetPosition(); - localCRS_rot = localCRS.rotation.eulerAngles; - } - else - { - localCRS_pos = Vector3.zero; - localCRS_rot = Vector3.zero; - } - keyValueTags = obj.KeyvalueTags; - this.Repaint(); // TODO + UUID = WorldStorageWindow.GetUUIDFromString(customName); + if (UUID == null) UUID = customName; // try this + GetTrackableParams(); } GUI.backgroundColor = ori; @@ -248,6 +225,36 @@ namespace ETSI.ARF.WorldStorage.UI GUI.backgroundColor = ori; } + private void GetTrackableParams() + { + Trackable obj = TrackableRequest.GetTrackable(worldStorageServer, UUID); + customName = obj.Name; + creatorUUID = obj.CreatorUUID.ToString(); + type = obj.TrackableType; + unit = obj.Unit; + if (obj.TrackableSize.Count == 3) + { + trackableSize = new Vector3((float)obj.TrackableSize[0], (float)obj.TrackableSize[1], (float)obj.TrackableSize[2]); + } + else trackableSize = Vector3.zero; + if (obj.LocalCRS.Count == 16) + { + Matrix4x4 localCRS = new Matrix4x4(); + localCRS.m00 = obj.LocalCRS[0]; localCRS.m01 = obj.LocalCRS[1]; localCRS.m02 = obj.LocalCRS[2]; localCRS.m03 = obj.LocalCRS[3]; + localCRS.m10 = obj.LocalCRS[4]; localCRS.m11 = obj.LocalCRS[5]; localCRS.m12 = obj.LocalCRS[6]; localCRS.m13 = obj.LocalCRS[7]; + localCRS.m20 = obj.LocalCRS[8]; localCRS.m21 = obj.LocalCRS[9]; localCRS.m22 = obj.LocalCRS[10]; localCRS.m23 = obj.LocalCRS[11]; + localCRS.m30 = obj.LocalCRS[12]; localCRS.m31 = obj.LocalCRS[13]; localCRS.m32 = obj.LocalCRS[14]; localCRS.m33 = obj.LocalCRS[15]; + localCRS_pos = localCRS.GetPosition(); + localCRS_rot = localCRS.rotation.eulerAngles; + } + else + { + localCRS_pos = Vector3.zero; + localCRS_rot = Vector3.zero; + } + keyValueTags = obj.KeyvalueTags; + this.Repaint(); // TODO + } public Trackable GenerateTrackable() { diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldAnchorWindow.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldAnchorWindow.cs index 84eec85be16da368bf5c02a87dbc1fdc58e00347..ae8f0c379215bd756a536fc952252aca8ee6dd3a 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldAnchorWindow.cs +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldAnchorWindow.cs @@ -39,6 +39,8 @@ namespace ETSI.ARF.WorldStorage.UI { public class WorldAnchorWindow : EditorWindow { + static public WorldAnchorWindow winSingleton; + [HideInInspector] public WorldStorageServer worldStorageServer; [HideInInspector] public WorldStorageUser worldStorageUser; @@ -61,11 +63,16 @@ namespace ETSI.ARF.WorldStorage.UI private Color ori; private GUIStyle gsTest; - public static void ShowWindow(WorldStorageServer ws, WorldStorageUser user) + public static void ShowWindow(WorldStorageServer ws, WorldStorageUser user, string UUID = "") { - WorldAnchorWindow win = EditorWindow.GetWindow(typeof(WorldAnchorWindow), false, WorldStorageWindow.winName) as WorldAnchorWindow; - win.worldStorageServer = ws; - win.worldStorageUser = user; + winSingleton = EditorWindow.GetWindow(typeof(WorldAnchorWindow), false, WorldStorageWindow.winName) as WorldAnchorWindow; + winSingleton.worldStorageServer = ws; + winSingleton.worldStorageUser = user; + if (!string.IsNullOrEmpty(UUID)) + { + winSingleton.UUID = UUID; + winSingleton.GetWorldAnchorParams(); + } } public WorldAnchorWindow() @@ -111,40 +118,11 @@ namespace ETSI.ARF.WorldStorage.UI EditorGUILayout.Space(); GUI.backgroundColor = WorldStorageWindow.arfColors[1]; - if (GUILayout.Button("Get Parameters")) + if (GUILayout.Button("Read Parameters")) { - if (!customName.Contains("[")) UUID = customName; - else - { - // extract the UUID - UUID = customName.Split('[', ']')[1]; - } - WorldAnchor obj = WorldAnchorRequest.GetWorldAnchor(worldStorageServer, UUID); - customName = obj.Name; - creatorUUID = obj.CreatorUUID.ToString(); - unit = obj.Unit; - if (obj.WorldAnchorSize.Count == 3) - { - worldAnchorSize = new Vector3((float)obj.WorldAnchorSize[0], (float)obj.WorldAnchorSize[1], (float)obj.WorldAnchorSize[2]); - } - else worldAnchorSize = Vector3.zero; - if (obj.LocalCRS.Count == 16) - { - Matrix4x4 localCRS = new Matrix4x4(); - localCRS.m00 = obj.LocalCRS[0]; localCRS.m01 = obj.LocalCRS[1]; localCRS.m02 = obj.LocalCRS[2]; localCRS.m03 = obj.LocalCRS[3]; - localCRS.m10 = obj.LocalCRS[4]; localCRS.m11 = obj.LocalCRS[5]; localCRS.m12 = obj.LocalCRS[6]; localCRS.m13 = obj.LocalCRS[7]; - localCRS.m20 = obj.LocalCRS[8]; localCRS.m21 = obj.LocalCRS[9]; localCRS.m22 = obj.LocalCRS[10]; localCRS.m23 = obj.LocalCRS[11]; - localCRS.m30 = obj.LocalCRS[12]; localCRS.m31 = obj.LocalCRS[13]; localCRS.m32 = obj.LocalCRS[14]; localCRS.m33 = obj.LocalCRS[15]; - localCRS_pos = localCRS.GetPosition(); - localCRS_rot = localCRS.rotation.eulerAngles; - } - else - { - localCRS_pos = Vector3.zero; - localCRS_rot = Vector3.zero; - } - keyValueTags = obj.KeyvalueTags; - this.Repaint(); // TODO + UUID = WorldStorageWindow.GetUUIDFromString(customName); + if (UUID == null) UUID = customName; // try this + GetWorldAnchorParams(); } GUI.backgroundColor = ori; @@ -224,6 +202,36 @@ namespace ETSI.ARF.WorldStorage.UI GUI.backgroundColor = ori; } + private void GetWorldAnchorParams() + { + WorldAnchor obj = WorldAnchorRequest.GetWorldAnchor(worldStorageServer, UUID); + customName = obj.Name; + creatorUUID = obj.CreatorUUID.ToString(); + unit = obj.Unit; + if (obj.WorldAnchorSize.Count == 3) + { + worldAnchorSize = new Vector3((float)obj.WorldAnchorSize[0], (float)obj.WorldAnchorSize[1], (float)obj.WorldAnchorSize[2]); + } + else worldAnchorSize = Vector3.zero; + if (obj.LocalCRS.Count == 16) + { + Matrix4x4 localCRS = new Matrix4x4(); + localCRS.m00 = obj.LocalCRS[0]; localCRS.m01 = obj.LocalCRS[1]; localCRS.m02 = obj.LocalCRS[2]; localCRS.m03 = obj.LocalCRS[3]; + localCRS.m10 = obj.LocalCRS[4]; localCRS.m11 = obj.LocalCRS[5]; localCRS.m12 = obj.LocalCRS[6]; localCRS.m13 = obj.LocalCRS[7]; + localCRS.m20 = obj.LocalCRS[8]; localCRS.m21 = obj.LocalCRS[9]; localCRS.m22 = obj.LocalCRS[10]; localCRS.m23 = obj.LocalCRS[11]; + localCRS.m30 = obj.LocalCRS[12]; localCRS.m31 = obj.LocalCRS[13]; localCRS.m32 = obj.LocalCRS[14]; localCRS.m33 = obj.LocalCRS[15]; + localCRS_pos = localCRS.GetPosition(); + localCRS_rot = localCRS.rotation.eulerAngles; + } + else + { + localCRS_pos = Vector3.zero; + localCRS_rot = Vector3.zero; + } + keyValueTags = obj.KeyvalueTags; + this.Repaint(); // TODO + } + public WorldAnchor GenerateWorldAnchor() { #if USING_OPENAPI_GENERATOR diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldLinkWindow.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldLinkWindow.cs index 8334534197c9289c1f6fef3cf1d8f0cc638832bc..039ca12bd60d73fa1e2c80918e3796763059ee4b 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldLinkWindow.cs +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldLinkWindow.cs @@ -39,19 +39,29 @@ namespace ETSI.ARF.WorldStorage.UI { public class WorldLinkWindow : EditorWindow { + static public WorldLinkWindow winSingleton; + [HideInInspector] public WorldStorageServer worldStorageServer; [HideInInspector] public WorldStorageUser worldStorageUser; [SerializeField] public List anchors = new List(); bool groupEnabled; + private static GUILayoutOption miniButtonWidth = GUILayout.Width(50); // World Anchors params string UUID = System.Guid.Empty.ToString(); string customName = "(no name for World Links)"; string creatorUUID = System.Guid.Empty.ToString(); + // From... + private bool showListFrom = true; + string fromName = "(none)"; string fromUUID = System.Guid.Empty.ToString(); + // To... + private bool showListTo = true; + string toName = "(none)"; string toUUID = System.Guid.Empty.ToString(); + UnitSystem unit = UnitSystem.CM; ObjectType fromType = ObjectType.NotIdentified, toType = ObjectType.NotIdentified; Vector3 localCRS_pos; @@ -63,11 +73,16 @@ namespace ETSI.ARF.WorldStorage.UI private Color ori; private GUIStyle gsTest; - public static void ShowWindow(WorldStorageServer ws, WorldStorageUser user) + public static void ShowWindow(WorldStorageServer ws, WorldStorageUser user, string UUID = "") { - WorldLinkWindow win = EditorWindow.GetWindow(typeof(WorldLinkWindow), false, WorldStorageWindow.winName) as WorldLinkWindow; - win.worldStorageServer = ws; - win.worldStorageUser = user; + winSingleton = EditorWindow.GetWindow(typeof(WorldLinkWindow), false, WorldStorageWindow.winName) as WorldLinkWindow; + winSingleton.worldStorageServer = ws; + winSingleton.worldStorageUser = user; + if (!string.IsNullOrEmpty(UUID)) + { + winSingleton.UUID = UUID; + winSingleton.GetWorldLinkParams(); + } } public WorldLinkWindow() @@ -113,46 +128,53 @@ namespace ETSI.ARF.WorldStorage.UI EditorGUILayout.Space(); GUI.backgroundColor = WorldStorageWindow.arfColors[1]; - if (GUILayout.Button("Get Parameters")) + if (GUILayout.Button("Read Parameters")) { - if (!customName.Contains("[")) UUID = customName; - else - { - // extract the UUID - UUID = customName.Split('[', ']')[1]; - } - WorldLink obj = WorldLinkRequest.GetWorldLink(worldStorageServer, UUID); - //customName = obj.Name; - creatorUUID = obj.CreatorUUID.ToString(); - fromUUID = obj.UUIDFrom.ToString(); - toUUID = obj.UUIDTo.ToString(); - fromType = obj.TypeFrom; - toType = obj.TypeTo; - unit = obj.Unit; - if (obj.Transform.Count == 16) - { - Matrix4x4 localCRS = new Matrix4x4(); - localCRS.m00 = obj.Transform[0]; localCRS.m01 = obj.Transform[1]; localCRS.m02 = obj.Transform[2]; localCRS.m03 = obj.Transform[3]; - localCRS.m10 = obj.Transform[4]; localCRS.m11 = obj.Transform[5]; localCRS.m12 = obj.Transform[6]; localCRS.m13 = obj.Transform[7]; - localCRS.m20 = obj.Transform[8]; localCRS.m21 = obj.Transform[9]; localCRS.m22 = obj.Transform[10]; localCRS.m23 = obj.Transform[11]; - localCRS.m30 = obj.Transform[12]; localCRS.m31 = obj.Transform[13]; localCRS.m32 = obj.Transform[14]; localCRS.m33 = obj.Transform[15]; - localCRS_pos = localCRS.GetPosition(); - localCRS_rot = localCRS.rotation.eulerAngles; - } - else - { - localCRS_pos = Vector3.zero; - localCRS_rot = Vector3.zero; - } - keyValueTags = obj.KeyvalueTags; - this.Repaint(); // TODO + UUID = WorldStorageWindow.GetUUIDFromString(customName); + if (UUID == null) UUID = customName; // try this + GetWorldLinkParams(); } GUI.backgroundColor = ori; unit = (UnitSystem)EditorGUILayout.EnumPopup("Unit System:", unit); - fromType = (ObjectType)EditorGUILayout.EnumPopup("From Object Type:", fromType); - toType = (ObjectType)EditorGUILayout.EnumPopup("To Object Type:", toType); + EditorGUILayout.Space(); + showListFrom = EditorGUILayout.Foldout(showListFrom, "Parent Object (From)"); + if (showListFrom) + { + EditorGUILayout.BeginHorizontal(); + fromUUID = EditorGUILayout.TextField("UUID", fromUUID); + GUI.backgroundColor = WorldStorageWindow.arfColors[1]; + if (GUILayout.Button("Find", EditorStyles.miniButtonLeft, miniButtonWidth)) + { + // TODO Request the object from the server + fromName = "(not implemented yet)"; + fromType = ObjectType.NotIdentified; + } + EditorGUILayout.EndHorizontal(); + GUI.backgroundColor = ori; + fromName = EditorGUILayout.TextField("Name", fromName); + fromType = (ObjectType)EditorGUILayout.EnumPopup("Type:", fromType); + } + + EditorGUILayout.Space(); + showListTo = EditorGUILayout.Foldout(showListTo, "Child Object (To)"); + if (showListTo) + { + EditorGUILayout.BeginHorizontal(); + toUUID = EditorGUILayout.TextField("UUID", toUUID); + GUI.backgroundColor = WorldStorageWindow.arfColors[1]; + if (GUILayout.Button("Find", EditorStyles.miniButtonLeft, miniButtonWidth)) + { + // TODO Request the object from the server + toName = "(not implemented yet)"; + toType = ObjectType.NotIdentified; + } + EditorGUILayout.EndHorizontal(); + GUI.backgroundColor = ori; + toName = EditorGUILayout.TextField("Name", toName); + toType = (ObjectType)EditorGUILayout.EnumPopup("Type:", toType); + } EditorGUILayout.Space(10); GUILayout.Label("Local CRS:"); @@ -225,6 +247,35 @@ namespace ETSI.ARF.WorldStorage.UI GUI.backgroundColor = ori; } + private void GetWorldLinkParams() + { + WorldLink obj = WorldLinkRequest.GetWorldLink(worldStorageServer, UUID); + //customName = obj.Name; + creatorUUID = obj.CreatorUUID.ToString(); + fromUUID = obj.UUIDFrom.ToString(); + toUUID = obj.UUIDTo.ToString(); + fromType = obj.TypeFrom; + toType = obj.TypeTo; + unit = obj.Unit; + if (obj.Transform.Count == 16) + { + Matrix4x4 localCRS = new Matrix4x4(); + localCRS.m00 = obj.Transform[0]; localCRS.m01 = obj.Transform[1]; localCRS.m02 = obj.Transform[2]; localCRS.m03 = obj.Transform[3]; + localCRS.m10 = obj.Transform[4]; localCRS.m11 = obj.Transform[5]; localCRS.m12 = obj.Transform[6]; localCRS.m13 = obj.Transform[7]; + localCRS.m20 = obj.Transform[8]; localCRS.m21 = obj.Transform[9]; localCRS.m22 = obj.Transform[10]; localCRS.m23 = obj.Transform[11]; + localCRS.m30 = obj.Transform[12]; localCRS.m31 = obj.Transform[13]; localCRS.m32 = obj.Transform[14]; localCRS.m33 = obj.Transform[15]; + localCRS_pos = localCRS.GetPosition(); + localCRS_rot = localCRS.rotation.eulerAngles; + } + else + { + localCRS_pos = Vector3.zero; + localCRS_rot = Vector3.zero; + } + keyValueTags = obj.KeyvalueTags; + this.Repaint(); // TODO + } + public WorldLink GenerateWorldLink() { Matrix4x4 localCRS = new Matrix4x4(); diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldStorageWindow.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldStorageWindow.cs index 5d353c9587cff336a1e9ed24bbf80b2620a38367..d9830453e88a3ac9833f28abe5faaa663c98fb7b 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldStorageWindow.cs +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldStorageWindow.cs @@ -59,6 +59,12 @@ namespace ETSI.ARF.WorldStorage.UI private Color ori; private GUIStyle gsTest; + private static GUILayoutOption miniButtonWidth = GUILayout.Width(32); + private static GUILayoutOption buttonWidth = GUILayout.Width(64f); + private bool showListT = true; + private bool showListA = true; + private bool showListL = true; + static public string winName = "ARF Authoring Editor"; static public Color[] arfColors = new Color[] { @@ -124,6 +130,10 @@ namespace ETSI.ARF.WorldStorage.UI EditorGUILayout.EndScrollView(); } + public void OnInspectorUpdate() + { + this.Repaint(); + } void DrawElementStuffs() { @@ -225,12 +235,37 @@ namespace ETSI.ARF.WorldStorage.UI WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); } GUI.backgroundColor = ori; - + // Show list stringsProperty = so.FindProperty("trackables"); - EditorGUILayout.PropertyField(stringsProperty, /*new GUIContent("Trackbales"),*/ true); // True means show children - so.ApplyModifiedProperties(); // Remember to apply modified properties + //EditorGUILayout.PropertyField(stringsProperty, /*new GUIContent("Trackbales"),*/ true); // True means show children + //so.ApplyModifiedProperties(); // Remember to apply modified properties + // New version with "Edit" button: + showListT = EditorGUILayout.BeginFoldoutHeaderGroup(showListT, "List of Trackables"); + if (showListT) + for (int i = 0; i < stringsProperty.arraySize; i++) + { + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PropertyField(stringsProperty.GetArrayElementAtIndex(i)); + //EditorGUILayout.PropertyField(list.GetArrayElementAtIndex(i), GUIContent.none); + + string UUID = WorldStorageWindow.GetUUIDFromString(stringsProperty.GetArrayElementAtIndex(i).stringValue); + if (UUID == null) UUID = trackables[i]; // try this + if (GUILayout.Button("-", EditorStyles.miniButtonLeft, miniButtonWidth)) + { + TrackableRequest.DeleteTrackable(worldStorageServer, UUID); + WorldStorageWindowSingleton.GetTrackables(); + WorldStorageWindowSingleton.Repaint(); + } + if (GUILayout.Button("Edit...", EditorStyles.miniButtonLeft, buttonWidth)) + { + Debug.Log("Open Trackable Window"); + TrackableWindow.ShowWindow(worldStorageServer, worldStorageUser, UUID); + } + EditorGUILayout.EndHorizontal(); + } + EditorGUILayout.EndFoldoutHeaderGroup(); #endregion // ########################################################### @@ -276,8 +311,34 @@ namespace ETSI.ARF.WorldStorage.UI // Show list stringsProperty = so.FindProperty("anchors"); - EditorGUILayout.PropertyField(stringsProperty, /*new GUIContent("Trackbales"),*/ true); // True means show children - so.ApplyModifiedProperties(); // Remember to apply modified properties + //EditorGUILayout.PropertyField(stringsProperty, /*new GUIContent("Trackbales"),*/ true); // True means show children + //so.ApplyModifiedProperties(); // Remember to apply modified properties + + // New version with "Edit" button: + showListA = EditorGUILayout.BeginFoldoutHeaderGroup(showListA, "List of World Anchors"); + if (showListA) + for (int i = 0; i < stringsProperty.arraySize; i++) + { + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PropertyField(stringsProperty.GetArrayElementAtIndex(i)); + //EditorGUILayout.PropertyField(list.GetArrayElementAtIndex(i), GUIContent.none); + + string UUID = WorldStorageWindow.GetUUIDFromString(stringsProperty.GetArrayElementAtIndex(i).stringValue); + if (UUID == null) UUID = anchors[i]; // try this + if (GUILayout.Button("-", EditorStyles.miniButtonLeft, miniButtonWidth)) + { + WorldAnchorRequest.DeleteWorldAnchor(worldStorageServer, UUID); + WorldStorageWindowSingleton.GetWorldAnchors(); + WorldStorageWindowSingleton.Repaint(); + } + if (GUILayout.Button("Edit...", EditorStyles.miniButtonLeft, buttonWidth)) + { + Debug.Log("Open Anchor Window"); + WorldAnchorWindow.ShowWindow(worldStorageServer, worldStorageUser, UUID); + } + EditorGUILayout.EndHorizontal(); + } + EditorGUILayout.EndFoldoutHeaderGroup(); #endregion // ########################################################### @@ -323,8 +384,35 @@ namespace ETSI.ARF.WorldStorage.UI // Show list stringsProperty = so.FindProperty("links"); - EditorGUILayout.PropertyField(stringsProperty, /*new GUIContent("Trackbales"),*/ true); // True means show children - so.ApplyModifiedProperties(); // Remember to apply modified properties + //EditorGUILayout.PropertyField(stringsProperty, /*new GUIContent("Trackbales"),*/ true); // True means show children + //so.ApplyModifiedProperties(); // Remember to apply modified properties + + // New version with "Edit" button: + showListL = EditorGUILayout.BeginFoldoutHeaderGroup(showListL, "List of World Links"); + if (showListL) + for (int i = 0; i < stringsProperty.arraySize; i++) + { + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.PropertyField(stringsProperty.GetArrayElementAtIndex(i)); + //EditorGUILayout.PropertyField(list.GetArrayElementAtIndex(i), GUIContent.none); + + string UUID = WorldStorageWindow.GetUUIDFromString(stringsProperty.GetArrayElementAtIndex(i).stringValue); + if (UUID == null) UUID = links[i]; // try this + if (GUILayout.Button("-", EditorStyles.miniButtonLeft, miniButtonWidth)) + { + WorldLinkRequest.DeleteWorldLink(worldStorageServer, UUID); + WorldStorageWindowSingleton.GetWorldLinks(); + WorldStorageWindowSingleton.Repaint(); + } + if (GUILayout.Button("Edit...", EditorStyles.miniButtonLeft, buttonWidth)) + { + Debug.Log("Open Link Window"); + + WorldLinkWindow.ShowWindow(worldStorageServer, worldStorageUser, UUID); + } + EditorGUILayout.EndHorizontal(); + } + EditorGUILayout.EndFoldoutHeaderGroup(); #endregion // @@ -335,6 +423,15 @@ namespace ETSI.ARF.WorldStorage.UI // Get elements from current server // ########################################################### #region Helpers + static public string GetUUIDFromString(string text) + { + if (!text.Contains("[")) return null; + else + { + // extract the UUID + return text.Split('[', ']')[1]; + } + } public void GetCreators() { // Get all objects diff --git a/Packages/unity-world-storage-package b/Packages/unity-world-storage-package index c8406f18a9f789d4cc0eb2ef995d274797ea4051..688bf209c3e6d27d10782b2583b0e9c8edea15c7 160000 --- a/Packages/unity-world-storage-package +++ b/Packages/unity-world-storage-package @@ -1 +1 @@ -Subproject commit c8406f18a9f789d4cc0eb2ef995d274797ea4051 +Subproject commit 688bf209c3e6d27d10782b2583b0e9c8edea15c7 diff --git a/UserSettings/Layouts/default-2021.dwlt b/UserSettings/Layouts/default-2021.dwlt index 6b993581eb97b3f94815f457f48a585f369dd7c1..6907351018363e86654211cac90a32e8c0faacb0 100644 --- a/UserSettings/Layouts/default-2021.dwlt +++ b/UserSettings/Layouts/default-2021.dwlt @@ -14,10 +14,10 @@ MonoBehaviour: m_EditorClassIdentifier: m_PixelRect: serializedVersion: 2 - x: 96 - y: 157.33333 - width: 1308 - height: 787.11115 + x: 12.888889 + y: 72 + width: 1365.3334 + height: 935.11115 m_ShowMode: 4 m_Title: Inspector m_RootView: {fileID: 8} @@ -39,10 +39,10 @@ MonoBehaviour: m_Children: [] m_Position: serializedVersion: 2 - x: 517.7778 + x: 469.33334 y: 0 - width: 522.6667 - height: 291.7778 + width: 534.22217 + height: 350 m_MinSize: {x: 102, y: 121} m_MaxSize: {x: 4002, y: 4021} m_ActualView: {fileID: 20} @@ -68,13 +68,13 @@ MonoBehaviour: m_Position: serializedVersion: 2 x: 0 - y: 445.33334 - width: 1040.4445 - height: 291.7778 + y: 535.1111 + width: 1003.55554 + height: 350 m_MinSize: {x: 200, y: 100} m_MaxSize: {x: 16192, y: 8096} vertical: 0 - controlID: 127 + controlID: 73 --- !u!114 &4 MonoBehaviour: m_ObjectHideFlags: 52 @@ -94,12 +94,12 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 30 - width: 1308 - height: 737.11115 + width: 1365.3334 + height: 885.1111 m_MinSize: {x: 300, y: 200} m_MaxSize: {x: 24288, y: 16192} vertical: 0 - controlID: 76 + controlID: 156 --- !u!114 &5 MonoBehaviour: m_ObjectHideFlags: 52 @@ -115,10 +115,10 @@ MonoBehaviour: m_Children: [] m_Position: serializedVersion: 2 - x: 1040.4445 + x: 1003.55554 y: 0 - width: 267.55554 - height: 737.11115 + width: 361.77783 + height: 885.1111 m_MinSize: {x: 276, y: 71} m_MaxSize: {x: 4001, y: 4021} m_ActualView: {fileID: 16} @@ -143,8 +143,8 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 252.88889 - height: 445.33334 + width: 239.55556 + height: 535.1111 m_MinSize: {x: 201, y: 221} m_MaxSize: {x: 4001, y: 4021} m_ActualView: {fileID: 17} @@ -169,8 +169,8 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 517.7778 - height: 291.7778 + width: 469.33334 + height: 350 m_MinSize: {x: 231, y: 271} m_MaxSize: {x: 10001, y: 10021} m_ActualView: {fileID: 15} @@ -198,8 +198,8 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 1308 - height: 787.11115 + width: 1365.3334 + height: 935.1111 m_MinSize: {x: 875, y: 300} m_MaxSize: {x: 10000, y: 10000} m_UseTopView: 1 @@ -223,7 +223,7 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 1308 + width: 1365.3334 height: 30 m_MinSize: {x: 0, y: 0} m_MaxSize: {x: 0, y: 0} @@ -244,8 +244,8 @@ MonoBehaviour: m_Position: serializedVersion: 2 x: 0 - y: 767.11115 - width: 1308 + y: 915.1111 + width: 1365.3334 height: 20 m_MinSize: {x: 0, y: 0} m_MaxSize: {x: 0, y: 0} @@ -268,12 +268,12 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 1040.4445 - height: 737.11115 + width: 1003.55554 + height: 885.1111 m_MinSize: {x: 200, y: 200} m_MaxSize: {x: 16192, y: 16192} vertical: 1 - controlID: 65 + controlID: 72 --- !u!114 &12 MonoBehaviour: m_ObjectHideFlags: 52 @@ -293,12 +293,12 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 1040.4445 - height: 445.33334 + width: 1003.55554 + height: 535.1111 m_MinSize: {x: 200, y: 100} m_MaxSize: {x: 16192, y: 8096} vertical: 0 - controlID: 66 + controlID: 184 --- !u!114 &13 MonoBehaviour: m_ObjectHideFlags: 52 @@ -314,10 +314,10 @@ MonoBehaviour: m_Children: [] m_Position: serializedVersion: 2 - x: 252.88889 + x: 239.55556 y: 0 - width: 787.55554 - height: 445.33334 + width: 764 + height: 535.1111 m_MinSize: {x: 202, y: 221} m_MaxSize: {x: 4002, y: 4021} m_ActualView: {fileID: 18} @@ -375,10 +375,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 96 - y: 632.8889 - width: 516.7778 - height: 270.7778 + x: 12.888889 + y: 637.3333 + width: 468.33334 + height: 329 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -408,10 +408,10 @@ MonoBehaviour: m_LockTracker: m_IsLocked: 0 m_FolderTreeState: - scrollPos: {x: 0, y: 28.356365} - m_SelectedIDs: 664b0000 - m_LastClickedID: 19302 - m_ExpandedIDs: 000000004a4b00004c4b00004e4b0000504b0000524b0000544b0000564b000000ca9a3bffffff7f + scrollPos: {x: 0, y: 0} + m_SelectedIDs: 684b0000 + m_LastClickedID: 19304 + m_ExpandedIDs: 000000004c4b00004e4b0000504b0000524b0000544b0000564b0000584b000000ca9a3bffffff7f m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -439,7 +439,7 @@ MonoBehaviour: scrollPos: {x: 0, y: 0} m_SelectedIDs: m_LastClickedID: 0 - m_ExpandedIDs: 000000004a4b00004c4b00004e4b0000504b0000524b0000544b0000564b0000 + m_ExpandedIDs: 000000004c4b00004e4b0000504b0000524b0000544b0000564b0000584b0000 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -494,7 +494,7 @@ MonoBehaviour: m_ScrollPosition: {x: 0, y: 0} m_GridSize: 16 m_SkipHiddenPackages: 0 - m_DirectoriesAreaWidth: 257.8889 + m_DirectoriesAreaWidth: 248.11111 --- !u!114 &16 MonoBehaviour: m_ObjectHideFlags: 52 @@ -515,10 +515,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 1136.4445 - y: 187.55556 - width: 266.55554 - height: 716.11115 + x: 1016.44446 + y: 102.22222 + width: 360.77783 + height: 864.1111 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -556,10 +556,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 96 - y: 187.55556 - width: 251.88889 - height: 424.33334 + x: 12.888889 + y: 102.22222 + width: 238.55556 + height: 514.1111 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -567,7 +567,7 @@ MonoBehaviour: m_SceneHierarchy: m_TreeViewState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: 444b0000 + m_SelectedIDs: 464b0000 m_LastClickedID: 0 m_ExpandedIDs: 34fbffff m_RenameOverlay: @@ -613,10 +613,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 348.8889 - y: 187.55556 - width: 785.55554 - height: 424.33334 + x: 252.44444 + y: 102.22222 + width: 762 + height: 514.1111 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -681,9 +681,9 @@ MonoBehaviour: floating: 0 collapsed: 0 displayed: 1 - snapOffset: {x: 67.5, y: -190.44443} + snapOffset: {x: 67.5, y: 86} snapOffsetDelta: {x: 0, y: 0} - snapCorner: 2 + snapCorner: 0 id: Orientation index: 0 layout: 4 @@ -949,8 +949,8 @@ MonoBehaviour: vZoomLockedByDefault: 0 m_HBaseRangeMin: -766 m_HBaseRangeMax: 766 - m_VBaseRangeMin: -384.5 - m_VBaseRangeMax: 384.5 + m_VBaseRangeMin: -395 + m_VBaseRangeMax: 395 m_HAllowExceedBaseRangeMin: 1 m_HAllowExceedBaseRangeMax: 1 m_VAllowExceedBaseRangeMin: 1 @@ -967,11 +967,11 @@ MonoBehaviour: m_DrawArea: serializedVersion: 2 x: 0 - y: 21 + y: 0 width: 1532 - height: 769 + height: 790 m_Scale: {x: 1, y: 1} - m_Translation: {x: 766, y: 384.5} + m_Translation: {x: 766, y: 395} m_MarginLeft: 0 m_MarginRight: 0 m_MarginTop: 0 @@ -979,9 +979,9 @@ MonoBehaviour: m_LastShownAreaInsideMargins: serializedVersion: 2 x: -766 - y: -384.5 + y: -395 width: 1532 - height: 769 + height: 790 m_MinimalGUI: 1 m_defaultScale: 1 m_LastWindowPixelSize: {x: 3447, y: 1777.5} @@ -1010,10 +1010,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 613.7778 - y: 632.8889 - width: 520.6667 - height: 270.7778 + x: 482.22223 + y: 637.3333 + width: 532.22217 + height: 329 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default