diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFEdgeLink.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFEdgeLink.cs index 1f39c84b149e444f415e87761726a7f06fe368f1..d3b98fb31d48fe3635f780b01d80b8d4302feef4 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFEdgeLink.cs +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFEdgeLink.cs @@ -1,6 +1,25 @@ -using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows; +// +// ARF - Augmented Reality Framework (ETSI ISG ARF) +// +// Copyright 2022 ETSI +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Last change: July 2022 +// + +using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows; using Org.OpenAPITools.Model; -using UnityEditor; using UnityEditor.Experimental.GraphView; using UnityEngine; using UnityEngine.UIElements; @@ -13,17 +32,17 @@ namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Graph public string GUID; public ARFEdgeLink() { - var doubleClickManipulator = new Clickable(clicked); + var doubleClickManipulator = new Clickable(Clicked); doubleClickManipulator.activators.Clear(); doubleClickManipulator.activators.Add(new ManipulatorActivationFilter { button = MouseButton.LeftMouse, clickCount = 2 }); this.AddManipulator(doubleClickManipulator); - this.style.color = new Color(239, 239, 239); + style.color = new Color(239, 239, 239); } - public void clicked() + public void Clicked() { Debug.Log(worldLink.ToJson()); - NodeEditorWindow.ShowWindow(this); + GraphEditorWindow.ShowWindow(this); } } } \ No newline at end of file diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFGraphView.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFGraphView.cs index 6cd3ad9093b15a5d3633ee6b6c15408012b222b7..ee94e9b36219cb25ebe2f3f5cdf06e13f95b16f2 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFGraphView.cs +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFGraphView.cs @@ -15,14 +15,13 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// Last change: June 2022 +// Last change: July 2022 // + #define USING_OPENAPI_GENERATOR -using System.Collections; using System.Collections.Generic; #if USING_OPENAPI_GENERATOR -using Org.OpenAPITools.Api; using Org.OpenAPITools.Model; #else using IO.Swagger.Api; @@ -54,7 +53,6 @@ namespace ETSI.ARF.WorldStorage.UI this.AddManipulator(new ContentDragger()); this.AddManipulator(new SelectionDragger()); this.AddManipulator(new RectangleSelector()); - } //method called when an element is deleted from the graphview @@ -113,6 +111,8 @@ namespace ETSI.ARF.WorldStorage.UI } } } + + GraphEditorWindow.ResetWindow(); } public override void BuildContextualMenu(UnityEngine.UIElements.ContextualMenuPopulateEvent evt) @@ -125,9 +125,9 @@ namespace ETSI.ARF.WorldStorage.UI { if (ServerAndLocalDifferent() && EditorUtility.DisplayDialog("Saving node positions", "The World Graph has been modified. \nWould you like to push the modifications to the server ?", "Yes", "No")) { - saveInServer(); + SaveInServer(); } - reload(); + Reload(); SaveInfo.instance.toReFrame = true; }, (DropdownMenuAction a) => DropdownMenuAction.Status.Normal); evt.menu.AppendAction("Create Trackable", delegate @@ -135,31 +135,34 @@ namespace ETSI.ARF.WorldStorage.UI //generate the Trackables's attributes EncodingInformationStructure trackableEncodingInformation = new EncodingInformationStructure(EncodingInformationStructure.DataFormatEnum.OTHER, "0"); - List<float> localCRS = new List<float>(); - for (int i = 0; i < 16; i++) + List<float> localCRS = new(); + for (int i = 0; i < 15; i++) { localCRS.Add(0); } + localCRS.Add(1); - List<double> trackableSize = new List<double>(); + List<double> trackableSize = new(); for (int i = 0; i < 3; i++) { trackableSize.Add(0); } Trackable trackable = new Trackable(Guid.NewGuid(), "Defaulttrackable", Guid.Parse(worldStorageUser.UUID), Trackable.TrackableTypeEnum.OTHER, trackableEncodingInformation, new byte[64], localCRS, UnitSystem.CM, trackableSize, new Dictionary<string, List<string>>()); - createTrackableNode(trackable, actualGraphPosition.x, actualGraphPosition.y); + + selection.Clear(); + AddToSelection(CreateTrackableNode(trackable, actualGraphPosition.x, actualGraphPosition.y)); }, (DropdownMenuAction a) => DropdownMenuAction.Status.Normal); evt.menu.AppendAction("Create World Anchor", delegate { //generate the worldAnchor attributes - List<float> localCRS = new List<float>(); - for (int i = 0; i < 16; i++) + for (int i = 0; i < 15; i++) { localCRS.Add(0); } + localCRS.Add(1); List<double> worldAnchorSize = new List<double>(); for (int i = 0; i < 3; i++) @@ -168,7 +171,7 @@ namespace ETSI.ARF.WorldStorage.UI } WorldAnchor anchor = new WorldAnchor(Guid.NewGuid(), "DefaultWorldAnchor", Guid.Parse(worldStorageUser.UUID), localCRS, UnitSystem.CM, worldAnchorSize, new Dictionary<string, List<string>>()); - createAnchorNode(anchor, actualGraphPosition.x, actualGraphPosition.y); + CreateAnchorNode(anchor, actualGraphPosition.x, actualGraphPosition.y); }, (DropdownMenuAction a) => DropdownMenuAction.Status.Normal); evt.menu.AppendSeparator(); @@ -230,7 +233,7 @@ namespace ETSI.ARF.WorldStorage.UI return cPorts; } - public void paintWorldStorage() + public void PaintWorldStorage() { List<Trackable> trackables = TrackableRequest.GetAllTrackables(worldStorageServer); List<WorldAnchor> worldAnchors = WorldAnchorRequest.GetAllWorldAnchors(worldStorageServer); @@ -259,7 +262,7 @@ namespace ETSI.ARF.WorldStorage.UI } foreach (WorldLink worldLink in worldLinks) { - var portPair = getPortsFromWorldLink(worldLink); + var portPair = GetPortsFromWorldLink(worldLink); ARFEdgeLink edge = portPair.Key.ConnectTo<ARFEdgeLink>(portPair.Value); edge.worldLink = worldLink; edge.GUID = worldLink.UUID.ToString(); @@ -269,16 +272,17 @@ namespace ETSI.ARF.WorldStorage.UI } - internal void createTrackableNode(Trackable track, float posX, float posY) + internal ARFNodeTrackable CreateTrackableNode(Trackable track, float posX, float posY) { var tracknode = new ARFNodeTrackable(track); Rect pos = new Rect(RoundToNearestHalf(posX), RoundToNearestHalf(posY), 160, 77); tracknode.SetPosition(pos); AddElement(tracknode); + return tracknode; } - internal void createAnchorNode(WorldAnchor wa, float posX, float posY) + internal ARFNodeWorldAnchor CreateAnchorNode(WorldAnchor wa, float posX, float posY) { var waNode = new ARFNodeWorldAnchor(wa); @@ -286,27 +290,31 @@ namespace ETSI.ARF.WorldStorage.UI waNode.SetPosition(pos); AddElement(waNode); + return waNode; } - internal void createLink(WorldLink worldLink) + internal ARFEdgeLink CreateLink(WorldLink worldLink) { - var portPair = getPortsFromWorldLink(worldLink); + var portPair = GetPortsFromWorldLink(worldLink); ARFEdgeLink edge = portPair.Key.ConnectTo<ARFEdgeLink>(portPair.Value); edge.worldLink = worldLink; Debug.Log(worldLink.UUID.ToString()); edge.GUID = worldLink.UUID.ToString(); AddElement(edge); + return edge; } - public void reload() + public void Reload() { + GraphEditorWindow.ResetWindow(); DeleteElements(graphElements); - paintWorldStorage(); + SaveInfo.instance.InitNodePos(worldStorageServer, worldStorageUser); + PaintWorldStorage(); FrameAllElements(); } - public Dictionary<string, Rect> SavePositions() + public Dictionary<string, Rect> GetNodePositions() { Dictionary<string, Rect> ret = new Dictionary<string, Rect>(); foreach (ARFNode elem in nodes) @@ -316,7 +324,7 @@ namespace ETSI.ARF.WorldStorage.UI return ret; } - private KeyValuePair<Port, Port> getPortsFromWorldLink(WorldLink worldLink) + private KeyValuePair<Port, Port> GetPortsFromWorldLink(WorldLink worldLink) { var ret = new KeyValuePair<Port, Port>(); @@ -443,8 +451,31 @@ namespace ETSI.ARF.WorldStorage.UI } //Save all modified/deleted/added elements to the server - public void saveInServer() + public void SaveInServer() { + //DELETE ELEMENTS FROM THE SERVER + foreach (KeyValuePair<String, Type> elemToRemove in SaveInfo.instance.elemsToRemove) + { + string typeName = elemToRemove.Value.Name; + switch (typeName) + { + case nameof(Trackable): + TrackableRequest.DeleteTrackable(worldStorageServer, elemToRemove.Key); + break; + case nameof(WorldAnchor): + Debug.Log("delete worldanchor"); + WorldAnchorRequest.DeleteWorldAnchor(worldStorageServer, elemToRemove.Key); + break; + case nameof(WorldLink): + WorldLinkRequest.DeleteWorldLink(worldStorageServer, elemToRemove.Key); + break; + default: + Debug.Log("oops"); + break; + } + } + + //UPDATE AND ADD ELEMENTS foreach (ARFNode node in nodes) { if (!SaveInfo.instance.nodePositions.ContainsKey(node.GUID)) @@ -473,6 +504,7 @@ namespace ETSI.ARF.WorldStorage.UI } aRFNodeTrackable.trackable.UUID = Guid.Parse(uuid); aRFNodeTrackable.GUID = uuid; + aRFNodeTrackable.title = trackable.Name; } //POST WORLDANCHOR if (node is ARFNodeWorldAnchor aRFNodeWorldAnchor) @@ -499,6 +531,7 @@ namespace ETSI.ARF.WorldStorage.UI } aRFNodeWorldAnchor.worldAnchor.UUID = Guid.Parse(uuid); aRFNodeWorldAnchor.GUID = uuid; + aRFNodeWorldAnchor.title = worldAnchor.Name; } } else @@ -519,6 +552,7 @@ namespace ETSI.ARF.WorldStorage.UI trackable.KeyvalueTags["unityAuthoringPosX"] = posX; trackable.KeyvalueTags["unityAuthoringPosY"] = posY; TrackableRequest.UpdateTrackable(worldStorageServer, trackable); + aRFNodeTrackable.title = trackable.Name; } if (node is ARFNodeWorldAnchor aRFNodeWorldAnchor) { @@ -530,6 +564,7 @@ namespace ETSI.ARF.WorldStorage.UI worldAnchor.KeyvalueTags["unityAuthoringPosX"] = posX; worldAnchor.KeyvalueTags["unityAuthoringPosY"] = posY; WorldAnchorRequest.UpdateWorldAnchor(worldStorageServer, worldAnchor); + aRFNodeWorldAnchor.title = worldAnchor.Name; } } } @@ -554,27 +589,9 @@ namespace ETSI.ARF.WorldStorage.UI } } } - //DELETE ELEMENTS FROM THE SERVER - foreach (KeyValuePair<String, Type> elemToRemove in SaveInfo.instance.elemsToRemove) - { - string typeName = elemToRemove.Value.Name; - switch (typeName) - { - case nameof(Trackable): - TrackableRequest.DeleteTrackable(worldStorageServer, elemToRemove.Key); - break; - case nameof(WorldAnchor): - WorldAnchorRequest.DeleteWorldAnchor(worldStorageServer, elemToRemove.Key); - break; - case nameof(WorldLink): - WorldLinkRequest.DeleteWorldLink(worldStorageServer, elemToRemove.Key); - break; - default: - Debug.Log("oops"); - break; - } - } - SaveInfo.instance.initNodePos(worldStorageServer, worldStorageUser); + SaveInfo.instance.InitNodePos(worldStorageServer, worldStorageUser); + + GraphEditorWindow.ResetWindow(); } } } \ No newline at end of file diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNode.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNode.cs index fb3eb4e9d56ded0e5e164a43be766770573b83cf..900bac96f6ad6267541ed2025dbccfd33dbb5281 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNode.cs +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNode.cs @@ -15,18 +15,14 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// Last change: June 2022 +// Last change: July 2022 // + #define USING_OPENAPI_GENERATOR // alt. is Swagger -using System.Collections; -using System.Collections.Generic; -using UnityEngine; using UnityEditor; -using ETSI.ARF.WorldStorage.REST; #if USING_OPENAPI_GENERATOR -using Org.OpenAPITools.Api; using Org.OpenAPITools.Model; #else using IO.Swagger.Api; diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeTrackable.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeTrackable.cs index ebc1646a9bcde7ec56711cdb5ad6412e57cecc01..4b32dba05168bb0c37b3c3d0a031d41d4ead1b2a 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeTrackable.cs +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeTrackable.cs @@ -15,18 +15,14 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// Last change: June 2022 +// Last change: July 2022 // + #define USING_OPENAPI_GENERATOR // alt. is Swagger -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEditor; -using ETSI.ARF.WorldStorage.REST; #if USING_OPENAPI_GENERATOR -using Org.OpenAPITools.Api; using Org.OpenAPITools.Model; #else using IO.Swagger.Api; @@ -35,7 +31,6 @@ using IO.Swagger.Model; using UnityEngine.UIElements; using UnityEditor.Experimental.GraphView; using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows; -using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Graph; namespace ETSI.ARF.WorldStorage.UI { @@ -73,16 +68,16 @@ namespace ETSI.ARF.WorldStorage.UI RefreshPorts(); /*MANIPULATOR*/ - var doubleClickManipulator = new Clickable(clicked); + var doubleClickManipulator = new Clickable(Clicked); doubleClickManipulator.activators.Clear(); doubleClickManipulator.activators.Add(new ManipulatorActivationFilter { button = MouseButton.LeftMouse, clickCount = 2 }); this.AddManipulator(doubleClickManipulator); } - public void clicked() + public void Clicked() { - NodeEditorWindow.ShowWindow(this); - Debug.Log(trackable.ToString()); + Debug.Log(trackable.ToJson()); + GraphEditorWindow.ShowWindow(this); } public override ObjectType GetElemType() { diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeWorldAnchor.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeWorldAnchor.cs index 4c272f906ad305c1c2fca99208225bbc6519b8ba..e0a8672332cdd6be3557c41365d9efafb15e5604 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeWorldAnchor.cs +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeWorldAnchor.cs @@ -15,18 +15,14 @@ // See the License for the specific language governing permissions and // limitations under the License. // -// Last change: June 2022 +// Last change: July 2022 // + #define USING_OPENAPI_GENERATOR // alt. is Swagger -using System.Collections; -using System.Collections.Generic; using UnityEngine; -using UnityEditor; -using ETSI.ARF.WorldStorage.REST; #if USING_OPENAPI_GENERATOR -using Org.OpenAPITools.Api; using Org.OpenAPITools.Model; #else using IO.Swagger.Api; @@ -35,7 +31,6 @@ using IO.Swagger.Model; using UnityEngine.UIElements; using UnityEditor.Experimental.GraphView; using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows; -using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Graph; namespace ETSI.ARF.WorldStorage.UI { @@ -73,16 +68,15 @@ namespace ETSI.ARF.WorldStorage.UI RefreshPorts(); /*MANIPULATOR*/ - var doubleClickManipulator = new Clickable(clicked); + var doubleClickManipulator = new Clickable(Clicked); doubleClickManipulator.activators.Clear(); doubleClickManipulator.activators.Add(new ManipulatorActivationFilter { button = MouseButton.LeftMouse, clickCount = 2 }); this.AddManipulator(doubleClickManipulator); } - public void clicked() + public void Clicked() { - Debug.Log(worldAnchor.ToString()); - NodeEditorWindow.ShowWindow(this); + GraphEditorWindow.ShowWindow(this); } public override ObjectType GetElemType() { diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFPort.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFPort.cs index faa80776654773811633e56a7ce197debacc3a16..ef4338b3e1771258cbeb16beaea28e607c1bb6af 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFPort.cs +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFPort.cs @@ -1,11 +1,29 @@ -using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows; +// +// ARF - Augmented Reality Framework (ETSI ISG ARF) +// +// Copyright 2022 ETSI +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Last change: July 2022 +// + +using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows; using ETSI.ARF.WorldStorage.UI; using Org.OpenAPITools.Model; using System; using System.Collections.Generic; -using UnityEditor; using UnityEditor.Experimental.GraphView; -using UnityEngine; using UnityEngine.UIElements; namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Graph @@ -25,12 +43,13 @@ namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Graph if (edge is ARFEdgeLink aRFedge) { List<float> transform = new List<float>(); - for (int i = 0; i < 16; i++) + for (int i = 0; i < 15; i++) { transform.Add(0); } + transform.Add(1); - WorldLink worldLink = new WorldLink(Guid.NewGuid(), Guid.Parse(SaveInfo.instance.worldStorageUser.UUID), Guid.Parse(fromNode.GUID), Guid.Parse(toNode.GUID), fromNode.GetElemType(), toNode.GetElemType(), transform, UnitSystem.CM, new Dictionary<string, List<string>>()); + WorldLink worldLink = new(Guid.NewGuid(), Guid.Parse(SaveInfo.instance.worldStorageUser.UUID), Guid.Parse(fromNode.GUID), Guid.Parse(toNode.GUID), fromNode.GetElemType(), toNode.GetElemType(), transform, UnitSystem.CM, new Dictionary<string, List<string>>()); aRFedge.worldLink = worldLink; } } diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/GraphWindow.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/GraphWindow.cs deleted file mode 100644 index 8d70a34a0d72dd8522b941fe4fae238734c13921..0000000000000000000000000000000000000000 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/GraphWindow.cs +++ /dev/null @@ -1,396 +0,0 @@ -// -// ARF - Augmented Reality Framework (ETSI ISG ARF) -// -// Copyright 2022 ETSI -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Last change: June 2022 -// - -#define USING_OPENAPI_GENERATOR // alt. is Swagger - -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEditor; -using UnityEditor.Experimental.GraphView; -using UnityEngine.UIElements; -using UnityEditor.UIElements; -using ETSI.ARF.WorldStorage.REST; -using System; -using System.Threading.Tasks; -using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows; - -#if USING_OPENAPI_GENERATOR -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Model; -#else -using IO.Swagger.Api; -using IO.Swagger.Model; -#endif - - -//THIS CLASS IS GOING TO BE DELETED !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - -namespace ETSI.ARF.WorldStorage.UI -{ - - public class GraphWindow : EditorWindow - { - - static public GraphWindow graphWindowSingleton; - - string tempStorageUrl; - int tempStoragePort; - - [HideInInspector] public WorldStorageServer worldStorageServer; - [HideInInspector] public WorldStorageUser worldStorageUser; - - [SerializeField] public List<string> trackables = new List<string>(); - - private Color ori; - private GUIStyle gsTest; - - private ARFGraphView myGraph; - - [MenuItem("ARFWorldStorage/Graph Editor")] - public static void ShowWindow() - { - GetWindow<GraphWindow>("Menu Editor", true, typeof(SceneView)); - GraphWindow win = EditorWindow.GetWindow(typeof(GraphWindow), false, WorldStorageWindow.winName) as GraphWindow; - } - - public GraphWindow() - { - graphWindowSingleton = this; - } - - public void OnEnable() - { - Debug.Log("onEnable"); - //At unity launch - if (SaveInfo.instance.nodePositions == null) - { - initNodePos(); - } - - tempStorageUrl = this.worldStorageServer.basePath; - tempStoragePort = this.worldStorageServer.port; - ConstructGraphView(); - rootVisualElement.Add(GenerateToolbar()); - myGraph.StretchToParentSize(); - //top offset so that the graph does'nt overlap with the rest of the ui - myGraph.style.top = Length.Percent(11); - rootVisualElement.Add(myGraph); - } - - private void initNodePos() - { - - SaveInfo.instance.nodePositions = new Dictionary<string, Rect>(); - foreach (Trackable track in TrackableRequest.GetAllTrackables(worldStorageServer)) - { - if (track.KeyvalueTags.ContainsKey("unityAuthoringPosX") && track.KeyvalueTags.ContainsKey("unityAuthoringPosY")) - { - var posX = float.Parse(track.KeyvalueTags["unityAuthoringPosX"][0]); - var posY = float.Parse(track.KeyvalueTags["unityAuthoringPosY"][0]); - Rect trackPos = new Rect(posX, posY, 135, 77); - SaveInfo.instance.nodePositions[track.UUID.ToString()] = trackPos; - } - else - { - Rect trackPos = new Rect(0, 0, 135, 77); - SaveInfo.instance.nodePositions[track.UUID.ToString()] = trackPos; - } - } - foreach (WorldAnchor wa in WorldAnchorRequest.GetAllWorldAnchors(worldStorageServer)) - { - if (wa.KeyvalueTags.ContainsKey("unityAuthoringPosX") && wa.KeyvalueTags.ContainsKey("unityAuthoringPosY")) - { - var posX = float.Parse(wa.KeyvalueTags["unityAuthoringPosX"][0]); - var posY = float.Parse(wa.KeyvalueTags["unityAuthoringPosY"][0]); - Rect waPos = new Rect(posX, posY, 135, 77); - SaveInfo.instance.nodePositions[wa.UUID.ToString()] = waPos; - } - else - { - Rect trackPos = new Rect(0, 0, 135, 77); - SaveInfo.instance.nodePositions[wa.UUID.ToString()] = trackPos; - } - } - SaveInfo.instance.toReFrame = true; - } - - public void OnDisable() - { - if (positionshaveBeenChanged() && EditorUtility.DisplayDialog("Saving node positions", "The nodes positions have been changed, would you like to save them ?", "Yes", "No")) - { - SaveInfo.instance.nodePositions = myGraph.SavePositions(); - saveElemPositionsInServer(); - - } - //remove the toolbar - rootVisualElement.RemoveAt(0); - //remove the graph - rootVisualElement.Remove(myGraph); - - } - - private void saveElemPositionsInServer() - { - List<Trackable> trackables = TrackableRequest.GetAllTrackables(worldStorageServer); - List<WorldAnchor> anchors = WorldAnchorRequest.GetAllWorldAnchors(worldStorageServer); - foreach (Trackable serverTrack in trackables) - { - if (serverTrack.KeyvalueTags.ContainsKey("unityAuthoringPosX") && serverTrack.KeyvalueTags.ContainsKey("unityAuthoringPosY")) - { - float xLocal = SaveInfo.instance.nodePositions[serverTrack.UUID.ToString()].x; - float yLocal = SaveInfo.instance.nodePositions[serverTrack.UUID.ToString()].y; - float xServer = float.Parse(serverTrack.KeyvalueTags["unityAuthoringPosX"][0]); - float yServer = float.Parse(serverTrack.KeyvalueTags["unityAuthoringPosY"][0]); - if ((xLocal != xServer) && (yLocal != yServer)) - { - var posX = new List<String>(); - posX.Add(SaveInfo.instance.nodePositions[serverTrack.UUID.ToString()].x.ToString()); - serverTrack.KeyvalueTags["unityAuthoringPosX"] = posX; - var posY = new List<String>(); - posY.Add(SaveInfo.instance.nodePositions[serverTrack.UUID.ToString()].y.ToString()); - serverTrack.KeyvalueTags["unityAuthoringPosY"] = posY; - TrackableRequest.UpdateTrackable(worldStorageServer, serverTrack); - } - } - else - { - var posX = new List<String>(); - posX.Add(SaveInfo.instance.nodePositions[serverTrack.UUID.ToString()].x.ToString()); - serverTrack.KeyvalueTags["unityAuthoringPosX"] = posX; - var posY = new List<String>(); - posY.Add(SaveInfo.instance.nodePositions[serverTrack.UUID.ToString()].y.ToString()); - serverTrack.KeyvalueTags["unityAuthoringPosY"] = posY; - TrackableRequest.UpdateTrackable(worldStorageServer, serverTrack); - } - } - foreach (WorldAnchor serverWorldAnchor in anchors) - { - if (serverWorldAnchor.KeyvalueTags.ContainsKey("unityAuthoringPosX") && serverWorldAnchor.KeyvalueTags.ContainsKey("unityAuthoringPosY")) - { - float xLocal = SaveInfo.instance.nodePositions[serverWorldAnchor.UUID.ToString()].x; - float yLocal = SaveInfo.instance.nodePositions[serverWorldAnchor.UUID.ToString()].y; - float xServer = float.Parse(serverWorldAnchor.KeyvalueTags["unityAuthoringPosX"][0]); - float yServer = float.Parse(serverWorldAnchor.KeyvalueTags["unityAuthoringPosY"][0]); - if ((xLocal != xServer) && (yLocal != yServer)) - { - var posX = new List<String>(); - posX.Add(SaveInfo.instance.nodePositions[serverWorldAnchor.UUID.ToString()].x.ToString()); - serverWorldAnchor.KeyvalueTags["unityAuthoringPosX"] = posX; - var posY = new List<String>(); - posY.Add(SaveInfo.instance.nodePositions[serverWorldAnchor.UUID.ToString()].y.ToString()); - serverWorldAnchor.KeyvalueTags["unityAuthoringPosY"] = posY; - WorldAnchorRequest.UpdateWorldAnchor(worldStorageServer, serverWorldAnchor); - } - } - else - { - var posX = new List<String>(); - posX.Add(SaveInfo.instance.nodePositions[serverWorldAnchor.UUID.ToString()].x.ToString()); - serverWorldAnchor.KeyvalueTags["unityAuthoringPosX"] = posX; - var posY = new List<String>(); - posY.Add(SaveInfo.instance.nodePositions[serverWorldAnchor.UUID.ToString()].y.ToString()); - serverWorldAnchor.KeyvalueTags["unityAuthoringPosY"] = posY; - WorldAnchorRequest.UpdateWorldAnchor(worldStorageServer, serverWorldAnchor); - } - } - } - - internal void createTrackableNode(string uUID, float posX, float posY) - { - Trackable track = TrackableRequest.GetTrackable(worldStorageServer, uUID); - myGraph.createTrackableNode(track, posX, posY); - } - - internal void createAnchorNode(string uUID, float posX, float posY) - { - WorldAnchor wa = WorldAnchorRequest.GetWorldAnchor(worldStorageServer, uUID); - myGraph.createAnchorNode(wa, posX, posY); - } - - internal void createLink(string uUID) - { - WorldLink worldLink = WorldLinkRequest.GetWorldLink(worldStorageServer, uUID); - myGraph.createLink(worldLink); - } - - private Toolbar GenerateToolbar() - { - var toolbar = new Toolbar(); - - var createNodeT = new Button(clickEvent: () => { - TrackableWindow.ShowWindow(worldStorageServer, worldStorageUser); - TrackableWindow.winSingleton.nodePosX = 0; - TrackableWindow.winSingleton.nodePosY = 0; - }); - createNodeT.text = "Create Trackable"; - toolbar.Add(createNodeT); - - var createNodeWA = new Button(clickEvent: () => { - WorldAnchorWindow.ShowWindow(worldStorageServer, worldStorageUser); - WorldAnchorWindow.winSingleton.nodePosX = 0; - WorldAnchorWindow.winSingleton.nodePosY = 0; - }); - createNodeWA.text = "Create World Anchor"; - toolbar.Add(createNodeWA); - - toolbar.Add(new ToolbarSpacer() - { - flex = true - }); - - var reload = new Button(clickEvent: () => { - Reload(); - }) - { - text = "reload" - }; - toolbar.Add(reload); - - return toolbar; - } - - public void ConstructGraphView() - { - myGraph = new ARFGraphView - { - name = "ARF Graph", - worldStorageServer = worldStorageServer, - worldStorageUser = worldStorageUser - }; - myGraph.paintWorldStorage(); - SaveInfo.instance.toReFrame = true; - } - - private void OnValidate() - { - Debug.Log("validate"); - } - - - void OnGUI() - { - ori = GUI.backgroundColor; // remember ori color - - gsTest = new GUIStyle("window"); - gsTest.normal.textColor = WorldStorageWindow.arfColors[0]; - gsTest.fontStyle = FontStyle.Bold; - - EditorGUILayout.BeginVertical(); - EditorGUILayout.Space(24); - - - EditorGUI.BeginChangeCheck(); - worldStorageServer = (WorldStorageServer)EditorGUILayout.ObjectField("World Storage Server", worldStorageServer, typeof(WorldStorageServer), false, GUILayout.Width(500)); - if (EditorGUI.EndChangeCheck()) - { - OnDisable(); - initNodePos(); - OnEnable(); - //ConstructGraphView(); - } - - - /*EditorGUILayout.BeginHorizontal(); - tempStorageUrl = EditorGUILayout.TextField(tempStorageUrl); - EditorGUILayout.LabelField(":", GUILayout.ExpandWidth(false), GUILayout.Width(5)); - tempStoragePort = EditorGUILayout.IntField(tempStoragePort, GUILayout.ExpandWidth(false), GUILayout.Width(40)); - GUILayout.Space(5); - *//* if (GUILayout.Button("Change WorldStorage")) - { - ChangeWorldStorage(); - }*//* - GUILayout.FlexibleSpace(); - EditorGUILayout.EndHorizontal();*/ - - - GUI.contentColor = WorldStorageWindow.arfColors[1]; - WorldStorageWindow.DrawCopyright(); - if (SaveInfo.instance.toReFrame) - { - myGraph.FrameAllElements(); - SaveInfo.instance.toReFrame = false; - } - EditorGUILayout.EndVertical(); - } - - private void ChangeWorldStorage() - { - string[] guids1 = AssetDatabase.FindAssets("t:WorldStorageServer", null); - - foreach (string guid1 in guids1) - { - string path = AssetDatabase.GUIDToAssetPath(guid1); - WorldStorageServer server = AssetDatabase.LoadAssetAtPath(path, typeof(WorldStorageServer)) as WorldStorageServer; - if ((server.port == tempStoragePort)&&(server.basePath == tempStorageUrl)) - { - this.worldStorageServer = server; - myGraph.worldStorageServer = server; - } - else - { - WorldStorageServer newServer = (WorldStorageServer) ScriptableObject.CreateInstance(typeof(WorldStorageServer)); - newServer.basePath = tempStorageUrl; - } - } - } - - void Update() - { - } - - private bool positionshaveBeenChanged() - { - bool changed = false; - foreach(ARFNode node in myGraph.nodes) - { - float nodeX = node.GetPosition().x; - float nodeY = node.GetPosition().y; - float dataX = SaveInfo.instance.nodePositions[node.GUID].x; - float dataY = SaveInfo.instance.nodePositions[node.GUID].y; - if((nodeX != dataX) || (nodeY != dataY)) - { - changed = true; - return changed; - } - } - return changed; - } - - public void Reload() - { - if (positionshaveBeenChanged() && EditorUtility.DisplayDialog("Saving node positions", "The nodes positions have been changed, would you like to save them ?", "Yes", "No")) - { - SaveInfo.instance.nodePositions = myGraph.SavePositions(); - } - myGraph.reload(); - SaveInfo.instance.toReFrame = true; - } - - public void RefreshWithoutReframe() - { - if (positionshaveBeenChanged() && EditorUtility.DisplayDialog("Saving node positions", "The nodes positions have been changed, would you like to save them ?", "Yes", "No")) - { - SaveInfo.instance.nodePositions = myGraph.SavePositions(); - } - myGraph.reload(); - } - } -} \ No newline at end of file diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/GraphWindow.cs.meta b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/GraphWindow.cs.meta deleted file mode 100644 index 3634acd839d8126d8258b4f22e39afae60708461..0000000000000000000000000000000000000000 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/GraphWindow.cs.meta +++ /dev/null @@ -1,14 +0,0 @@ -fileFormatVersion: 2 -guid: 8dd64e8d8a545ab45b424402550b55a6 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: - - m_ViewDataDictionary: {instanceID: 0} - - worldStorageServer: {fileID: 11400000, guid: 3a9ba82f4e8dd124ca2b005861c64d01, type: 2} - - worldStorageUser: {fileID: 11400000, guid: c0696089e4a855b46ad490437919b1e8, type: 2} - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/WorldLinkListener.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/WorldLinkListener.cs index 79b691491118da7fa2910789ad10db351a5a79fe..eb0ab14f6905d6d8cd1decc39b3bccbf550eddfe 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/WorldLinkListener.cs +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/WorldLinkListener.cs @@ -1,13 +1,27 @@ -using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows; -using ETSI.ARF.WorldStorage; -using ETSI.ARF.WorldStorage.UI; -using Org.OpenAPITools.Model; -using System; +// +// ARF - Augmented Reality Framework (ETSI ISG ARF) +// +// Copyright 2022 ETSI +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Last change: July 2022 +// + +using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows; using System.Collections.Generic; -using UnityEditor; using UnityEditor.Experimental.GraphView; using UnityEngine; -using UnityEngine.UIElements; using static UnityEditor.Experimental.GraphView.Port; namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Graph @@ -70,12 +84,11 @@ namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Graph edge.input.Connect(item); edge.output.Connect(item); } - NodeEditorWindow.ShowWindow((ARFEdgeLink)edge); + GraphEditorWindow.ShowWindow((ARFEdgeLink)edge); } public void OnDropOutsidePort(Edge edge, Vector2 position) { - Debug.Log("OnDropOutsidePort"); } } } \ No newline at end of file diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/GraphEditorWindow.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/GraphEditorWindow.cs new file mode 100644 index 0000000000000000000000000000000000000000..49c5ed3ba029f605025487134e3ba9ef69a8d028 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/GraphEditorWindow.cs @@ -0,0 +1,1094 @@ +// +// ARF - Augmented Reality Framework (ETSI ISG ARF) +// +// Copyright 2022 ETSI +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Last change: July 2022 +// + +using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Graph; +using ETSI.ARF.WorldStorage.REST; +using ETSI.ARF.WorldStorage.UI; +using Org.OpenAPITools.Model; +using System; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows +{ + public class GraphEditorWindow : EditorWindow + { + public enum GraphEditorType + { + TRACKABLE, + WORLDANCHOR, + WORLDLINK, + NULL + } + + public GraphEditorType type; + + public ARFNodeTrackable trackableNode; + public ARFNodeWorldAnchor worldAnchorNode; + public ARFEdgeLink worldLinkEdge; + + public Trackable trackable; + public WorldAnchor worldAnchor; + public WorldLink worldLink; + + public Vector3 local_size; + public Vector3 local_rot; + public Vector3 local_pos; + + //test + string m_newKey = ""; + List<string> m_newValues = new List<string>(); + + // UI stuffs + private Vector2 scrollPos; + static public GraphEditorWindow winSingleton; + + public void OnEnable() + { + ResetWindow(); + } + + public static void ResetWindow() + { + Type inspectorType = Type.GetType("UnityEditor.InspectorWindow,UnityEditor.dll"); + winSingleton = GetWindow<GraphEditorWindow>("Element Editor", true, inspectorType); + winSingleton.trackable = null; + winSingleton.worldAnchor = null; + winSingleton.worldLink = null; + + winSingleton.trackableNode = null; + winSingleton.worldAnchorNode = null; + winSingleton.worldLinkEdge = null; + + winSingleton.local_size = Vector3.zero; + winSingleton.local_rot = Vector3.zero; + winSingleton.local_pos = Vector3.zero; + + winSingleton.type = GraphEditorType.NULL; + } + + public static void ShowWindow(ARFNodeTrackable trackableNode) + { + Type inspectorType = Type.GetType("UnityEditor.InspectorWindow,UnityEditor.dll"); + winSingleton = GetWindow<GraphEditorWindow>("Element Editor", true, inspectorType); + winSingleton.type = GraphEditorType.TRACKABLE; + + winSingleton.trackable = null; + winSingleton.worldAnchor = null; + winSingleton.worldLink = null; + + winSingleton.trackableNode = null; + winSingleton.worldAnchorNode = null; + winSingleton.worldLinkEdge = null; + + winSingleton.trackableNode = trackableNode; + winSingleton.trackable = trackableNode.trackable; + + winSingleton.local_size = new Vector3((float)winSingleton.trackable.TrackableSize[0], (float)winSingleton.trackable.TrackableSize[1], (float)winSingleton.trackable.TrackableSize[2]); + if (winSingleton.trackable.LocalCRS.Count == 16) + { + Matrix4x4 localCRS = new Matrix4x4(); + localCRS.m00 = winSingleton.trackable.LocalCRS[0]; localCRS.m01 = winSingleton.trackable.LocalCRS[1]; localCRS.m02 = winSingleton.trackable.LocalCRS[2]; localCRS.m03 = winSingleton.trackable.LocalCRS[3]; + localCRS.m10 = winSingleton.trackable.LocalCRS[4]; localCRS.m11 = winSingleton.trackable.LocalCRS[5]; localCRS.m12 = winSingleton.trackable.LocalCRS[6]; localCRS.m13 = winSingleton.trackable.LocalCRS[7]; + localCRS.m20 = winSingleton.trackable.LocalCRS[8]; localCRS.m21 = winSingleton.trackable.LocalCRS[9]; localCRS.m22 = winSingleton.trackable.LocalCRS[10]; localCRS.m23 = winSingleton.trackable.LocalCRS[11]; + localCRS.m30 = winSingleton.trackable.LocalCRS[12]; localCRS.m31 = winSingleton.trackable.LocalCRS[13]; localCRS.m32 = winSingleton.trackable.LocalCRS[14]; localCRS.m33 = winSingleton.trackable.LocalCRS[15]; + winSingleton.local_pos = localCRS.GetPosition(); + winSingleton.local_rot = localCRS.rotation.eulerAngles; + } + + } + + public static void ShowWindow(ARFNodeWorldAnchor worldAnchorNode) + { + Type inspectorType = Type.GetType("UnityEditor.InspectorWindow,UnityEditor.dll"); + winSingleton = GetWindow<GraphEditorWindow>("Element Editor", true, inspectorType); + winSingleton.type = GraphEditorType.WORLDANCHOR; + + winSingleton.trackable = null; + winSingleton.worldAnchor = null; + winSingleton.worldLink = null; + + winSingleton.trackableNode = null; + winSingleton.worldAnchorNode = null; + winSingleton.worldLinkEdge = null; + + winSingleton.worldAnchorNode = worldAnchorNode; + winSingleton.worldAnchor = worldAnchorNode.worldAnchor; + + winSingleton.local_size = new Vector3((float)winSingleton.worldAnchor.WorldAnchorSize[0], (float)winSingleton.worldAnchor.WorldAnchorSize[1], (float)winSingleton.worldAnchor.WorldAnchorSize[2]); + if (winSingleton.worldAnchor.LocalCRS.Count == 16) + { + Matrix4x4 localCRS = new Matrix4x4(); + localCRS.m00 = winSingleton.worldAnchor.LocalCRS[0]; localCRS.m01 = winSingleton.worldAnchor.LocalCRS[1]; localCRS.m02 = winSingleton.worldAnchor.LocalCRS[2]; localCRS.m03 = winSingleton.worldAnchor.LocalCRS[3]; + localCRS.m10 = winSingleton.worldAnchor.LocalCRS[4]; localCRS.m11 = winSingleton.worldAnchor.LocalCRS[5]; localCRS.m12 = winSingleton.worldAnchor.LocalCRS[6]; localCRS.m13 = winSingleton.worldAnchor.LocalCRS[7]; + localCRS.m20 = winSingleton.worldAnchor.LocalCRS[8]; localCRS.m21 = winSingleton.worldAnchor.LocalCRS[9]; localCRS.m22 = winSingleton.worldAnchor.LocalCRS[10]; localCRS.m23 = winSingleton.worldAnchor.LocalCRS[11]; + localCRS.m30 = winSingleton.worldAnchor.LocalCRS[12]; localCRS.m31 = winSingleton.worldAnchor.LocalCRS[13]; localCRS.m32 = winSingleton.worldAnchor.LocalCRS[14]; localCRS.m33 = winSingleton.worldAnchor.LocalCRS[15]; + winSingleton.local_pos = localCRS.GetPosition(); + winSingleton.local_rot = localCRS.rotation.eulerAngles; + } + } + + public static void ShowWindow(ARFEdgeLink graphEdge) + { + Type inspectorType = Type.GetType("UnityEditor.InspectorWindow,UnityEditor.dll"); + winSingleton = GetWindow<GraphEditorWindow>("Element Editor", true, inspectorType); + winSingleton.type = GraphEditorType.WORLDLINK; + + winSingleton.trackable = null; + winSingleton.worldAnchor = null; + winSingleton.worldLink = null; + + winSingleton.trackableNode = null; + winSingleton.worldAnchorNode = null; + winSingleton.worldLinkEdge = null; + + winSingleton.worldLinkEdge = graphEdge; + winSingleton.worldLink = graphEdge.worldLink; + + if (winSingleton.worldLink.Transform.Count == 16) + { + Matrix4x4 localCRS = new Matrix4x4(); + localCRS.m00 = winSingleton.worldLink.Transform[0]; localCRS.m01 = winSingleton.worldLink.Transform[1]; localCRS.m02 = winSingleton.worldLink.Transform[2]; localCRS.m03 = winSingleton.worldLink.Transform[3]; + localCRS.m10 = winSingleton.worldLink.Transform[4]; localCRS.m11 = winSingleton.worldLink.Transform[5]; localCRS.m12 = winSingleton.worldLink.Transform[6]; localCRS.m13 = winSingleton.worldLink.Transform[7]; + localCRS.m20 = winSingleton.worldLink.Transform[8]; localCRS.m21 = winSingleton.worldLink.Transform[9]; localCRS.m22 = winSingleton.worldLink.Transform[10]; localCRS.m23 = winSingleton.worldLink.Transform[11]; + localCRS.m30 = winSingleton.worldLink.Transform[12]; localCRS.m31 = winSingleton.worldLink.Transform[13]; localCRS.m32 = winSingleton.worldLink.Transform[14]; localCRS.m33 = winSingleton.worldLink.Transform[15]; + winSingleton.local_pos = localCRS.GetPosition(); + winSingleton.local_rot = localCRS.rotation.eulerAngles; + } + } + + public void OnGUI() + { + + scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.ExpandWidth(true)); + + switch (type) + { + case GraphEditorType.WORLDLINK: + BuildWorldLinkUI(); + break; + case GraphEditorType.TRACKABLE: + BuildTrackableUI(); + break; + case GraphEditorType.WORLDANCHOR: + BuildWorldAnchorUI(); + break; + default: + break; + } + + EditorGUILayout.EndScrollView(); + } + + //BUILD UI FOR MODIYING THE WORLDANCHOR + private void BuildWorldAnchorUI() + { + if(worldAnchor != null) { + + // + //HEADER + // + + //anchor icon + EditorGUILayout.BeginHorizontal(); + Texture anchorImage = (Texture)AssetDatabase.LoadAssetAtPath("Assets/ETSI.ARF/ARF World Storage API/Images/anchor.png", typeof(Texture)); + GUI.backgroundColor = Color.clear; + GUILayout.Box(anchorImage, GUILayout.Width(40), GUILayout.Height(40)); + + //anchor label + EditorGUILayout.BeginVertical(GUILayout.Height(50)); + GUILayout.FlexibleSpace(); + EditorGUILayout.LabelField("WORLD ANCHOR", EditorStyles.boldLabel); + GUILayout.FlexibleSpace(); + EditorGUILayout.EndVertical(); + EditorGUILayout.EndHorizontal(); + + //separator line + var rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(40)); + DrawUILine(new Color(0.76f, 0.9f, 0.46f, 0.9f), 5, 5); + EditorGUILayout.EndHorizontal(); + + // + //ELEMENT PARAMETERS + // + + EditorGUI.BeginChangeCheck(); + + //uuid + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("UUID : ", EditorStyles.boldLabel, GUILayout.Width(50)); + if (!SaveInfo.instance.nodePositions.ContainsKey(worldAnchor.UUID.ToString())) + { + EditorGUILayout.LabelField("none Yet"); + } + else + { + EditorGUILayout.SelectableLabel(worldAnchor.UUID.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); + } + EditorGUILayout.EndHorizontal(); + + //name + EditorGUILayout.BeginHorizontal(); + EditorGUI.BeginChangeCheck(); + EditorGUILayout.LabelField("NAME : ", EditorStyles.boldLabel, GUILayout.Width(50)); + worldAnchor.Name = EditorGUILayout.DelayedTextField(worldAnchor.Name); + if (EditorGUI.EndChangeCheck()) + { + worldAnchorNode.title = worldAnchor.Name; + } + EditorGUILayout.EndHorizontal(); + + //unit system + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("UNIT : ", EditorStyles.boldLabel, GUILayout.Width(50)); + worldAnchor.Unit = (UnitSystem)EditorGUILayout.EnumPopup(worldAnchor.Unit); + EditorGUILayout.EndHorizontal(); + + //size + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("SIZE : ", EditorStyles.boldLabel, GUILayout.Width(50)); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("X", GUILayout.Width(15)); + local_size[0] = EditorGUILayout.DelayedFloatField(local_size[0]); + EditorGUILayout.LabelField("Y", GUILayout.Width(15)); + local_size[1] = EditorGUILayout.DelayedFloatField(local_size[1]); + EditorGUILayout.LabelField("Z", GUILayout.Width(15)); + local_size[2] = EditorGUILayout.DelayedFloatField(local_size[2]); + EditorGUILayout.EndHorizontal(); + + //localCRS + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("LOCAL CRS : ", EditorStyles.boldLabel); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.LabelField("position : "); + //position + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("X", GUILayout.Width(15)); + local_pos[0] = EditorGUILayout.DelayedFloatField(local_pos[0]); + EditorGUILayout.LabelField("Y", GUILayout.Width(15)); + local_pos[1] = EditorGUILayout.DelayedFloatField(local_pos[1]); + EditorGUILayout.LabelField("Z", GUILayout.Width(15)); + local_pos[2] = EditorGUILayout.DelayedFloatField(local_pos[2]); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.LabelField("rotation : "); + //rotation + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("X", GUILayout.Width(15)); + local_rot[0] = EditorGUILayout.DelayedFloatField(local_rot[0]); + EditorGUILayout.LabelField("Y", GUILayout.Width(15)); + local_rot[1] = EditorGUILayout.DelayedFloatField(local_rot[1]); + EditorGUILayout.LabelField("Z", GUILayout.Width(15)); + local_rot[2] = EditorGUILayout.DelayedFloatField(local_rot[2]); + EditorGUILayout.EndHorizontal(); + + //keyvaluetags=================================================================================================TOBEMODIFIED + EditorGUILayout.BeginHorizontal(); + GUILayout.Label("TAGS : ", EditorStyles.boldLabel); + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.BeginVertical(); + Dictionary<string, List<string>> tempPairs = worldAnchor.KeyvalueTags; + EditorGUILayout.BeginHorizontal(); + m_newKey = GUILayout.TextField(m_newKey, GUILayout.Width(300)); + if (GUILayout.Button("Add Key")) + { + if (m_newKey != "") + { + List<string> emptyList = new List<string>(); + worldAnchor.KeyvalueTags.Add(m_newKey, emptyList); + m_newKey = ""; + } + } + GUILayout.FlexibleSpace(); + EditorGUILayout.EndHorizontal(); + //iterator on m_newValues + int j = 0; + foreach (KeyValuePair<string, List<string>> entry in tempPairs) + { + DrawUILine(Color.gray, 1, 1); + EditorGUILayout.BeginHorizontal(); + GUILayout.Label(entry.Key); + GUILayout.FlexibleSpace(); + if (GUILayout.Button("x", GUILayout.Width(18), GUILayout.Height(18))) + { + worldAnchor.KeyvalueTags.Remove(entry.Key); + m_newValues[j] = ""; + } + EditorGUILayout.EndHorizontal(); + + + EditorGUILayout.BeginHorizontal(); + List<string> tempValues = entry.Value; + foreach (string value in tempValues) + { + GUILayout.Label(value); + + if (GUILayout.Button("x", GUILayout.Width(18), GUILayout.Height(18))) + { + tempValues.Remove(value); + worldAnchor.KeyvalueTags[entry.Key] = tempValues; + } + } + GUILayout.FlexibleSpace(); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.BeginHorizontal(); + if (m_newValues.Count < j + 1) + { + string value = ""; + m_newValues.Add(value); + } + m_newValues[j] = GUILayout.TextField(m_newValues[j], GUILayout.Width(200)); + if (GUILayout.Button("Add Value")) + { + if (m_newValues[j] != "") + { + List<string> valueList = entry.Value; + valueList.Add(m_newValues[j]); + worldAnchor.KeyvalueTags[entry.Key] = valueList; + m_newValues[j] = ""; + } + } + GUILayout.FlexibleSpace(); + EditorGUILayout.EndHorizontal(); + + j++; + } + EditorGUILayout.EndVertical(); + //keyvaluetags=================================================================================================TOBEMODIFIED + + + //Actions when the ui fields have been changed + if (EditorGUI.EndChangeCheck()) + { + // + Matrix4x4 localCRS = Matrix4x4.TRS(local_pos, Quaternion.Euler(local_rot), Vector3.one); + List<float> localCRSasFloat = new List<float> + { + localCRS.m00, localCRS.m01, localCRS.m02, localCRS.m03, + localCRS.m10, localCRS.m11, localCRS.m12, localCRS.m13, + localCRS.m20, localCRS.m21, localCRS.m22, localCRS.m23, + localCRS.m30, localCRS.m31, localCRS.m32, localCRS.m33, + }; + worldAnchor.LocalCRS = localCRSasFloat; + + List<double> localSizeAsFloat = new List<double> + { + local_size.x, local_size.y, local_size.z + }; + worldAnchor.WorldAnchorSize = localSizeAsFloat; + + if (SaveInfo.instance.nodePositions.ContainsKey(worldAnchor.UUID.ToString()) && (!SaveInfo.instance.elemsToUpdate.Contains(worldAnchor.UUID.ToString()))) + { + SaveInfo.instance.elemsToUpdate.Add(worldAnchor.UUID.ToString()); + } + } + + // + //FOOTER + // + GUILayout.FlexibleSpace(); + EditorGUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + //reset button + if (GUILayout.Button("Reset")) + { + //lose focus of fields otherwise the selected field won't updaate + EditorGUI.FocusTextInControl(null); + if (SaveInfo.instance.nodePositions.ContainsKey(worldAnchor.UUID.ToString())) + { + if (SaveInfo.instance.elemsToUpdate.Contains(worldAnchor.UUID.ToString()) && EditorUtility.DisplayDialog("Reset elements", "Are you sure you want to lose all your changes ?", "Yes", "No")) + { + worldAnchor = WorldAnchorRequest.GetWorldAnchor(SaveInfo.instance.worldStorageServer, worldAnchor.UUID.ToString()); + worldAnchorNode.worldAnchor = worldAnchor; + ShowWindow(worldAnchorNode); + } + } + else + { + if (EditorUtility.DisplayDialog("Reset elements", "Are you sure you want to lose all your changes ?", "Yes", "No")) + { + //generate the worldAnchor attributes + List<float> localCRS = new List<float>(); + for (int i = 0; i < 15; i++) + { + localCRS.Add(0); + } + localCRS.Add(1); + + List<double> worldAnchorSize = new List<double>(); + for (int i = 0; i < 3; i++) + { + worldAnchorSize.Add(0); + } + worldAnchor = new WorldAnchor(Guid.NewGuid(), "DefaultWorldAnchor", Guid.Parse(SaveInfo.instance.worldStorageUser.UUID), localCRS, UnitSystem.CM, worldAnchorSize, new Dictionary<string, List<string>>()); + worldAnchorNode.worldAnchor = worldAnchor; + ShowWindow(worldAnchorNode); + } + } + } + //delete button + if (GUILayout.Button("Delete")) + { + if (EditorUtility.DisplayDialog("Deleting elements", "Are you sure you want to delete this element ?", "Yes", "No")) + { + if (SaveInfo.instance.nodePositions.ContainsKey(worldAnchor.UUID.ToString())) + { + SaveInfo.instance.elemsToRemove.Add(worldAnchor.UUID.ToString(), typeof(WorldAnchor)); + } + var window = GetWindow<WorldGraphWindow>(); + window.DeleteNode(worldAnchorNode); + ResetWindow(); + } + } + //save button + if (GUILayout.Button("Save")) + { + if (SaveInfo.instance.nodePositions.ContainsKey(worldAnchor.UUID.ToString())) + { + if (SaveInfo.instance.elemsToUpdate.Contains(worldAnchor.UUID.ToString())) + { + if (EditorUtility.DisplayDialog("Saving element", "Are you sure you want to save this element in the server ?", "Yes", "No")) + { + WorldAnchorRequest.UpdateWorldAnchor(SaveInfo.instance.worldStorageServer, worldAnchor); + SaveInfo.instance.elemsToUpdate.Remove(worldAnchor.UUID.ToString()); + } + } + } + else + { + if (EditorUtility.DisplayDialog("Saving element", "Are you sure you want to save this element's informations to the server ?", "Yes", "No")) + { + var posX = new List<String>(); + posX.Add(worldAnchorNode.GetPosition().x.ToString()); + var posY = new List<String>(); + posY.Add(worldAnchorNode.GetPosition().y.ToString()); + WorldAnchor worldAnchor = worldAnchorNode.worldAnchor; + worldAnchor.KeyvalueTags["unityAuthoringPosX"] = posX; + worldAnchor.KeyvalueTags["unityAuthoringPosY"] = posY; + + String uuid = WorldAnchorRequest.AddWorldAnchor(SaveInfo.instance.worldStorageServer, worldAnchor); + + //change the uuid in its edges, if there is a new edge to be added in the world storage it needs to have the correct uuid + uuid = uuid.Replace("\"", ""); + foreach (ARFEdgeLink edge in worldAnchorNode.portIn.connections) + { + edge.worldLink.UUIDTo = Guid.Parse(uuid); + } + foreach (ARFEdgeLink edge in worldAnchorNode.portOut.connections) + { + edge.worldLink.UUIDFrom = Guid.Parse(uuid); + } + worldAnchorNode.worldAnchor.UUID = Guid.Parse(uuid); + worldAnchorNode.GUID = uuid; + worldAnchorNode.title = worldAnchor.Name; + + //Add the newly saved World Anchor to the SaveInfo singleton + Rect trackPos = new(worldAnchorNode.GetPosition().x, worldAnchorNode.GetPosition().y, 135, 77); + SaveInfo.instance.nodePositions[uuid] = trackPos; + } + } + } + GUILayout.Space(10); + EditorGUILayout.EndHorizontal(); + GUILayout.Space(10); + + + } + } + + private void BuildTrackableUI() + { + if (trackable != null) + { + // + //HEADER + // + + //trackable icon + EditorGUILayout.BeginHorizontal(); + Texture trackImage = (Texture)AssetDatabase.LoadAssetAtPath("Assets/ETSI.ARF/ARF World Storage API/Images/trackable.png", typeof(Texture)); + GUI.backgroundColor = Color.clear; + GUILayout.Box(trackImage, GUILayout.Width(40), GUILayout.Height(40)); + + //trackable label + EditorGUILayout.BeginVertical(GUILayout.Height(50)); + GUILayout.FlexibleSpace(); + EditorGUILayout.LabelField("TRACKABLE", EditorStyles.boldLabel); + GUILayout.FlexibleSpace(); + EditorGUILayout.EndVertical(); + EditorGUILayout.EndHorizontal(); + + //separator line + var rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(40)); + DrawUILine(new Color(0.9f, 0.78f, 0.54f, 0.9f), 5, 5); + EditorGUILayout.EndHorizontal(); + + // + //ELEMENT PARAMETERS + // + + EditorGUI.BeginChangeCheck(); + + //uuid + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("UUID : ", EditorStyles.boldLabel, GUILayout.Width(50)); + if (!SaveInfo.instance.nodePositions.ContainsKey(trackable.UUID.ToString())) + { + EditorGUILayout.LabelField("none Yet"); + } + else + { + EditorGUILayout.SelectableLabel(trackable.UUID.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); + } + EditorGUILayout.EndHorizontal(); + + //name + EditorGUILayout.BeginHorizontal(); + EditorGUI.BeginChangeCheck(); + EditorGUILayout.LabelField("NAME : ", EditorStyles.boldLabel, GUILayout.Width(50)); + trackable.Name = EditorGUILayout.DelayedTextField(trackable.Name); + if (EditorGUI.EndChangeCheck()) + { + trackableNode.title = trackable.Name; + } + EditorGUILayout.EndHorizontal(); + + //unit system + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("UNIT : ", EditorStyles.boldLabel, GUILayout.Width(50)); + trackable.Unit = (UnitSystem)EditorGUILayout.EnumPopup(trackable.Unit); + EditorGUILayout.EndHorizontal(); + + //size + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("SIZE : ", EditorStyles.boldLabel, GUILayout.Width(50)); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("X", GUILayout.Width(15)); + local_size[0] = EditorGUILayout.DelayedFloatField(local_size[0]); + EditorGUILayout.LabelField("Y", GUILayout.Width(15)); + local_size[1] = EditorGUILayout.DelayedFloatField(local_size[1]); + EditorGUILayout.LabelField("Z", GUILayout.Width(15)); + local_size[2] = EditorGUILayout.DelayedFloatField(local_size[2]); + EditorGUILayout.EndHorizontal(); + + //localCRS + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("LOCAL CRS : ", EditorStyles.boldLabel); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.LabelField("position : "); + //position + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("X", GUILayout.Width(15)); + local_pos[0] = EditorGUILayout.DelayedFloatField(local_pos[0]); + EditorGUILayout.LabelField("Y", GUILayout.Width(15)); + local_pos[1] = EditorGUILayout.DelayedFloatField(local_pos[1]); + EditorGUILayout.LabelField("Z", GUILayout.Width(15)); + local_pos[2] = EditorGUILayout.DelayedFloatField(local_pos[2]); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.LabelField("rotation : "); + //rotation + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("X", GUILayout.Width(15)); + local_rot[0] = EditorGUILayout.DelayedFloatField(local_rot[0]); + EditorGUILayout.LabelField("Y", GUILayout.Width(15)); + local_rot[1] = EditorGUILayout.DelayedFloatField(local_rot[1]); + EditorGUILayout.LabelField("Z", GUILayout.Width(15)); + local_rot[2] = EditorGUILayout.DelayedFloatField(local_rot[2]); + EditorGUILayout.EndHorizontal(); + + //encodingInofrmation + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("TRACKABLE INFORMATION : ", EditorStyles.boldLabel); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("Format : ", GUILayout.Width(50)); + trackable.TrackableEncodingInformation.DataFormat = (EncodingInformationStructure.DataFormatEnum)EditorGUILayout.EnumPopup(trackable.TrackableEncodingInformation.DataFormat); + EditorGUILayout.LabelField("Version : ", GUILayout.Width(50)); + float floatVersion = EditorGUILayout.DelayedFloatField(float.Parse(trackable.TrackableEncodingInformation._Version)); + trackable.TrackableEncodingInformation._Version = floatVersion.ToString(); + EditorGUILayout.EndHorizontal(); + + //trackable payload + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("TRACKABLE PAYLOAD : ", EditorStyles.boldLabel, GUILayout.Width(140)); + EditorGUILayout.LabelField("==============================================================================="); + EditorGUILayout.EndHorizontal(); + + //keyvaluetags=================================================================================================TOBEMODIFIED + EditorGUILayout.BeginHorizontal(); + GUILayout.Label("TAGS : ", EditorStyles.boldLabel); + EditorGUILayout.EndHorizontal(); + + EditorGUILayout.BeginVertical(); + Dictionary<string, List<string>> tempPairs = trackable.KeyvalueTags; + EditorGUILayout.BeginHorizontal(); + m_newKey = GUILayout.TextField(m_newKey, GUILayout.Width(300)); + if (GUILayout.Button("Add Key")) + { + if (m_newKey != "") + { + List<string> emptyList = new List<string>(); + trackable.KeyvalueTags.Add(m_newKey, emptyList); + m_newKey = ""; + } + } + GUILayout.FlexibleSpace(); + EditorGUILayout.EndHorizontal(); + //iterator on m_newValues + int j = 0; + foreach (KeyValuePair<string, List<string>> entry in tempPairs) + { + DrawUILine(Color.gray, 1, 1); + EditorGUILayout.BeginHorizontal(); + GUILayout.Label(entry.Key); + GUILayout.FlexibleSpace(); + if (GUILayout.Button("x", GUILayout.Width(18), GUILayout.Height(18))) + { + trackable.KeyvalueTags.Remove(entry.Key); + m_newValues[j] = ""; + } + EditorGUILayout.EndHorizontal(); + + + EditorGUILayout.BeginHorizontal(); + List<string> tempValues = entry.Value; + foreach (string value in tempValues) + { + GUILayout.Label(value); + + if (GUILayout.Button("x", GUILayout.Width(18), GUILayout.Height(18))) + { + tempValues.Remove(value); + trackable.KeyvalueTags[entry.Key] = tempValues; + } + } + GUILayout.FlexibleSpace(); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.BeginHorizontal(); + if (m_newValues.Count < j + 1) + { + string value = ""; + m_newValues.Add(value); + } + m_newValues[j] = GUILayout.TextField(m_newValues[j], GUILayout.Width(200)); + if (GUILayout.Button("Add Value")) + { + if (m_newValues[j] != "") + { + List<string> valueList = entry.Value; + valueList.Add(m_newValues[j]); + trackable.KeyvalueTags[entry.Key] = valueList; + m_newValues[j] = ""; + } + } + GUILayout.FlexibleSpace(); + EditorGUILayout.EndHorizontal(); + + j++; + } + EditorGUILayout.EndVertical(); + //keyvaluetags=================================================================================================TOBEMODIFIED + + + //Actions when the ui fields have been changed + if (EditorGUI.EndChangeCheck()) + { + // + Matrix4x4 localCRS = Matrix4x4.TRS(local_pos, Quaternion.Euler(local_rot), Vector3.one); + List<float> localCRSasFloat = new List<float> + { + localCRS.m00, localCRS.m01, localCRS.m02, localCRS.m03, + localCRS.m10, localCRS.m11, localCRS.m12, localCRS.m13, + localCRS.m20, localCRS.m21, localCRS.m22, localCRS.m23, + localCRS.m30, localCRS.m31, localCRS.m32, localCRS.m33, + }; + trackable.LocalCRS = localCRSasFloat; + + List<double> localSizeAsFloat = new List<double> + { + local_size.x, local_size.y, local_size.z + }; + trackable.TrackableSize = localSizeAsFloat; + + if (SaveInfo.instance.nodePositions.ContainsKey(trackable.UUID.ToString()) && (!SaveInfo.instance.elemsToUpdate.Contains(trackable.UUID.ToString()))) + { + SaveInfo.instance.elemsToUpdate.Add(trackable.UUID.ToString()); + } + } + + // + //FOOTER + // + GUILayout.FlexibleSpace(); + EditorGUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + //reset button + if (GUILayout.Button("Reset")) + { + //lose focus of fields otherwise the selected field won't updaate + EditorGUI.FocusTextInControl(null); + if (SaveInfo.instance.nodePositions.ContainsKey(trackable.UUID.ToString())) + { + if (SaveInfo.instance.elemsToUpdate.Contains(trackable.UUID.ToString()) && EditorUtility.DisplayDialog("Reset elements", "Are you sure you want to lose all your changes ?", "Yes", "No")) + { + trackable = TrackableRequest.GetTrackable(SaveInfo.instance.worldStorageServer, trackable.UUID.ToString()); + trackableNode.trackable = trackable; + ShowWindow(trackableNode); + } + } + else + { + if (EditorUtility.DisplayDialog("Reset elements", "Are you sure you want to lose all your changes ?", "Yes", "No")) + { + //generate the Trackables's attributes + EncodingInformationStructure trackableEncodingInformation = new EncodingInformationStructure(EncodingInformationStructure.DataFormatEnum.OTHER, "0"); + + List<float> localCRS = new(); + for (int i = 0; i < 15; i++) + { + localCRS.Add(0); + } + localCRS.Add(1); + + List<double> trackableSize = new(); + for (int i = 0; i < 3; i++) + { + trackableSize.Add(0); + } + + Trackable trackable = new Trackable(Guid.NewGuid(), "Defaulttrackable", Guid.Parse(SaveInfo.instance.worldStorageUser.UUID), Trackable.TrackableTypeEnum.OTHER, trackableEncodingInformation, new byte[64], localCRS, UnitSystem.CM, trackableSize, new Dictionary<string, List<string>>()); + trackableNode.trackable = trackable; + ShowWindow(trackableNode); + } + } + } + //delete button + if (GUILayout.Button("Delete")) + { + if (EditorUtility.DisplayDialog("Deleting elements", "Are you sure you want to delete this element ?", "Yes", "No")) + { + if (SaveInfo.instance.nodePositions.ContainsKey(trackable.UUID.ToString())) + { + SaveInfo.instance.elemsToRemove.Add(trackable.UUID.ToString(), typeof(Trackable)); + } + var window = GetWindow<WorldGraphWindow>(); + window.DeleteNode(trackableNode); + ResetWindow(); + } + } + //save button + if (GUILayout.Button("Save")) + { + if (SaveInfo.instance.nodePositions.ContainsKey(trackable.UUID.ToString())) + { + if (SaveInfo.instance.elemsToUpdate.Contains(trackable.UUID.ToString())) + { + if (EditorUtility.DisplayDialog("Saving element", "Are you sure you want to save this element in the server ?", "Yes", "No")) + { + TrackableRequest.UpdateTrackable(SaveInfo.instance.worldStorageServer, trackable); + SaveInfo.instance.elemsToUpdate.Remove(trackable.UUID.ToString()); + } + } + } + else + { + if (EditorUtility.DisplayDialog("Saving element", "Are you sure you want to save this element's informations to the server ?", "Yes", "No")) + { + var posX = new List<String>(); + posX.Add(trackableNode.GetPosition().x.ToString()); + var posY = new List<String>(); + posY.Add(trackableNode.GetPosition().y.ToString()); + Trackable trackable = trackableNode.trackable; + trackable.KeyvalueTags["unityAuthoringPosX"] = posX; + trackable.KeyvalueTags["unityAuthoringPosY"] = posY; + String uuid = TrackableRequest.AddTrackable(SaveInfo.instance.worldStorageServer, trackable); + + //change the uuid in its edges, if there is a new edge to be added in the world storage it needs to have the correct uuid + uuid = uuid.Replace("\"", ""); + foreach (ARFEdgeLink edge in trackableNode.portIn.connections) + { + edge.worldLink.UUIDTo = Guid.Parse(uuid); + } + foreach (ARFEdgeLink edge in trackableNode.portOut.connections) + { + edge.worldLink.UUIDFrom = Guid.Parse(uuid); + } + trackableNode.trackable.UUID = Guid.Parse(uuid); + trackableNode.GUID = uuid; + trackableNode.title = trackable.Name; + + //Add the newly saved Trackable to the SaveInfo singleton + Rect trackPos = new(trackableNode.GetPosition().x, trackableNode.GetPosition().y, 135, 77); + SaveInfo.instance.nodePositions[uuid] = trackPos; + } + } + } + GUILayout.Space(10); + EditorGUILayout.EndHorizontal(); + GUILayout.Space(10); + + + } + } + + private void BuildWorldLinkUI() + { + if (worldLink != null) + { + // + //HEADER + // + + //world link icon + EditorGUILayout.BeginHorizontal(); + Texture linkImage = (Texture)AssetDatabase.LoadAssetAtPath("Assets/ETSI.ARF/ARF World Storage API/Images/link.png", typeof(Texture)); + GUI.backgroundColor = Color.clear; + GUILayout.Box(linkImage, GUILayout.Width(40), GUILayout.Height(40)); + + //world link label + EditorGUILayout.BeginVertical(GUILayout.Height(50)); + GUILayout.FlexibleSpace(); + EditorGUILayout.LabelField("WORLD LINK", EditorStyles.boldLabel); + GUILayout.FlexibleSpace(); + EditorGUILayout.EndVertical(); + EditorGUILayout.EndHorizontal(); + + //separator line + var rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(40)); + DrawUILine(new Color(0.77f, 0.77f, 0.77f, 0.77f), 5, 5); + EditorGUILayout.EndHorizontal(); + + //ELEMENT'S ATTRIBUTES + EditorGUI.BeginChangeCheck(); + + //uuid + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("UUID : ", EditorStyles.boldLabel, GUILayout.Width(50)); + if (!SaveInfo.instance.linkIds.Contains(worldLink.UUID.ToString())) + { + EditorGUILayout.LabelField("none Yet"); + } + else + { + EditorGUILayout.SelectableLabel(worldLink.UUID.ToString(), EditorStyles.textField, GUILayout.Height(EditorGUIUtility.singleLineHeight)); + } + EditorGUILayout.EndHorizontal(); + + //source element + EditorGUILayout.LabelField("SOURCE ELEMENT : ", EditorStyles.boldLabel); + EditorGUILayout.BeginHorizontal(); + GUILayout.Space(50); + EditorGUILayout.LabelField("name : ", GUILayout.Width(75)); + EditorGUILayout.LabelField(worldLinkEdge.output.node.title); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.BeginHorizontal(); + GUILayout.Space(50); + EditorGUILayout.LabelField("type : ", GUILayout.Width(75)); + EditorGUILayout.LabelField(worldLink.TypeFrom.ToString(), GUILayout.Width(80)); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.BeginHorizontal(); + GUILayout.Space(50); + EditorGUILayout.LabelField("uuid : ", GUILayout.Width(75)); + if (SaveInfo.instance.nodePositions.ContainsKey(worldLink.UUIDFrom.ToString())) + { + EditorGUILayout.LabelField(worldLink.UUIDFrom.ToString()); + } + else + { + EditorGUILayout.LabelField("no UUID yet"); + } + EditorGUILayout.EndHorizontal(); + + //target element + EditorGUILayout.LabelField("TARGET ELEMENT : ", EditorStyles.boldLabel); + EditorGUILayout.BeginHorizontal(); + GUILayout.Space(50); + EditorGUILayout.LabelField("name : ", GUILayout.Width(75)); + EditorGUILayout.LabelField(worldLinkEdge.input.node.title); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.BeginHorizontal(); + GUILayout.Space(50); + EditorGUILayout.LabelField("type : ", GUILayout.Width(75)); + EditorGUILayout.LabelField(worldLink.TypeTo.ToString(), GUILayout.Width(80)); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.BeginHorizontal(); + GUILayout.Space(50); + EditorGUILayout.LabelField("uuid : ", GUILayout.Width(75)); + if (SaveInfo.instance.nodePositions.ContainsKey(worldLink.UUIDTo.ToString())) + { + EditorGUILayout.LabelField(worldLink.UUIDTo.ToString()); + } + else + { + EditorGUILayout.LabelField("no UUID yet"); + } + EditorGUILayout.EndHorizontal(); + + //unit system + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("UNIT : ", EditorStyles.boldLabel, GUILayout.Width(50)); + worldLink.Unit = (UnitSystem)EditorGUILayout.EnumPopup(worldLink.Unit); + EditorGUILayout.EndHorizontal(); + + //localCRS + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("3D TRANSFORM : ", EditorStyles.boldLabel); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.LabelField("position : "); + //position + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("X", GUILayout.Width(15)); + local_pos[0] = EditorGUILayout.DelayedFloatField(local_pos[0]); + EditorGUILayout.LabelField("Y", GUILayout.Width(15)); + local_pos[1] = EditorGUILayout.DelayedFloatField(local_pos[1]); + EditorGUILayout.LabelField("Z", GUILayout.Width(15)); + local_pos[2] = EditorGUILayout.DelayedFloatField(local_pos[2]); + EditorGUILayout.EndHorizontal(); + EditorGUILayout.LabelField("rotation : "); + //rotation + EditorGUILayout.BeginHorizontal(); + EditorGUILayout.LabelField("X", GUILayout.Width(15)); + local_rot[0] = EditorGUILayout.DelayedFloatField(local_rot[0]); + EditorGUILayout.LabelField("Y", GUILayout.Width(15)); + local_rot[1] = EditorGUILayout.DelayedFloatField(local_rot[1]); + EditorGUILayout.LabelField("Z", GUILayout.Width(15)); + local_rot[2] = EditorGUILayout.DelayedFloatField(local_rot[2]); + EditorGUILayout.EndHorizontal(); + + //Actions when the ui fields have been changed + if (EditorGUI.EndChangeCheck()) + { + // + Matrix4x4 localCRS = Matrix4x4.TRS(local_pos, Quaternion.Euler(local_rot), Vector3.one); + List<float> localCRSasFloat = new List<float> + { + localCRS.m00, localCRS.m01, localCRS.m02, localCRS.m03, + localCRS.m10, localCRS.m11, localCRS.m12, localCRS.m13, + localCRS.m20, localCRS.m21, localCRS.m22, localCRS.m23, + localCRS.m30, localCRS.m31, localCRS.m32, localCRS.m33, + }; + worldLink.Transform = localCRSasFloat; + + if (SaveInfo.instance.linkIds.Contains(worldLink.UUID.ToString()) && (!SaveInfo.instance.elemsToUpdate.Contains(worldLink.UUID.ToString()))) + { + SaveInfo.instance.elemsToUpdate.Add(worldLink.UUID.ToString()); + } + } + + // + //FOOTER + // + GUILayout.FlexibleSpace(); + EditorGUILayout.BeginHorizontal(); + GUILayout.FlexibleSpace(); + //reset button + if (GUILayout.Button("Reset")) + { + //lose focus of fields otherwise the selected field won't updaate + EditorGUI.FocusTextInControl(null); + if (SaveInfo.instance.linkIds.Contains(worldLink.UUID.ToString())) + { + if (SaveInfo.instance.elemsToUpdate.Contains(worldLink.UUID.ToString()) && EditorUtility.DisplayDialog("Reset elements", "Are you sure you want to lose all your changes ?", "Yes", "No")) + { + worldLink = WorldLinkRequest.GetWorldLink(SaveInfo.instance.worldStorageServer, worldLink.UUID.ToString()); + worldLinkEdge.worldLink = worldLink; + ShowWindow(worldLinkEdge); + } + } + else + { + if (EditorUtility.DisplayDialog("Reset elements", "Are you sure you want to lose all your changes ?", "Yes", "No")) + { + + List<float> transform = new List<float>(); + for (int i = 0; i < 15; i++) + { + transform.Add(0); + } + transform.Add(1); + + worldLink.Transform = transform; + worldLink.Unit = UnitSystem.CM; + ShowWindow(worldLinkEdge); + } + } + } + //delete button + if (GUILayout.Button("Delete")) + { + if (EditorUtility.DisplayDialog("Deleting elements", "Are you sure you want to delete this element ?", "Yes", "No")) + { + if (SaveInfo.instance.linkIds.Contains(worldLink.UUID.ToString())) + { + SaveInfo.instance.elemsToRemove.Add(worldLink.UUID.ToString(), typeof(WorldLink)); + } + var window = GetWindow<WorldGraphWindow>(); + window.DeleteEdge(worldLinkEdge); + ResetWindow(); + } + } + //save button + if (GUILayout.Button("Save")) + { + if (SaveInfo.instance.linkIds.Contains(worldLink.UUID.ToString())) + { + if (SaveInfo.instance.elemsToUpdate.Contains(worldLink.UUID.ToString())) + { + if (EditorUtility.DisplayDialog("Saving element", "Are you sure you want to save this element in the server ?", "Yes", "No")) + { + WorldLinkRequest.UpdateWorldLink(SaveInfo.instance.worldStorageServer, worldLink); + SaveInfo.instance.elemsToUpdate.Remove(worldLink.UUID.ToString()); + } + } + } + else + { + if (EditorUtility.DisplayDialog("Saving element", "Are you sure you want to save this element's informations to the server ?", "Yes", "No")) + { + String uuid = WorldLinkRequest.AddWorldLink(SaveInfo.instance.worldStorageServer, worldLink); + + //Add the newly saved WorldLink to the SaveInfo singleton + uuid = uuid.Replace("\"", ""); + SaveInfo.instance.linkIds.Add(uuid); + } + } + } + GUILayout.Space(10); + EditorGUILayout.EndHorizontal(); + GUILayout.Space(10); + + } + } + + //utilty method to draw lines + public static void DrawUILine(Color color, int thickness = 2, int padding = 10) + { + Rect r = EditorGUILayout.GetControlRect(GUILayout.Height(padding + thickness)); + r.height = thickness; + r.y+=padding/2; + r.x-=2; + r.width +=6; + EditorGUI.DrawRect(r, color); + } + } +} \ No newline at end of file diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/NodeEditorWindow.cs.meta b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/GraphEditorWindow.cs.meta similarity index 100% rename from Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/NodeEditorWindow.cs.meta rename to Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/GraphEditorWindow.cs.meta diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/NodeEditorWindow.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/NodeEditorWindow.cs deleted file mode 100644 index 856a1f23855c603cdb2b37ca0b742defda852f95..0000000000000000000000000000000000000000 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/NodeEditorWindow.cs +++ /dev/null @@ -1,70 +0,0 @@ -using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Graph; -using ETSI.ARF.WorldStorage; -using ETSI.ARF.WorldStorage.UI; -using Org.OpenAPITools.Model; -using System; -using UnityEditor; -using UnityEngine; - -namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows -{ - public class NodeEditorWindow : EditorWindow - { - public enum GraphEditorType - { - TRACKABLE, - WORLDANCHOR, - WORLDLINK - } - - public GraphEditorType type; - - // UI stuffs - private Vector2 scrollPos; - static public NodeEditorWindow winSingleton; - - public static void ShowWindow(ARFNodeTrackable trackableNode) - { - Type inspectorType = Type.GetType("UnityEditor.InspectorWindow,UnityEditor.dll"); - winSingleton = GetWindow<NodeEditorWindow>("Trackable Editor", true, inspectorType); - winSingleton.type = GraphEditorType.TRACKABLE; - } - - public static void ShowWindow(ARFNodeWorldAnchor worldAnchorNode) - { - Type inspectorType = Type.GetType("UnityEditor.InspectorWindow,UnityEditor.dll"); - winSingleton = GetWindow<NodeEditorWindow>("Anchor Editor", true, inspectorType); - winSingleton.type = GraphEditorType.WORLDANCHOR; - } - - public static void ShowWindow(ARFEdgeLink graphEdge) - { - Type inspectorType = Type.GetType("UnityEditor.InspectorWindow,UnityEditor.dll"); - winSingleton = GetWindow<NodeEditorWindow>("Link Editor", true, inspectorType); - winSingleton.type = GraphEditorType.WORLDLINK; - } - - public void OnGUI() - { - - scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.ExpandWidth(true)); - - switch (type) - { - case GraphEditorType.WORLDLINK: - GUILayout.Label("link"); - break; - case GraphEditorType.TRACKABLE: - GUILayout.Label("tra"); - break; - case GraphEditorType.WORLDANCHOR: - GUILayout.Label("wa"); - break; - default: - break; - } - - EditorGUILayout.EndScrollView(); - } - } -} \ No newline at end of file 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 d6ac48b584c166c3c43af35d916e7b5274361505..e89f7db9ae996e0931759d3b89332f5c3d84fcf5 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 @@ -197,11 +197,6 @@ namespace ETSI.ARF.WorldStorage.UI { WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables(); WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); - } - if (GraphWindow.graphWindowSingleton != null) - { - UUID = UUID.Replace("\"", ""); - GraphWindow.graphWindowSingleton.createTrackableNode(UUID, nodePosX, nodePosY); } Close(); } @@ -220,10 +215,6 @@ namespace ETSI.ARF.WorldStorage.UI { WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables(); WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); - } - if (GraphWindow.graphWindowSingleton != null) - { - GraphWindow.graphWindowSingleton.Reload(); } Close(); } @@ -242,10 +233,6 @@ namespace ETSI.ARF.WorldStorage.UI { WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables(); WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); - } - if (GraphWindow.graphWindowSingleton != null) - { - GraphWindow.graphWindowSingleton.Reload(); } Close(); } 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 328e95017596dfe6793c51b9387201d56bbfe1ef..4e16be7419a69c1704d057b543883b8fd2f7e84b 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 @@ -174,11 +174,6 @@ namespace ETSI.ARF.WorldStorage.UI { WorldStorageWindow.WorldStorageWindowSingleton.GetWorldAnchors(); WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); - } - if (GraphWindow.graphWindowSingleton != null) - { - UUID = UUID.Replace("\"", ""); - GraphWindow.graphWindowSingleton.createAnchorNode(UUID, nodePosX, nodePosY); } Close(); } @@ -196,10 +191,6 @@ namespace ETSI.ARF.WorldStorage.UI { WorldStorageWindow.WorldStorageWindowSingleton.GetWorldAnchors(); WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); - } - if (GraphWindow.graphWindowSingleton != null) - { - GraphWindow.graphWindowSingleton.Reload(); } } Close(); @@ -218,10 +209,6 @@ namespace ETSI.ARF.WorldStorage.UI { WorldStorageWindow.WorldStorageWindowSingleton.GetWorldAnchors(); WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); - } - if (GraphWindow.graphWindowSingleton != null) - { - GraphWindow.graphWindowSingleton.Reload(); } Close(); } diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldGraphWindow.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldGraphWindow.cs index f32f961183efe7b4d8954d2168471260aeafcc02..46c24faf80f1f8e7c645163116c2d9d2261bd75f 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldGraphWindow.cs +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldGraphWindow.cs @@ -1,10 +1,32 @@ -using ETSI.ARF.WorldStorage; +// +// ARF - Augmented Reality Framework (ETSI ISG ARF) +// +// Copyright 2022 ETSI +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// Last change: July 2022 +// + +using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Graph; +using ETSI.ARF.WorldStorage; using ETSI.ARF.WorldStorage.REST; using ETSI.ARF.WorldStorage.UI; using Org.OpenAPITools.Model; using System; using System.Collections.Generic; using UnityEditor; +using UnityEditor.Experimental.GraphView; using UnityEditor.UIElements; using UnityEngine; using UnityEngine.UIElements; @@ -35,7 +57,7 @@ namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows if (SaveInfo.instance.nodePositions == null) { - SaveInfo.instance.initNodePos(worldStorageServer, worldStorageUser); + SaveInfo.instance.InitNodePos(worldStorageServer, worldStorageUser); } ConstructGraphView(); myGraph.style.top = Length.Percent(11); @@ -53,7 +75,7 @@ namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows }; //top offset so that the graph does'nt overlap with the rest of the ui myGraph.style.top = Length.Percent(11); - myGraph.paintWorldStorage(); + myGraph.PaintWorldStorage(); myGraph.StretchToParentSize(); SaveInfo.instance.toReFrame = true; } @@ -63,7 +85,7 @@ namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows { if (SaveInfo.instance.nodePositions == null) { - SaveInfo.instance.initNodePos(worldStorageServer, worldStorageUser); + SaveInfo.instance.InitNodePos(worldStorageServer, worldStorageUser); } EditorGUILayout.BeginVertical(); @@ -75,11 +97,12 @@ namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows { if (myGraph.ServerAndLocalDifferent() && EditorUtility.DisplayDialog("Saving node positions", "The World Graph has been modified. \nWould you like to push the modifications to the server ?", "Yes", "No")) { - myGraph.saveInServer(); + myGraph.SaveInServer(); } + GraphEditorWindow.ResetWindow(); rootVisualElement.Remove(myGraph); - SaveInfo.instance.initNodePos(worldStorageServer, worldStorageUser); + SaveInfo.instance.InitNodePos(worldStorageServer, worldStorageUser); ConstructGraphView(); myGraph.style.top = Length.Percent(11); rootVisualElement.Add(myGraph); @@ -105,32 +128,23 @@ namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows { var toolbar = new Toolbar(); - var createNodeT = new Button(clickEvent: () => + toolbar.Add(new ToolbarSpacer() { - TrackableWindow.ShowWindow(worldStorageServer, worldStorageUser); - TrackableWindow.winSingleton.nodePosX = 0; - TrackableWindow.winSingleton.nodePosY = 0; + flex = true }); - createNodeT.text = "Create Trackable"; - toolbar.Add(createNodeT); - var createNodeWA = new Button(clickEvent: () => + var debug = new Button(clickEvent: () => { - WorldAnchorWindow.ShowWindow(worldStorageServer, worldStorageUser); - WorldAnchorWindow.winSingleton.nodePosX = 0; - WorldAnchorWindow.winSingleton.nodePosY = 0; - }); - createNodeWA.text = "Create World Anchor"; - toolbar.Add(createNodeWA); - - toolbar.Add(new ToolbarSpacer() + SaveInfo.PrintInfo(); + }) { - flex = true - }); + text = "Debug" + }; + toolbar.Add(debug); var save = new Button(clickEvent: () => { - myGraph.saveInServer(); + myGraph.SaveInServer(); }) { text = "Save" @@ -139,6 +153,21 @@ namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows return toolbar; } + + public void DeleteNode(ARFNode node) + { + rootVisualElement.Remove(myGraph); + node.DisconnectAllPorts(myGraph); + myGraph.DeleteElements(new List<GraphElement>{ node }); + rootVisualElement.Add(myGraph); + } + + public void DeleteEdge(ARFEdgeLink edge) + { + rootVisualElement.Remove(myGraph); + myGraph.DeleteElements(new List<GraphElement> { edge }); + rootVisualElement.Add(myGraph); + } } public class SaveInfo : ScriptableSingleton<SaveInfo> @@ -156,7 +185,7 @@ namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows public WorldStorageServer worldStorageServer; public WorldStorageUser worldStorageUser; - public void initNodePos(WorldStorageServer server, WorldStorageUser user) + public void InitNodePos(WorldStorageServer server, WorldStorageUser user) { worldStorageServer = server; worldStorageUser = user; @@ -209,5 +238,12 @@ namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows { return a = Mathf.Round(a * 2f) * 0.5f; } + + public static void PrintInfo() + { + Debug.Log("elems to delete : " + string.Join(", ", instance.elemsToRemove.Keys)); + Debug.Log("elems to update : " + string.Join(", ", instance.elemsToUpdate)); + Debug.Log("elems tout court : " + string.Join(", ", instance.nodePositions.Keys)); + } } } \ No newline at end of file diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldGraphWindow.cs.meta b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldGraphWindow.cs.meta index ad87e74086ff41b3f880eabd557dad72ed921bc7..e3ea974b57161d7c987a1c3343cc2e501be9898c 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldGraphWindow.cs.meta +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldGraphWindow.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: - m_ViewDataDictionary: {instanceID: 0} - - worldStorageServer: {fileID: 11400000, guid: 777684ed8f62c9d408a1813e8382c676, type: 2} + - worldStorageServer: {fileID: 11400000, guid: 3a9ba82f4e8dd124ca2b005861c64d01, type: 2} - worldStorageUser: {fileID: 11400000, guid: c0696089e4a855b46ad490437919b1e8, type: 2} executionOrder: 0 icon: {instanceID: 0} 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 d9830453e88a3ac9833f28abe5faaa663c98fb7b..1993f0f8e832345a8b24ee42d23ffd5b5fe4fffd 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 @@ -119,10 +119,6 @@ namespace ETSI.ARF.WorldStorage.UI #endif GUI.backgroundColor = WorldStorageWindow.arfColors[4]; - if (GUILayout.Button("Open World Representation Graph Window...")) - { - GraphWindow.ShowWindow(); - } GUI.backgroundColor = ori; DrawElementStuffs(); diff --git a/Assets/ETSI.ARF/ARF World Storage API/Images.meta b/Assets/ETSI.ARF/ARF World Storage API/Images.meta new file mode 100644 index 0000000000000000000000000000000000000000..1186988ec2abd8731861f889c05d72a163518675 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Images.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7d34ace7d2e2513479736d20d0c95ad0 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ETSI.ARF/ARF World Storage API/Images/anchor.png b/Assets/ETSI.ARF/ARF World Storage API/Images/anchor.png new file mode 100644 index 0000000000000000000000000000000000000000..bb1804db730faff5a6f0a7523a8729085e8dae34 Binary files /dev/null and b/Assets/ETSI.ARF/ARF World Storage API/Images/anchor.png differ diff --git a/Assets/ETSI.ARF/ARF World Storage API/Images/anchor.png.meta b/Assets/ETSI.ARF/ARF World Storage API/Images/anchor.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..b8da83ad1c9b68b8a96b51093d3f1d54aa6d78dd --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Images/anchor.png.meta @@ -0,0 +1,98 @@ +fileFormatVersion: 2 +guid: 000725cae67a4f7448f79fe2a478a50d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ETSI.ARF/ARF World Storage API/Images/link.png b/Assets/ETSI.ARF/ARF World Storage API/Images/link.png new file mode 100644 index 0000000000000000000000000000000000000000..dda8f37b2a455617c9f692431928b0502e31747c Binary files /dev/null and b/Assets/ETSI.ARF/ARF World Storage API/Images/link.png differ diff --git a/Assets/ETSI.ARF/ARF World Storage API/Images/link.png.meta b/Assets/ETSI.ARF/ARF World Storage API/Images/link.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..70c4feda72dbe3c9d316954b91263554356c5505 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Images/link.png.meta @@ -0,0 +1,98 @@ +fileFormatVersion: 2 +guid: fef18a27fe1e4a040b8cfda6b3b5c178 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ETSI.ARF/ARF World Storage API/Images/trackable.png b/Assets/ETSI.ARF/ARF World Storage API/Images/trackable.png new file mode 100644 index 0000000000000000000000000000000000000000..f31019b2f9ea607e3bfa127348fa17d80296938d Binary files /dev/null and b/Assets/ETSI.ARF/ARF World Storage API/Images/trackable.png differ diff --git a/Assets/ETSI.ARF/ARF World Storage API/Images/trackable.png.meta b/Assets/ETSI.ARF/ARF World Storage API/Images/trackable.png.meta new file mode 100644 index 0000000000000000000000000000000000000000..fb299339b1756f509d67421574faa81ac5b0fa47 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Images/trackable.png.meta @@ -0,0 +1,98 @@ +fileFormatVersion: 2 +guid: 90d4635c9d0895c42bec0551c4e790ea +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 11 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMasterTextureLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + spritePackingTag: + pSDRemoveMatte: 0 + pSDShowRemoveMatteOption: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/UserSettings/Layouts/default-2021.dwlt b/UserSettings/Layouts/default-2021.dwlt index ac8618fa07b3acdd61c12f58faec880a2e0e50c4..853d3ed7e53d57daad388232be36cb549d5a4e29 100644 --- a/UserSettings/Layouts/default-2021.dwlt +++ b/UserSettings/Layouts/default-2021.dwlt @@ -14,16 +14,16 @@ MonoBehaviour: m_EditorClassIdentifier: m_PixelRect: serializedVersion: 2 - x: 0 - y: 42 - width: 1600 - height: 818 + x: 6.5 + y: 48.5 + width: 1587 + height: 792.5 m_ShowMode: 4 m_Title: Graph Editor - m_RootView: {fileID: 6} + m_RootView: {fileID: 7} m_MinSize: {x: 875, y: 300} m_MaxSize: {x: 10000, y: 10000} - m_Maximized: 1 + m_Maximized: 0 --- !u!114 &2 MonoBehaviour: m_ObjectHideFlags: 52 @@ -32,24 +32,48 @@ MonoBehaviour: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 - m_EditorHideFlags: 1 + m_EditorHideFlags: 0 m_Script: {fileID: 12010, guid: 0000000000000000e000000000000000, type: 0} m_Name: m_EditorClassIdentifier: m_Children: - - {fileID: 9} - {fileID: 3} m_Position: serializedVersion: 2 x: 0 y: 30 - width: 1600 - height: 768 + width: 1587 + height: 742.5 m_MinSize: {x: 300, y: 200} m_MaxSize: {x: 24288, y: 16192} - vertical: 0 - controlID: 50 + vertical: 1 + controlID: 19 --- !u!114 &3 +MonoBehaviour: + m_ObjectHideFlags: 52 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 1 + m_Script: {fileID: 12010, guid: 0000000000000000e000000000000000, type: 0} + m_Name: + m_EditorClassIdentifier: + m_Children: + - {fileID: 10} + - {fileID: 4} + m_Position: + serializedVersion: 2 + x: 0 + y: 0 + width: 1587 + height: 742.5 + m_MinSize: {x: 300, y: 200} + m_MaxSize: {x: 24288, y: 16192} + vertical: 0 + controlID: 20 +--- !u!114 &4 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -59,24 +83,24 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 1 m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} - m_Name: NodeEditorWindow + m_Name: GraphEditorWindow m_EditorClassIdentifier: m_Children: [] m_Position: serializedVersion: 2 - x: 1186 + x: 1159.5 y: 0 - width: 414 - height: 768 - m_MinSize: {x: 101, y: 121} - m_MaxSize: {x: 4001, y: 4021} - m_ActualView: {fileID: 13} + width: 427.5 + height: 742.5 + m_MinSize: {x: 100, y: 100} + m_MaxSize: {x: 4000, y: 4000} + m_ActualView: {fileID: 14} m_Panes: - - {fileID: 15} - - {fileID: 13} + - {fileID: 16} + - {fileID: 14} m_Selected: 1 - m_LastSelected: 1 ---- !u!114 &4 + m_LastSelected: 0 +--- !u!114 &5 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -93,16 +117,16 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 313 - height: 455 + width: 449 + height: 403 m_MinSize: {x: 200, y: 200} m_MaxSize: {x: 4000, y: 4000} - m_ActualView: {fileID: 16} + m_ActualView: {fileID: 17} m_Panes: - - {fileID: 16} + - {fileID: 17} m_Selected: 0 m_LastSelected: 0 ---- !u!114 &5 +--- !u!114 &6 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -118,18 +142,18 @@ MonoBehaviour: m_Position: serializedVersion: 2 x: 0 - y: 455 - width: 1186 - height: 313 + y: 403 + width: 1159.5 + height: 339.5 m_MinSize: {x: 101, y: 121} m_MaxSize: {x: 4001, y: 4021} - m_ActualView: {fileID: 19} + m_ActualView: {fileID: 20} m_Panes: - - {fileID: 14} - - {fileID: 19} + - {fileID: 15} + - {fileID: 20} m_Selected: 1 m_LastSelected: 0 ---- !u!114 &6 +--- !u!114 &7 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -142,22 +166,22 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Children: - - {fileID: 7} - - {fileID: 2} - {fileID: 8} + - {fileID: 2} + - {fileID: 9} m_Position: serializedVersion: 2 x: 0 y: 0 - width: 1600 - height: 818 + width: 1587 + height: 792.5 m_MinSize: {x: 875, y: 300} m_MaxSize: {x: 10000, y: 10000} m_UseTopView: 1 m_TopViewHeight: 30 m_UseBottomView: 1 m_BottomViewHeight: 20 ---- !u!114 &7 +--- !u!114 &8 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -174,12 +198,12 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 1600 + width: 1587 height: 30 m_MinSize: {x: 0, y: 0} m_MaxSize: {x: 0, y: 0} m_LastLoadedLayoutName: ---- !u!114 &8 +--- !u!114 &9 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -195,12 +219,12 @@ MonoBehaviour: m_Position: serializedVersion: 2 x: 0 - y: 798 - width: 1600 + y: 772.5 + width: 1587 height: 20 m_MinSize: {x: 0, y: 0} m_MaxSize: {x: 0, y: 0} ---- !u!114 &9 +--- !u!114 &10 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -213,19 +237,19 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Children: - - {fileID: 10} - - {fileID: 5} + - {fileID: 11} + - {fileID: 6} m_Position: serializedVersion: 2 x: 0 y: 0 - width: 1186 - height: 768 + width: 1159.5 + height: 742.5 m_MinSize: {x: 200, y: 200} m_MaxSize: {x: 16192, y: 16192} vertical: 1 - controlID: 51 ---- !u!114 &10 + controlID: 35 +--- !u!114 &11 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -238,19 +262,19 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Children: - - {fileID: 4} - - {fileID: 11} + - {fileID: 5} + - {fileID: 12} m_Position: serializedVersion: 2 x: 0 y: 0 - width: 1186 - height: 455 + width: 1159.5 + height: 403 m_MinSize: {x: 200, y: 100} m_MaxSize: {x: 16192, y: 8096} vertical: 0 - controlID: 52 ---- !u!114 &11 + controlID: 36 +--- !u!114 &12 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -265,20 +289,20 @@ MonoBehaviour: m_Children: [] m_Position: serializedVersion: 2 - x: 313 + x: 449 y: 0 - width: 873 - height: 455 + width: 710.5 + height: 403 m_MinSize: {x: 102, y: 121} m_MaxSize: {x: 4002, y: 4021} - m_ActualView: {fileID: 12} + m_ActualView: {fileID: 13} m_Panes: - - {fileID: 17} - {fileID: 18} - - {fileID: 12} + - {fileID: 19} + - {fileID: 13} m_Selected: 2 m_LastSelected: 1 ---- !u!114 &12 +--- !u!114 &13 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -298,17 +322,17 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 313 - y: 72 - width: 871 - height: 434 + x: 455.5 + y: 78.5 + width: 708.5 + height: 382 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default m_SaveData: [] - worldStorageServer: {fileID: 11400000, guid: 777684ed8f62c9d408a1813e8382c676, type: 2} + worldStorageServer: {fileID: 11400000, guid: 3a9ba82f4e8dd124ca2b005861c64d01, type: 2} worldStorageUser: {fileID: 11400000, guid: c0696089e4a855b46ad490437919b1e8, type: 2} ---- !u!114 &13 +--- !u!114 &14 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -323,21 +347,24 @@ MonoBehaviour: m_MinSize: {x: 100, y: 100} m_MaxSize: {x: 4000, y: 4000} m_TitleContent: - m_Text: Trackable Editor + m_Text: Element Editor m_Image: {fileID: 0} m_Tooltip: m_Pos: serializedVersion: 2 - x: 1186 - y: 72 - width: 413 - height: 747 + x: 1166 + y: 78.5 + width: 426.5 + height: 721.5 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default m_SaveData: [] - type: 0 ---- !u!114 &14 + type: 3 + local_size: {x: 0, y: 0, z: 0} + local_rot: {x: 0, y: 0, z: 0} + local_pos: {x: 0, y: 0, z: 0} +--- !u!114 &15 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -357,10 +384,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 0 - y: 527 - width: 1185.5 - height: 292 + x: 6.5 + y: 481.5 + width: 1158.5 + height: 318.5 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -391,9 +418,9 @@ MonoBehaviour: m_IsLocked: 0 m_FolderTreeState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: 644b0000 - m_LastClickedID: 19300 - m_ExpandedIDs: 00000000524b0000544b0000564b0000584b0000 + m_SelectedIDs: 8c4b0000 + m_LastClickedID: 19340 + m_ExpandedIDs: 00000000544b0000564b0000584b00005a4b000000ca9a3bffffff7f m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -409,7 +436,7 @@ MonoBehaviour: m_IsRenaming: 0 m_OriginalEventType: 11 m_IsRenamingFilename: 1 - m_ClientGUIView: {fileID: 0} + m_ClientGUIView: {fileID: 6} m_SearchString: m_CreateAssetUtility: m_EndAction: {fileID: 0} @@ -421,7 +448,7 @@ MonoBehaviour: scrollPos: {x: 0, y: 0} m_SelectedIDs: m_LastClickedID: 0 - m_ExpandedIDs: 00000000524b0000544b0000564b0000584b0000 + m_ExpandedIDs: 00000000544b0000564b0000584b00005a4b0000 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -465,7 +492,7 @@ MonoBehaviour: m_IsRenaming: 0 m_OriginalEventType: 11 m_IsRenamingFilename: 1 - m_ClientGUIView: {fileID: 5} + m_ClientGUIView: {fileID: 6} m_CreateAssetUtility: m_EndAction: {fileID: 0} m_InstanceID: 0 @@ -477,7 +504,7 @@ MonoBehaviour: m_GridSize: 64 m_SkipHiddenPackages: 0 m_DirectoriesAreaWidth: 207 ---- !u!114 &15 +--- !u!114 &16 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -497,10 +524,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 1186.5 - y: 72 - width: 412.5 - height: 747 + x: 1166 + y: 78.5 + width: 426.5 + height: 721.5 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -511,14 +538,14 @@ MonoBehaviour: m_CachedPref: 160 m_ControlHash: -371814159 m_PrefName: Preview_InspectorPreview - m_LastInspectedObjectInstanceID: 19264 + m_LastInspectedObjectInstanceID: 3288 m_LastVerticalScrollValue: 0 m_GlobalObjectId: m_InspectorMode: 0 m_LockTracker: m_IsLocked: 0 m_PreviewWindow: {fileID: 0} ---- !u!114 &16 +--- !u!114 &17 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -538,10 +565,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 0 - y: 72 - width: 312 - height: 434 + x: 6.5 + y: 78.5 + width: 448 + height: 382 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -549,7 +576,7 @@ MonoBehaviour: m_SceneHierarchy: m_TreeViewState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: 404b0000 + m_SelectedIDs: d80c0000 m_LastClickedID: 0 m_ExpandedIDs: 38fbffff m_RenameOverlay: @@ -575,7 +602,7 @@ MonoBehaviour: m_IsLocked: 0 m_CurrentSortingName: TransformSorting m_WindowGUID: 4c969a2b90040154d917609493e03593 ---- !u!114 &17 +--- !u!114 &18 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -880,7 +907,7 @@ MonoBehaviour: m_SceneVisActive: 1 m_LastLockedObject: {fileID: 0} m_ViewIsLockedToObject: 0 ---- !u!114 &18 +--- !u!114 &19 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -900,10 +927,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 313 - y: 72 - width: 871 - height: 434 + x: 455.5 + y: 78.5 + width: 708.5 + height: 382 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -914,7 +941,7 @@ MonoBehaviour: m_ShowGizmos: 0 m_TargetDisplay: 0 m_ClearColor: {r: 0, g: 0, b: 0, a: 0} - m_TargetSize: {x: 871, y: 413} + m_TargetSize: {x: 708.5, y: 361} m_TextureFilterMode: 0 m_TextureHideFlags: 61 m_RenderIMGUI: 1 @@ -929,10 +956,10 @@ MonoBehaviour: m_VRangeLocked: 0 hZoomLockedByDefault: 0 vZoomLockedByDefault: 0 - m_HBaseRangeMin: -217.75 - m_HBaseRangeMax: 217.75 - m_VBaseRangeMin: -103.25 - m_VBaseRangeMax: 103.25 + m_HBaseRangeMin: -177.125 + m_HBaseRangeMax: 177.125 + m_VBaseRangeMin: -90.25 + m_VBaseRangeMax: 90.25 m_HAllowExceedBaseRangeMin: 1 m_HAllowExceedBaseRangeMax: 1 m_VAllowExceedBaseRangeMin: 1 @@ -950,29 +977,29 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 21 - width: 871 - height: 413 + width: 708.5 + height: 361 m_Scale: {x: 2, y: 2} - m_Translation: {x: 435.5, y: 206.5} + m_Translation: {x: 354.25, y: 180.5} m_MarginLeft: 0 m_MarginRight: 0 m_MarginTop: 0 m_MarginBottom: 0 m_LastShownAreaInsideMargins: serializedVersion: 2 - x: -217.75 - y: -103.25 - width: 435.5 - height: 206.5 + x: -177.125 + y: -90.25 + width: 354.25 + height: 180.5 m_MinimalGUI: 1 m_defaultScale: 2 - m_LastWindowPixelSize: {x: 1742, y: 868} + m_LastWindowPixelSize: {x: 1417, y: 764} m_ClearInEditMode: 1 m_NoCameraWarning: 1 m_LowResolutionForAspectRatios: 01000000000000000000 m_XRRenderMode: 0 m_RenderTexture: {fileID: 0} ---- !u!114 &19 +--- !u!114 &20 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -992,10 +1019,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 0 - y: 527 - width: 1185 - height: 292 + x: 6.5 + y: 481.5 + width: 1158.5 + height: 318.5 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default