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 new file mode 100644 index 0000000000000000000000000000000000000000..ee0ae20b184ac1c30465b2648b31a727a4222bb4 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFEdgeLink.cs @@ -0,0 +1,28 @@ +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; + +namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Graph +{ + public class ARFEdgeLink : Edge + { + public WorldLink worldLink; + public string GUID; + public ARFEdgeLink() + { + 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); + } + + public void clicked() + { + NodeEditorWindow.ShowWindow(this); + } + } +} \ No newline at end of file diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFEdgeLink.cs.meta b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFEdgeLink.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..723d9ee5a57433d64e93157394dddc87a891f90e --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFEdgeLink.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 81a94cf483be20040aa4fe8d9f93d5c5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: 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 299379076fe047f641b17c045c9ee553bf885e69..b85f7c825d3198f6b92821b81c93383f28554d8b 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 @@ -1,109 +1,467 @@ -// -// 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 -// - -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UIElements; -using UnityEditor.Experimental.GraphView; -using System; - -namespace ETSI.ARF.WorldStorage.UI -{ - public class ARFGraphView : GraphView - { - public ARFGraphView() - { - //GridBackground back = new GridBackground(); - //back.StretchToParentSize(); - //Insert(0, back); - - this.AddManipulator(new ContentDragger()); - this.AddManipulator(new SelectionDragger()); - this.AddManipulator(new RectangleSelector()); - - AddElement(GenerateEntryPointNode()); - } - - public override List<Port> GetCompatiblePorts(Port startPort, NodeAdapter nodeAdapter) - { - var cPorts = new List<Port>(); - ports.ForEach (funcCall: port => - { - if (startPort != port && startPort.node != port.node) cPorts.Add(port); - }); - return cPorts; - } - - private Port GeneratePort (ARFNode node, Direction portDirection, Port.Capacity capacity = Port.Capacity.Multi) - { - return node.InstantiatePort(Orientation.Horizontal, portDirection, capacity, typeof(int)); // dummy - } - - private ARFNode GenerateEntryPointNode() - { - var node = new ARFNode - { - title = "World Storage", - text = "EntryPoint", - GUID = Guid.NewGuid().ToString(), - entryPoint = true - }; - - var portOut = GeneratePort(node, Direction.Output); - portOut.portName = "Link"; - node.outputContainer.Add(portOut); - - node.RefreshExpandedState(); - node.RefreshPorts(); - node.SetPosition(new Rect(50, 100, 200, 150)); - return node; - } - - public void CreateNode(string name) - { - AddElement(CreateARFNode(name)); - } - - public ARFNode CreateARFNode(string name) - { - var node = new ARFNode - { - title = name, - text = name, - GUID = Guid.NewGuid().ToString() - }; - - var portIn = GeneratePort(node, Direction.Input, Port.Capacity.Multi); - portIn.portName = "Link"; // "Input"; - node.inputContainer.Add(portIn); - - var portOut = GeneratePort(node, Direction.Output, Port.Capacity.Multi); - portOut.portName = "Link"; // "Output"; - node.outputContainer.Add(portOut); - - node.RefreshExpandedState(); - node.RefreshPorts(); - node.SetPosition(new Rect(200, 100, 200, 150)); - - return node; - } - } +// +// 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 + +using System.Collections; +using System.Collections.Generic; +#if USING_OPENAPI_GENERATOR +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +#else +using IO.Swagger.Api; +using IO.Swagger.Model; +#endif +using UnityEngine; +using UnityEngine.UIElements; +using UnityEditor.Experimental.GraphView; +using System; +using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Graph; +using ETSI.ARF.WorldStorage.REST; +using UnityEditor; +using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows; + +namespace ETSI.ARF.WorldStorage.UI +{ + public class ARFGraphView : GraphView + { + public WorldStorageServer worldStorageServer; + public WorldStorageUser worldStorageUser; + + public ARFGraphView() + { + SetupZoom(ContentZoomer.DefaultMinScale, ContentZoomer.DefaultMaxScale); + + //deleSection + deleteSelection += DeleteFunc; + + this.AddManipulator(new ContentDragger()); + this.AddManipulator(new SelectionDragger()); + this.AddManipulator(new RectangleSelector()); + + } + + //method called when an element is deleted from the graphview + public void DeleteFunc(string operationName, AskUser askUser) + { + //build the message to list all the deleted elements + String message = "Are you sure you want to delete "; + if (selection.Count > 1) + { + message += selection.Count + " elements ?"; + } + else + { + message += "this element ?"; + } + + //remove from the graph all the deleted elements + if (EditorUtility.DisplayDialog("Deleting elements", message, "Yes", "No")) + { + if (SaveInfo.instance.elemsToRemove == null) + { + SaveInfo.instance.elemsToRemove = new List<string>(); + } + foreach (GraphElement elt in selection.ToArray()) + { + ARFNodeWorldAnchor nodeAnchor = elt as ARFNodeWorldAnchor; + if (nodeAnchor != null) + { + nodeAnchor.DisconnectAllPorts(this); + if (SaveInfo.instance.nodePositions.ContainsKey(nodeAnchor.GUID)) + { + SaveInfo.instance.elemsToRemove.Add(nodeAnchor.GUID); + } + RemoveElement(elt); + continue; + } + ARFNodeTrackable nodeTrackable = elt as ARFNodeTrackable; + if (nodeTrackable != null) + { + nodeTrackable.DisconnectAllPorts(this); + if (SaveInfo.instance.nodePositions.ContainsKey(nodeTrackable.GUID)) + { + SaveInfo.instance.elemsToRemove.Add(nodeTrackable.GUID); + } + RemoveElement(elt); + continue; + } + ARFEdgeLink edgeLink = elt as ARFEdgeLink; + if (edgeLink != null) + { + edgeLink.input.Disconnect(edgeLink); + edgeLink.output.Disconnect(edgeLink); + SaveInfo.instance.elemsToRemove.Add(edgeLink.GUID); + RemoveElement(elt); + continue; + } + } + } + } + + public override void BuildContextualMenu(UnityEngine.UIElements.ContextualMenuPopulateEvent evt) + { + Vector2 localMousePos = evt.localMousePosition; + Vector2 actualGraphPosition = viewTransform.matrix.inverse.MultiplyPoint(localMousePos); + + evt.menu.AppendSeparator(); + evt.menu.AppendAction("Reload graph", delegate + { + if (positionshaveBeenChanged() && EditorUtility.DisplayDialog("Saving node positions", "The nodes positions have been changed, would you like to save them ?", "Yes", "No")) + { + saveElemPositionsInServer(); + } + reload(); + SaveInfo.instance.toReFrame = true; + }, (DropdownMenuAction a) => DropdownMenuAction.Status.Normal); + evt.menu.AppendAction("Create Trackable", delegate + { + //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++) + { + localCRS.Add(0); + } + + List<double> trackableSize = new List<double>(); + 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); + + }, (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++) + { + localCRS.Add(0); + } + + List<double> worldAnchorSize = new List<double>(); + for (int i = 0; i < 3; i++) + { + worldAnchorSize.Add(0); + } + + 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); + + }, (DropdownMenuAction a) => DropdownMenuAction.Status.Normal); + evt.menu.AppendSeparator(); + if (evt.target is ARFNode || evt.target is Group || evt.target is ARFEdgeLink) + { + evt.menu.AppendSeparator(); + evt.menu.AppendAction("Delete", delegate + { + DeleteSelectionCallback(AskUser.AskUser); + }, (DropdownMenuAction a) => canDeleteSelection ? DropdownMenuAction.Status.Normal : DropdownMenuAction.Status.Disabled); + evt.menu.AppendSeparator(); + } + if (evt.target is GraphView) + { + } + } + private bool positionshaveBeenChanged() + { + if (SaveInfo.instance.elemsToRemove.Count != 0) + { + return true; + } + foreach (ARFNode node in 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)) + { + return true; + } + } + return false; + } + + public override List<Port> GetCompatiblePorts(Port startPort, NodeAdapter nodeAdapter) + { + var cPorts = new List<Port>(); + ports.ForEach(funcCall: port => + { + if (startPort != port && startPort.node != port.node) cPorts.Add(port); + }); + return cPorts; + } + + public void paintWorldStorage() + { + List<Trackable> trackables = TrackableRequest.GetAllTrackables(worldStorageServer); + List<WorldAnchor> worldAnchors = WorldAnchorRequest.GetAllWorldAnchors(worldStorageServer); + List<WorldLink> worldLinks = WorldLinkRequest.GetAllWorldLinks(worldStorageServer); + + foreach (WorldAnchor worldAnchor in worldAnchors) + { + var waNode = new ARFNodeWorldAnchor(worldAnchor); + + Rect posTemp = new Rect(26, 93, 160, 77); + SaveInfo.instance.nodePositions.TryGetValue(worldAnchor.UUID.ToString(), out posTemp); + waNode.SetPosition(posTemp); + + AddElement(waNode); + } + + foreach (Trackable trackable in trackables) + { + var tracknode = new ARFNodeTrackable(trackable); + + Rect posTemp = new Rect(26, 93, 160, 77); + SaveInfo.instance.nodePositions.TryGetValue(trackable.UUID.ToString(), out posTemp); + tracknode.SetPosition(posTemp); + + AddElement(tracknode); + } + foreach (WorldLink worldLink in worldLinks) + { + var portPair = getPortsFromWorldLink(worldLink); + ARFEdgeLink edge = portPair.Key.ConnectTo<ARFEdgeLink>(portPair.Value); + edge.worldLink = worldLink; + edge.GUID = worldLink.UUID.ToString(); + + AddElement(edge); + } + + } + + internal void 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); + } + + internal void createAnchorNode(WorldAnchor wa, float posX, float posY) + { + var waNode = new ARFNodeWorldAnchor(wa); + + Rect pos = new Rect(RoundToNearestHalf(posX), RoundToNearestHalf(posY), 160, 77); + waNode.SetPosition(pos); + + AddElement(waNode); + } + + internal void createLink(WorldLink 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); + } + + public void reload() + { + DeleteElements(graphElements); + paintWorldStorage(); + FrameAllElements(); + } + + public Dictionary<string, Rect> SavePositions() + { + Dictionary<string, Rect> ret = new Dictionary<string, Rect>(); + foreach (ARFNode elem in nodes) + { + ret.Add(elem.GUID, elem.GetPosition()); + } + return ret; + } + + private KeyValuePair<Port, Port> getPortsFromWorldLink(WorldLink worldLink) + { + var ret = new KeyValuePair<Port, Port>(); + + //To + Guid idTo = worldLink.UUIDTo; + Port portIn = null; + switch (worldLink.TypeTo) + { + case ObjectType.Trackable: + foreach (GraphElement node in this.graphElements) + { + ARFNodeTrackable nodeTrackable = node as ARFNodeTrackable; + if ((nodeTrackable != null) && (nodeTrackable.trackable.UUID == idTo)) + { + portIn = nodeTrackable.portIn; + break; + } + } + break; + case ObjectType.WorldAnchor: + foreach (GraphElement node in this.graphElements) + { + ARFNodeWorldAnchor nodeAnchor = node as ARFNodeWorldAnchor; + if ((nodeAnchor != null) && nodeAnchor.worldAnchor.UUID == idTo) + { + portIn = nodeAnchor.portIn; + break; + } + } + break; + default: + Debug.Log("what are you doing here..."); + break; + } + + //From + Guid idFrom = worldLink.UUIDFrom; + Port portOut = null; + switch (worldLink.TypeFrom) + { + case ObjectType.Trackable: + foreach (GraphElement node in this.graphElements) + { + ARFNodeTrackable nodeTrackable = node as ARFNodeTrackable; + if ((nodeTrackable != null) && (nodeTrackable.trackable.UUID == idFrom)) + { + portOut = nodeTrackable.portOut; + break; + } + } + break; + case ObjectType.WorldAnchor: + foreach (GraphElement node in this.graphElements) + { + ARFNodeWorldAnchor nodeAnchor = node as ARFNodeWorldAnchor; + if ((nodeAnchor != null) && nodeAnchor.worldAnchor.UUID == idFrom) + { + portOut = nodeAnchor.portOut; + break; + } + } + break; + default: + Debug.Log("what are you doing here..."); + break; + } + + if ((portOut != null) && (portIn != null)) + { + ret = new KeyValuePair<Port, Port>(portOut, portIn); + } + + return ret; + } + + // + // Résumé : + // Calculate the rectangle size and position to fit all elements in graph. + // + // Paramètres : + // container: + // This should be the view container. + // + // Retourne : + // The calculated rectangle. + public override Rect CalculateRectToFitAll(VisualElement container) + { + Rect rectToFit = container.layout; + bool reachedFirstChild = false; + graphElements.ForEach(delegate (GraphElement ge) + { + if (!(ge is ARFEdgeLink) && !(ge is Port)) + { + if (!reachedFirstChild) + { + rectToFit = ge.ChangeCoordinatesTo(contentViewContainer, ge.contentRect); + reachedFirstChild = true; + } + else + { + rectToFit = RectUtils.Encompass(rectToFit, ge.ChangeCoordinatesTo(contentViewContainer, ge.contentRect)); + } + } + }); + return rectToFit; + } + + //k_FrameBorder is private readOnly graphView attribute, had to redeclare it to access it + private readonly int k_FrameBorder = 30; + public void FrameAllElements() + { + Vector3 frameTranslation = Vector3.zero; + Vector3 frameScaling = Vector3.one; + var rectToFit = CalculateRectToFitAll(contentViewContainer); + CalculateFrameTransform(rectToFit, layout, k_FrameBorder, out frameTranslation, out frameScaling); + Matrix4x4.TRS(frameTranslation, Quaternion.identity, frameScaling); + UpdateViewTransform(frameTranslation, frameScaling); + } + + //method to predict the position of a node (the float that will be saved in the PositionInfo singleton) + public static float RoundToNearestHalf(float a) + { + return a = Mathf.Round(a * 2f) * 0.5f; + } + + public void saveElemPositionsInServer() + { + foreach (ARFNode node in nodes) + { + if (!SaveInfo.instance.nodePositions.ContainsKey(node.GUID)) + { + //TODO + Debug.Log("need to post " + node.GUID); + } + else + { + float xLocal = node.GetPosition().x; + float yLocal = node.GetPosition().y; + float xServer = SaveInfo.instance.nodePositions[node.GUID].x; ; + float yServer = SaveInfo.instance.nodePositions[node.GUID].y; + if ((xLocal != xServer) && (yLocal != yServer)) + { + //TODO + Debug.Log("need to update " + node.GUID); + } + } + } + foreach (ARFEdgeLink edge in edges) + { + if (!SaveInfo.instance.linkIds.Contains(edge.GUID)) + { + //TODO + Debug.Log("need to post link between " + edge.input); + } + } + foreach (String elemId in SaveInfo.instance.elemsToRemove) + { + //TODO + Debug.Log("need to remove " + elemId); + } + } + } } \ 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 5ea6fbedc22f6960cbdacd0e2766c59bce8ed992..6c29371aa286dcbe0f9fccb5581906357972b2f8 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 @@ -1,41 +1,103 @@ -// -// 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 -// - -using System.Collections; -using System.Collections.Generic; -using UnityEngine; -using UnityEngine.UIElements; -using UnityEditor.Experimental.GraphView; - -namespace ETSI.ARF.WorldStorage.UI -{ - public class ARFNode : Node - { - public string GUID; - public string text; - public bool entryPoint = false; - - public ARFNode() - { - - - } - } +// +// 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 ETSI.ARF.WorldStorage.REST; + +#if USING_OPENAPI_GENERATOR +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +#else +using IO.Swagger.Api; +using IO.Swagger.Model; +#endif +using UnityEngine.UIElements; +using UnityEditor.Experimental.GraphView; +using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Graph; +using System; + +namespace ETSI.ARF.WorldStorage.UI +{ + public class ARFNode : Node + { + public string GUID; + public bool entryPoint = false; + public Port portOut; + public Port portIn; + public GUID id; + public ARFNode() + { + + } + + public override Port InstantiatePort(Orientation orientation, Direction direction, Port.Capacity capacity, Type type) + { + switch (direction) + { + case Direction.Input: + portIn = Port.Create<ARFEdgeLink>(orientation, direction, capacity, type); + return portIn; + case Direction.Output: + portOut = Port.Create<ARFEdgeLink>(orientation, direction, capacity, type); + return portOut; + default: + return null; + } + } + + public void DisconnectAllPorts(ARFGraphView graphView) + { + DisconnectInputPorts(graphView); + DisconnectOutputPorts(graphView); + } + + private void DisconnectInputPorts(ARFGraphView graphView) + { + DisconnectPorts(inputContainer, graphView); + } + + private void DisconnectOutputPorts(ARFGraphView graphView) + { + DisconnectPorts(outputContainer, graphView); + } + + private void DisconnectPorts(VisualElement container, ARFGraphView graphView) + { + foreach (Port port in container.Children()) + { + if (!port.connected) + { + continue; + } + + graphView.DeleteElements(port.connections); + } + } + + public Port GeneratePort(ARFNode node, Direction portDirection, Port.Capacity capacity = Port.Capacity.Multi) + { + return node.InstantiatePort(Orientation.Horizontal, portDirection, capacity, typeof(int)); // dummy + } + } } \ No newline at end of file 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 new file mode 100644 index 0000000000000000000000000000000000000000..b25b58e73ca7634a46e7f81d957dce74cf21516d --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeTrackable.cs @@ -0,0 +1,88 @@ +// +// 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 ETSI.ARF.WorldStorage.REST; + +#if USING_OPENAPI_GENERATOR +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +#else +using IO.Swagger.Api; +using IO.Swagger.Model; +#endif +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 +{ + public class ARFNodeTrackable : ARFNode + { + public Trackable trackable; + + public ARFNodeTrackable(Trackable trackable) + { + this.trackable = trackable; + this.GUID = trackable.UUID.ToString(); + this.title = trackable.Name; + + /*COLOR*/ + var colorRectangle = new VisualElement(); + colorRectangle.style.height = 160; + colorRectangle.style.height = 5; + colorRectangle.style.backgroundColor = new Color(0.9f, 0.78f, 0.54f, 0.9f); + mainContainer.Insert(1, colorRectangle); + + /*PORTS*/ + var portIn = GeneratePort(this, Direction.Input, Port.Capacity.Multi); + portIn.portColor = new Color(0.77f, 0.77f, 0.77f, 0.77f); + portIn.portName = "Target"; // "Input" + portIn.AddManipulator(new EdgeConnector<ARFEdgeLink>(new WorldLinkListener())); + inputContainer.Add(portIn); + + var portOut = GeneratePort(this, Direction.Output, Port.Capacity.Multi); + portOut.portColor = new Color(0.77f, 0.77f, 0.77f, 0.77f); + portOut.portName = "Source"; // "Output"; + portOut.AddManipulator(new EdgeConnector<ARFEdgeLink>(new WorldLinkListener())); ; + outputContainer.Add(portOut); + + RefreshExpandedState(); + RefreshPorts(); + + /*MANIPULATOR*/ + var doubleClickManipulator = new Clickable(clicked); + doubleClickManipulator.activators.Clear(); + doubleClickManipulator.activators.Add(new ManipulatorActivationFilter { button = MouseButton.LeftMouse, clickCount = 2 }); + this.AddManipulator(doubleClickManipulator); + } + + public void clicked() + { + NodeEditorWindow.ShowWindow(this); + Debug.Log(trackable.ToString()); + } + } +} \ No newline at end of file diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeTrackable.cs.meta b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeTrackable.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..17e98f27c0df67b74d8e87e243203ba56f30d987 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeTrackable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 01bfb1a0a4a788c48a6c6675034ba8d5 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: 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 new file mode 100644 index 0000000000000000000000000000000000000000..a8c83a337c3360a7aca0de47a04a881c8001e55a --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeWorldAnchor.cs @@ -0,0 +1,88 @@ +// +// 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 ETSI.ARF.WorldStorage.REST; + +#if USING_OPENAPI_GENERATOR +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +#else +using IO.Swagger.Api; +using IO.Swagger.Model; +#endif +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 +{ + public class ARFNodeWorldAnchor : ARFNode + { + public WorldAnchor worldAnchor; + + public ARFNodeWorldAnchor(WorldAnchor worldAnchor) + { + this.worldAnchor = worldAnchor; + this.GUID = worldAnchor.UUID.ToString(); + this.title = worldAnchor.Name; + + /*COLOR*/ + var colorRectangle = new VisualElement(); + colorRectangle.style.height = 160; + colorRectangle.style.height = 5; + colorRectangle.style.backgroundColor = new Color(0.76f, 0.9f, 0.46f, 0.9f); + mainContainer.Insert(1, colorRectangle); + + /*PORTS*/ + var portIn = GeneratePort(this, Direction.Input, Port.Capacity.Multi); + portIn.portColor = new Color(0.77f,0.77f,0.77f, 0.77f); + portIn.portName = "Target"; // "Input"; + portIn.AddManipulator(new EdgeConnector<ARFEdgeLink>(new WorldLinkListener())); + inputContainer.Add(portIn); + + var portOut = GeneratePort(this, Direction.Output, Port.Capacity.Multi); + portOut.portColor = new Color(0.77f, 0.77f, 0.77f, 0.77f); + portOut.portName = "Source"; // "Output"; + portOut.AddManipulator(new EdgeConnector<ARFEdgeLink>(new WorldLinkListener())); + outputContainer.Add(portOut); + + RefreshExpandedState(); + RefreshPorts(); + + /*MANIPULATOR*/ + var doubleClickManipulator = new Clickable(clicked); + doubleClickManipulator.activators.Clear(); + doubleClickManipulator.activators.Add(new ManipulatorActivationFilter { button = MouseButton.LeftMouse, clickCount = 2 }); + this.AddManipulator(doubleClickManipulator); + } + + public void clicked() + { + Debug.Log(worldAnchor.ToString()); + NodeEditorWindow.ShowWindow(this); + } + } +} \ No newline at end of file diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeWorldAnchor.cs.meta b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeWorldAnchor.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..bb1bb7e9dbcc846457423ce25bb5ae3dccc979ec --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/ARFNodeWorldAnchor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 21e22c1ed011b7a4da95fad83be1d9fa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: 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 index 3a21abee031ab83a53c4735195847331fa312a85..9c496ee89040237b46e84b324ab9267529fc7529 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/GraphWindow.cs +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/GraphWindow.cs @@ -1,216 +1,394 @@ -// -// 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; - -#if USING_OPENAPI_GENERATOR -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Model; -#else -using IO.Swagger.Api; -using IO.Swagger.Model; -#endif - - -namespace ETSI.ARF.WorldStorage.UI -{ - - public class GraphWindow : EditorWindow - { - [HideInInspector] public WorldStorageServer worldStorageSettings; - - [SerializeField] public List<string> trackables = new List<string>(); - - bool groupEnabled; - - string uid = System.Guid.Empty.ToString(); - string customName = "NotDefined"; - string creatorUid = System.Guid.Empty.ToString(); - string type = "Unknow"; - string unit = "Unknow"; - Vector2Int dim; - - private Trackable currentTrackable; - private Vector2 scrollPos; - private Color ori; - private GUIStyle gsTest; - - private ARFGraphView myGraph; - - [MenuItem("ARFWorldStorage/Graph Editor")] - public static void ShowWindow()//WorldStorageServer ws) - { - GraphWindow win = EditorWindow.GetWindow(typeof(GraphWindow), false, WorldStorageWindow.winName) as GraphWindow; - //win.worldStorageSettings = ws; - } - - public GraphWindow() - { - // init somne stuffs - //currentTrackable = new Trackable(); - } - - public void OnEnable() - { - ConstructGraphView(); - GenerateToolbar(); - } - - public void OnDisable() - { - rootVisualElement.Remove(myGraph); - } - - private void GenerateToolbar() - { - var toolbar = new Toolbar(); - - var createNodeT = new Button(clickEvent: () => { myGraph.CreateNode("Trackable"); }); - createNodeT.text = "Create Trackable"; - toolbar.Add(createNodeT); - - var createNodeWA = new Button(clickEvent: () => { myGraph.CreateNode("World Anchor"); }); - createNodeWA.text = "Create World Anchor"; - toolbar.Add(createNodeWA); - - var createNodeL = new Button(clickEvent: () => { }); - createNodeL.text = "Create Link"; - toolbar.Add(createNodeL); - - var close = new Button(clickEvent: () => { Close(); }); - close.text = "Close Window"; - toolbar.Add(close); - - rootVisualElement.Add(toolbar); - } - - private void ConstructGraphView() - { - myGraph = new ARFGraphView - { - name = "ARF Graph" - }; - myGraph.StretchToParentSize(); - //myGraph.StretchToParentWidth(); - rootVisualElement.Add(myGraph); - } - - void OnGUI() - { - ori = GUI.backgroundColor; // remember ori color - - gsTest = new GUIStyle("window"); - gsTest.normal.textColor = WorldStorageWindow.arfColors[0]; - gsTest.fontStyle = FontStyle.Bold; - - EditorGUILayout.Space(24); - GUI.contentColor = WorldStorageWindow.arfColors[1]; - WorldStorageWindow.DrawCopyright(); - - //TLP.Editor.EditorGraph graph = new TLP.Editor.EditorGraph(0, -1, 10, 1, "Just a sin wave", 100); - //graph.AddFunction(x => Mathf.Sin(x)); - //graph.Draw(); - } - - /* - void DrawTrackableStuffs()// Trackable trackable) - { - GUILayout.BeginVertical("AR Trackable", gsTest); - // - GUILayout.Label("Server: " + worldStorageSettings.serverName, EditorStyles.whiteLargeLabel); - GUILayout.Label("Creator UID: " + creatorUid, EditorStyles.miniLabel); // readonly - EditorGUILayout.Space(); - - //GUILayout.BeginHorizontal(); - uid = EditorGUILayout.TextField("UID (0 = new one)", uid); - EditorGUILayout.Space(); - - GUI.backgroundColor = WorldStorageWindow.arfColors[1]; - if (GUILayout.Button("Get Parameters")) - { - Trackable t = RESTfulTrackableRequest.GetTrackable(worldStorageSettings, uid); - creatorUid = t.CreatorUUID.ToString(); - type = t.GetType().ToString(); - unit = t.Unit.ToString(); - } - GUI.backgroundColor = ori; - - type = EditorGUILayout.TextField("Trackable Type", type); - unit = EditorGUILayout.TextField("Unit System", unit); - - EditorGUILayout.Space(10); - dim = EditorGUILayout.Vector2IntField("Dimension", dim); - - EditorGUILayout.Space(); - GUILayout.Button("Payload from Asset..."); - - EditorGUILayout.Space(); - groupEnabled = EditorGUILayout.BeginToggleGroup("Optional Parameters:", groupEnabled); - EditorGUILayout.IntField("Number of KeyValues", 0); - EditorGUILayout.Space(); - EditorGUILayout.TextField("Key", ""); - EditorGUILayout.TextField("Value", ""); - EditorGUILayout.EndToggleGroup(); - // - GUILayout.EndVertical(); - - GUI.backgroundColor = WorldStorageWindow.arfColors[3]; - if (GUILayout.Button("Delete Trackable")) - { - Debug.Log("Deleting Trackable"); - RESTfulTrackableRequest.DeleteTrackable(worldStorageSettings, uid); - uid = System.Guid.Empty.ToString(); - creatorUid = System.Guid.Empty.ToString(); - type = ""; - unit = ""; - WorldStorageWindow.WorldStorageWindowSingleton.UpdateList(); - WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); - } - GUI.backgroundColor = ori; - - GUI.backgroundColor = WorldStorageWindow.arfColors[2]; - if (GUILayout.Button("Create/Update Trackable")) - { - Debug.Log("PostAddTrackable"); - if (string.IsNullOrEmpty(uid) || uid == "0") uid = System.Guid.Empty.ToString(); - Trackable t = RESTfulTrackableRequest.TrackableFromStrings(uid, cus, worldStorageSettings.creatorUID); - RESTfulTrackableRequest.PostAddTrackable(worldStorageSettings, t); - WorldStorageWindow.WorldStorageWindowSingleton.UpdateList(); - WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); - - uid = t.UUID.ToString(); - type = t.GetType().ToString(); - unit = t.Unit.ToString(); - } - GUI.backgroundColor = ori; - } - - */ - } +// +// 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 + + +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 index dd5ac4d1813dc90ae515e789f26876dbdd5b8c86..3634acd839d8126d8258b4f22e39afae60708461 100644 --- 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 @@ -3,7 +3,10 @@ guid: 8dd64e8d8a545ab45b424402550b55a6 MonoImporter: externalObjects: {} serializedVersion: 2 - defaultReferences: [] + 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: 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 new file mode 100644 index 0000000000000000000000000000000000000000..36c855f14fcdcc3827aed119132b75f97ead4322 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/WorldLinkListener.cs @@ -0,0 +1,27 @@ +using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows; +using ETSI.ARF.WorldStorage; +using ETSI.ARF.WorldStorage.UI; +using UnityEditor; +using UnityEditor.Experimental.GraphView; +using UnityEngine; +using UnityEngine.UIElements; + +namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Graph +{ + public class WorldLinkListener : IEdgeConnectorListener + { + public void OnDrop(GraphView graphView, Edge edge) + { + ARFNode fromNode = edge.output.node as ARFNode; + ARFNode toNode = edge.input.node as ARFNode; + + NodeEditorWindow.ShowWindow((ARFEdgeLink)edge); + //WorldLinkWindow.preFill(fromNode, toNode); + } + + 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/Graph/WorldLinkListener.cs.meta b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/WorldLinkListener.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..e19f2ea2695b2106e4290577b9abef17cb4dd141 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Graph/WorldLinkListener.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 54dbfcfdc75de1b46bc7da09df52db34 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: 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 new file mode 100644 index 0000000000000000000000000000000000000000..856a1f23855c603cdb2b37ca0b742defda852f95 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/NodeEditorWindow.cs @@ -0,0 +1,70 @@ +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/NodeEditorWindow.cs.meta b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/NodeEditorWindow.cs.meta new file mode 100644 index 0000000000000000000000000000000000000000..10797498c8160eb8e60e846ba012c764bd775c18 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/NodeEditorWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e219817d65c8b1f40ad85e6185e89e92 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: 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 f6da0d87d4cc6ff8f44b91e4ec42199f1fd9a311..d6ac48b584c166c3c43af35d916e7b5274361505 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 @@ -26,7 +26,8 @@ using System.Collections.Generic; using UnityEngine; using UnityEditor; using ETSI.ARF.WorldStorage.REST; - +using System; + #if USING_OPENAPI_GENERATOR using Org.OpenAPITools.Api; using Org.OpenAPITools.Model; @@ -66,8 +67,15 @@ namespace ETSI.ARF.WorldStorage.UI private Color ori; private GUIStyle gsTest; + //graph params to generate the node + public bool useCoord; + public float nodePosX = 0; + public float nodePosY = 0; + public static void ShowWindow(WorldStorageServer ws, WorldStorageUser user, string UUID = "") - { + { + Type inspectorType = Type.GetType("UnityEditor.InspectorWindow,UnityEditor.dll"); + GetWindow<TrackableWindow>("Menu Editor", true, inspectorType); winSingleton = EditorWindow.GetWindow(typeof(TrackableWindow), false, WorldStorageWindow.winName) as TrackableWindow; winSingleton.worldStorageServer = ws; winSingleton.worldStorageUser = user; @@ -184,8 +192,18 @@ namespace ETSI.ARF.WorldStorage.UI if (string.IsNullOrEmpty(UUID) || UUID == "0") UUID = System.Guid.Empty.ToString(); Trackable obj = GenerateTrackable(); UUID = TrackableRequest.AddTrackable(worldStorageServer, obj); - WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables(); - WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); + + if (WorldStorageWindow.WorldStorageWindowSingleton != null) + { + WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables(); + WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); + } + if (GraphWindow.graphWindowSingleton != null) + { + UUID = UUID.Replace("\"", ""); + GraphWindow.graphWindowSingleton.createTrackableNode(UUID, nodePosX, nodePosY); + } + Close(); } GUI.backgroundColor = WorldStorageWindow.arfColors[2]; @@ -198,8 +216,16 @@ namespace ETSI.ARF.WorldStorage.UI Trackable obj = GenerateTrackable(); UUID = TrackableRequest.UpdateTrackable(worldStorageServer, obj); } - WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables(); - WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); + if (WorldStorageWindow.WorldStorageWindowSingleton != null) + { + WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables(); + WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); + } + if (GraphWindow.graphWindowSingleton != null) + { + GraphWindow.graphWindowSingleton.Reload(); + } + Close(); } // ########################################################### @@ -212,8 +238,16 @@ namespace ETSI.ARF.WorldStorage.UI creatorUUID = System.Guid.Empty.ToString(); type = Trackable.TrackableTypeEnum.OTHER; unit = UnitSystem.CM; - WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables(); - WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); + if (WorldStorageWindow.WorldStorageWindowSingleton != null) + { + WorldStorageWindow.WorldStorageWindowSingleton.GetTrackables(); + WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); + } + if (GraphWindow.graphWindowSingleton != null) + { + GraphWindow.graphWindowSingleton.Reload(); + } + Close(); } GUI.backgroundColor = ori; @@ -283,7 +317,15 @@ namespace ETSI.ARF.WorldStorage.UI System.Guid _uuid = System.Guid.Parse(UUID); System.Guid _creator = System.Guid.Parse(worldStorageUser.UUID); - Trackable t = new Trackable(_uuid, customName, _creator, type, trackableEncodingInformation, trackablePayload, _localCRS, unit, _trackableSize, keyValueTags); + Trackable t = new Trackable(_uuid, customName, _creator, type, trackableEncodingInformation, trackablePayload, _localCRS, unit, _trackableSize, keyValueTags); + + var posX = new List<String>(); + posX.Add(nodePosX.ToString()); + t.KeyvalueTags["unityAuthoringPosX"] = posX; + var posY = new List<String>(); + posY.Add(nodePosY.ToString()); + t.KeyvalueTags["unityAuthoringPosY"] = posY; + return t; } } diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/TrackableWindow.cs.meta b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/TrackableWindow.cs.meta index 40f6111b39dd386428e0f54851283061c614124f..020c2af305925803868dbb5f22c964e5176c8f49 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/TrackableWindow.cs.meta +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/TrackableWindow.cs.meta @@ -3,7 +3,10 @@ guid: 229d5ea484d30f945b9318581fb4f2da MonoImporter: externalObjects: {} serializedVersion: 2 - defaultReferences: [] + defaultReferences: + - m_ViewDataDictionary: {instanceID: 0} + - worldStorageServer: {fileID: 11400000, guid: 4f997253243de534dad12937f1284975, type: 2} + - worldStorageUser: {instanceID: 0} executionOrder: 0 icon: {instanceID: 0} userData: 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 ae8f0c379215bd756a536fc952252aca8ee6dd3a..328e95017596dfe6793c51b9387201d56bbfe1ef 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 @@ -26,7 +26,8 @@ using System.Collections.Generic; using UnityEngine; using UnityEditor; using ETSI.ARF.WorldStorage.REST; - +using System; + #if USING_OPENAPI_GENERATOR using Org.OpenAPITools.Api; using Org.OpenAPITools.Model; @@ -63,8 +64,15 @@ namespace ETSI.ARF.WorldStorage.UI private Color ori; private GUIStyle gsTest; + //graph params to generate the node + public bool useCoord; + public float nodePosX = 0; + public float nodePosY = 0; + public static void ShowWindow(WorldStorageServer ws, WorldStorageUser user, string UUID = "") - { + { + Type inspectorType = Type.GetType("UnityEditor.InspectorWindow,UnityEditor.dll"); + GetWindow<WorldAnchorWindow>("WorldAnchor Editor", true, inspectorType); winSingleton = EditorWindow.GetWindow(typeof(WorldAnchorWindow), false, WorldStorageWindow.winName) as WorldAnchorWindow; winSingleton.worldStorageServer = ws; winSingleton.worldStorageUser = user; @@ -162,8 +170,17 @@ namespace ETSI.ARF.WorldStorage.UI if (string.IsNullOrEmpty(UUID) || UUID == "0") UUID = System.Guid.Empty.ToString(); WorldAnchor obj = GenerateWorldAnchor(); UUID = WorldAnchorRequest.AddWorldAnchor(worldStorageServer, obj); - WorldStorageWindow.WorldStorageWindowSingleton.GetWorldAnchors(); - WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); + if (WorldStorageWindow.WorldStorageWindowSingleton != null) + { + WorldStorageWindow.WorldStorageWindowSingleton.GetWorldAnchors(); + WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); + } + if (GraphWindow.graphWindowSingleton != null) + { + UUID = UUID.Replace("\"", ""); + GraphWindow.graphWindowSingleton.createAnchorNode(UUID, nodePosX, nodePosY); + } + Close(); } GUI.backgroundColor = WorldStorageWindow.arfColors[2]; @@ -174,10 +191,18 @@ namespace ETSI.ARF.WorldStorage.UI if (!string.IsNullOrEmpty(UUID) && UUID != "0") { WorldAnchor obj = GenerateWorldAnchor(); - UUID = WorldAnchorRequest.UpdateWorldAnchor(worldStorageServer, obj); - WorldStorageWindow.WorldStorageWindowSingleton.GetWorldAnchors(); - WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); + UUID = WorldAnchorRequest.UpdateWorldAnchor(worldStorageServer, obj); + if (WorldStorageWindow.WorldStorageWindowSingleton != null) + { + WorldStorageWindow.WorldStorageWindowSingleton.GetWorldAnchors(); + WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); + } + if (GraphWindow.graphWindowSingleton != null) + { + GraphWindow.graphWindowSingleton.Reload(); + } } + Close(); } // ########################################################### @@ -189,8 +214,16 @@ namespace ETSI.ARF.WorldStorage.UI UUID = System.Guid.Empty.ToString(); creatorUUID = System.Guid.Empty.ToString(); unit = UnitSystem.CM; - WorldStorageWindow.WorldStorageWindowSingleton.GetWorldAnchors(); - WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); + if (WorldStorageWindow.WorldStorageWindowSingleton != null) + { + WorldStorageWindow.WorldStorageWindowSingleton.GetWorldAnchors(); + WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); + } + if (GraphWindow.graphWindowSingleton != null) + { + GraphWindow.graphWindowSingleton.Reload(); + } + Close(); } GUI.backgroundColor = ori; @@ -239,9 +272,9 @@ namespace ETSI.ARF.WorldStorage.UI #else List<double?> trackableDimension = new List<double?>(); #endif - _worldAnchorSize.Add(worldAnchorSize.x); _worldAnchorSize.Add(worldAnchorSize.x); _worldAnchorSize.Add(worldAnchorSize.y); + _worldAnchorSize.Add(worldAnchorSize.z); Debug.Log("Created dimension"); Matrix4x4 localCRS = new Matrix4x4(); @@ -256,7 +289,15 @@ namespace ETSI.ARF.WorldStorage.UI System.Guid _uuid = System.Guid.Parse(UUID); System.Guid _creator = System.Guid.Parse(worldStorageUser.UUID); - WorldAnchor t = new WorldAnchor(_uuid, customName, _creator, _localCRS, unit, _worldAnchorSize, keyValueTags); + WorldAnchor t = new WorldAnchor(_uuid, customName, _creator, _localCRS, unit, _worldAnchorSize, keyValueTags); + + var posX = new List<String>(); + posX.Add(nodePosX.ToString()); + t.KeyvalueTags["unityAuthoringPosX"] = posX; + var posY = new List<String>(); + posY.Add(nodePosY.ToString()); + t.KeyvalueTags["unityAuthoringPosY"] = posY; + return t; } } 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 new file mode 100644 index 0000000000000000000000000000000000000000..d20562f0cfcdcd47452acd25aadfeea9e3065e00 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldGraphWindow.cs @@ -0,0 +1,218 @@ +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.UIElements; +using UnityEngine; +using UnityEngine.UIElements; + +namespace Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Windows +{ + public class WorldGraphWindow : EditorWindow + { + + [HideInInspector] public WorldStorageServer worldStorageServer; + [HideInInspector] public WorldStorageUser worldStorageUser; + + private ARFGraphView myGraph; + + [MenuItem("ARFWorldStorage/Edit Graph...")] + public static void ShowWindow() + { + GetWindow<WorldGraphWindow>("Graph Editor", true, typeof(SceneView)); + } + + public void OnEnable() + { + if (SaveInfo.instance.nodePositions == null) + { + SaveInfo.instance.initNodePos(worldStorageServer); + } + + rootVisualElement.Add(GenerateToolbar()); + + ConstructGraphView(); + myGraph.style.top = Length.Percent(11); + rootVisualElement.Add(myGraph); + } + + //initiate the graphView Attribute + public void ConstructGraphView() + { + myGraph = new ARFGraphView + { + name = "ARF Graph", + worldStorageServer = worldStorageServer, + worldStorageUser = worldStorageUser + }; + //top offset so that the graph does'nt overlap with the rest of the ui + myGraph.style.top = Length.Percent(11); + myGraph.paintWorldStorage(); + myGraph.StretchToParentSize(); + SaveInfo.instance.toReFrame = true; + } + + + void OnGUI() + { + EditorGUILayout.BeginVertical(); + EditorGUILayout.Space(24); + + EditorGUI.BeginChangeCheck(); + worldStorageServer = (WorldStorageServer)EditorGUILayout.ObjectField("World Storage Server", worldStorageServer, typeof(WorldStorageServer), false, GUILayout.Width(500)); + if (EditorGUI.EndChangeCheck()) + { + myGraph.saveElemPositionsInServer(); + rootVisualElement.Remove(myGraph); + + SaveInfo.instance.initNodePos(worldStorageServer); + + ConstructGraphView(); + myGraph.style.top = Length.Percent(11); + rootVisualElement.Add(myGraph); + } + + + //reframe all elements to see them all + if (SaveInfo.instance.toReFrame) + { + myGraph.FrameAllElements(); + SaveInfo.instance.toReFrame = false; + } + EditorGUILayout.EndVertical(); + } + private bool localAndServerDifferent() + { + foreach (ARFNode node in myGraph.nodes) + { + float nodeX = node.GetPosition().x; + float nodeY = node.GetPosition().y; + if (SaveInfo.instance.nodePositions.ContainsKey(node.GUID)){ + float dataX = SaveInfo.instance.nodePositions[node.GUID].x; + float dataY = SaveInfo.instance.nodePositions[node.GUID].y; + if ((nodeX != dataX) || (nodeY != dataY)) + { + return true; + } + } + else + { + return true; + } + } + return false; + } + + + //generate the window's top toolbar + 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 save = new Button(clickEvent: () => + { + myGraph.saveElemPositionsInServer(); + }) + { + text = "Save" + }; + toolbar.Add(save); + + return toolbar; + } + } + + public class SaveInfo : ScriptableSingleton<SaveInfo> + { + [SerializeField] + public Dictionary<String, Rect> nodePositions; + public List<String> linkIds; + + public List<String> elemsToRemove; + + //keep the info of the graph reframe + public Boolean toReFrame = false; + + public WorldStorageServer worldStorageServer; + + public void initNodePos(WorldStorageServer server) + { + worldStorageServer = server; + + instance.nodePositions = new Dictionary<string, Rect>(); + foreach (Trackable track in TrackableRequest.GetAllTrackables(worldStorageServer)) + { + if (track.KeyvalueTags.ContainsKey("unityAuthoringPosX") && track.KeyvalueTags.ContainsKey("unityAuthoringPosY")) + { + var posX = RoundToNearestHalf(float.Parse(track.KeyvalueTags["unityAuthoringPosX"][0])); + var posY = RoundToNearestHalf(float.Parse(track.KeyvalueTags["unityAuthoringPosY"][0])); + Rect trackPos = new Rect(posX, posY, 135, 77); + instance.nodePositions[track.UUID.ToString()] = trackPos; + } + else + { + Rect trackPos = new Rect(0, 0, 135, 77); + instance.nodePositions[track.UUID.ToString()] = trackPos; + } + } + foreach (WorldAnchor wa in WorldAnchorRequest.GetAllWorldAnchors(worldStorageServer)) + { + if (wa.KeyvalueTags.ContainsKey("unityAuthoringPosX") && wa.KeyvalueTags.ContainsKey("unityAuthoringPosY")) + { + var posX = RoundToNearestHalf(float.Parse(wa.KeyvalueTags["unityAuthoringPosX"][0])); + var posY = RoundToNearestHalf(float.Parse(wa.KeyvalueTags["unityAuthoringPosY"][0])); + Rect waPos = new Rect(posX, posY, 135, 77); + instance.nodePositions[wa.UUID.ToString()] = waPos; + } + else + { + Rect trackPos = new Rect(0, 0, 135, 77); + instance.nodePositions[wa.UUID.ToString()] = trackPos; + } + } + + instance.linkIds = new List<string>(); + foreach (WorldLink link in WorldLinkRequest.GetAllWorldLinks(worldStorageServer)) + { + instance.linkIds.Add(link.UUID.ToString()); + } + instance.toReFrame = true; + + instance.elemsToRemove = new List<string>(); + } + + //method to predict the position of a node (the float that will be saved in the PositionInfo singleton) + public static float RoundToNearestHalf(float a) + { + return a = Mathf.Round(a * 2f) * 0.5f; + } + + + } +} \ 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 new file mode 100644 index 0000000000000000000000000000000000000000..ad87e74086ff41b3f880eabd557dad72ed921bc7 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldGraphWindow.cs.meta @@ -0,0 +1,14 @@ +fileFormatVersion: 2 +guid: 2c1a0c92306453d46897c1af6cb5c2f9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: + - m_ViewDataDictionary: {instanceID: 0} + - worldStorageServer: {fileID: 11400000, guid: 777684ed8f62c9d408a1813e8382c676, 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/Windows/WorldLinkWindow.cs b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldLinkWindow.cs index 039ca12bd60d73fa1e2c80918e3796763059ee4b..bbd3b002ae694f5d2721034780c9e70294f1b147 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldLinkWindow.cs +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldLinkWindow.cs @@ -1,299 +1,365 @@ -// -// 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 -#define isDEBUG - -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; -using IO.Swagger.Model; -#endif - -namespace ETSI.ARF.WorldStorage.UI -{ - public class WorldLinkWindow : EditorWindow - { - static public WorldLinkWindow winSingleton; - - [HideInInspector] public WorldStorageServer worldStorageServer; - [HideInInspector] public WorldStorageUser worldStorageUser; - - [SerializeField] public List<string> anchors = new List<string>(); - - bool groupEnabled; - private static GUILayoutOption miniButtonWidth = GUILayout.Width(50); - - // World Anchors params - string UUID = System.Guid.Empty.ToString(); - string customName = "(no name for World Links)"; - string creatorUUID = System.Guid.Empty.ToString(); - // From... - private bool showListFrom = true; - string fromName = "(none)"; - string fromUUID = System.Guid.Empty.ToString(); - // To... - private bool showListTo = true; - string toName = "(none)"; - string toUUID = System.Guid.Empty.ToString(); - - UnitSystem unit = UnitSystem.CM; - ObjectType fromType = ObjectType.NotIdentified, toType = ObjectType.NotIdentified; - Vector3 localCRS_pos; - Vector3 localCRS_rot; - [SerializeField] Dictionary<string, List<string>> keyValueTags = new Dictionary<string, List<string>>(); - - // UI stuffs - private Vector2 scrollPos; - private Color ori; - private GUIStyle gsTest; - - public static void ShowWindow(WorldStorageServer ws, WorldStorageUser user, string UUID = "") - { - winSingleton = EditorWindow.GetWindow(typeof(WorldLinkWindow), false, WorldStorageWindow.winName) as WorldLinkWindow; - winSingleton.worldStorageServer = ws; - winSingleton.worldStorageUser = user; - if (!string.IsNullOrEmpty(UUID)) - { - winSingleton.UUID = UUID; - winSingleton.GetWorldLinkParams(); - } - } - - public WorldLinkWindow() - { - // init somne stuffs - } - - void OnGUI() - { - ori = GUI.backgroundColor; // remember ori color - - gsTest = new GUIStyle("window"); - gsTest.normal.textColor = WorldStorageWindow.arfColors[0]; - gsTest.fontStyle = FontStyle.Bold; - - scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.ExpandWidth(true)); - WorldStorageWindow.DrawCopyright(); - - DrawAnchorStuffs(); - - EditorGUILayout.EndScrollView(); - - if (GUILayout.Button("Close Window")) - { - Close(); - } - } - - void DrawAnchorStuffs() - { - GUILayout.BeginVertical("World Link Editor", gsTest); - // - GUILayout.Label("Server: " + worldStorageServer.serverName, EditorStyles.whiteLargeLabel); - GUILayout.Label("User: " + worldStorageUser.userName, EditorStyles.whiteLargeLabel); - EditorGUILayout.Space(); - - //GUILayout.BeginHorizontal(); - customName = EditorGUILayout.TextField("Name of Link", customName); -#if isDEBUG - GUILayout.Label("UUID: " + UUID, EditorStyles.miniLabel); // readonly - GUILayout.Label("Creator UID: " + creatorUUID, EditorStyles.miniLabel); // readonly -#endif - EditorGUILayout.Space(); - - GUI.backgroundColor = WorldStorageWindow.arfColors[1]; - if (GUILayout.Button("Read Parameters")) - { - UUID = WorldStorageWindow.GetUUIDFromString(customName); - if (UUID == null) UUID = customName; // try this - GetWorldLinkParams(); - } - GUI.backgroundColor = ori; - - unit = (UnitSystem)EditorGUILayout.EnumPopup("Unit System:", unit); - - EditorGUILayout.Space(); - showListFrom = EditorGUILayout.Foldout(showListFrom, "Parent Object (From)"); - if (showListFrom) - { - EditorGUILayout.BeginHorizontal(); - fromUUID = EditorGUILayout.TextField("UUID", fromUUID); - GUI.backgroundColor = WorldStorageWindow.arfColors[1]; - if (GUILayout.Button("Find", EditorStyles.miniButtonLeft, miniButtonWidth)) - { - // TODO Request the object from the server - fromName = "(not implemented yet)"; - fromType = ObjectType.NotIdentified; - } - EditorGUILayout.EndHorizontal(); - GUI.backgroundColor = ori; - fromName = EditorGUILayout.TextField("Name", fromName); - fromType = (ObjectType)EditorGUILayout.EnumPopup("Type:", fromType); - } - - EditorGUILayout.Space(); - showListTo = EditorGUILayout.Foldout(showListTo, "Child Object (To)"); - if (showListTo) - { - EditorGUILayout.BeginHorizontal(); - toUUID = EditorGUILayout.TextField("UUID", toUUID); - GUI.backgroundColor = WorldStorageWindow.arfColors[1]; - if (GUILayout.Button("Find", EditorStyles.miniButtonLeft, miniButtonWidth)) - { - // TODO Request the object from the server - toName = "(not implemented yet)"; - toType = ObjectType.NotIdentified; - } - EditorGUILayout.EndHorizontal(); - GUI.backgroundColor = ori; - toName = EditorGUILayout.TextField("Name", toName); - toType = (ObjectType)EditorGUILayout.EnumPopup("Type:", toType); - } - - EditorGUILayout.Space(10); - GUILayout.Label("Local CRS:"); - localCRS_pos = EditorGUILayout.Vector3Field("Position:", localCRS_pos); - localCRS_rot = EditorGUILayout.Vector3Field("Rotation:", localCRS_rot); - - EditorGUILayout.Space(); - groupEnabled = EditorGUILayout.BeginToggleGroup("Optional Parameters:", groupEnabled); - //EditorGUILayout.IntField("Number of KeyValues", 0); - //EditorGUILayout.Space(); - //EditorGUILayout.TextField("Key", ""); - //EditorGUILayout.TextField("Value", ""); - if (GUILayout.Button("Generate Dummy Key Values")) - { - // dummy - keyValueTags.Clear(); - keyValueTags.Add("Location", new List<string> { "Room1" }); - } - EditorGUILayout.EndToggleGroup(); - // - GUILayout.EndVertical(); - - // ########################################################### - GUI.backgroundColor = WorldStorageWindow.arfColors[1]; - if (GUILayout.Button("Create New World Link")) - { - Debug.Log("POST World Link"); - - UUID = "0"; - if (string.IsNullOrEmpty(UUID) || UUID == "0") UUID = System.Guid.Empty.ToString(); - WorldLink obj = GenerateWorldLink(); - UUID = WorldLinkRequest.AddWorldLink(worldStorageServer, obj); - WorldStorageWindow.WorldStorageWindowSingleton.GetWorldLinks(); - WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); - } - - GUI.backgroundColor = WorldStorageWindow.arfColors[2]; - if (GUILayout.Button("Modify World Link")) - { - Debug.Log("PUT World Link"); - - if (!string.IsNullOrEmpty(UUID) && UUID != "0") - { - WorldLink obj = GenerateWorldLink(); - UUID = WorldLinkRequest.UpdateWorldLink(worldStorageServer, obj); - WorldStorageWindow.WorldStorageWindowSingleton.GetWorldLinks(); - WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); - } - } - - // ########################################################### - GUI.backgroundColor = WorldStorageWindow.arfColors[3]; - if (GUILayout.Button("Delete World Link")) - { - Debug.Log("Delete World Link"); - WorldLinkRequest.DeleteWorldLink(worldStorageServer, UUID); - UUID = System.Guid.Empty.ToString(); - creatorUUID = System.Guid.Empty.ToString(); - unit = UnitSystem.CM; - WorldStorageWindow.WorldStorageWindowSingleton.GetWorldLinks(); - WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); - } - GUI.backgroundColor = ori; - - // ########################################################### - GUI.backgroundColor = WorldStorageWindow.arfColors[5]; - if (GUILayout.Button("Generate GameObject Component")) - { - } - GUI.backgroundColor = ori; - } - - private void GetWorldLinkParams() - { - WorldLink obj = WorldLinkRequest.GetWorldLink(worldStorageServer, UUID); - //customName = obj.Name; - creatorUUID = obj.CreatorUUID.ToString(); - fromUUID = obj.UUIDFrom.ToString(); - toUUID = obj.UUIDTo.ToString(); - fromType = obj.TypeFrom; - toType = obj.TypeTo; - unit = obj.Unit; - if (obj.Transform.Count == 16) - { - Matrix4x4 localCRS = new Matrix4x4(); - localCRS.m00 = obj.Transform[0]; localCRS.m01 = obj.Transform[1]; localCRS.m02 = obj.Transform[2]; localCRS.m03 = obj.Transform[3]; - localCRS.m10 = obj.Transform[4]; localCRS.m11 = obj.Transform[5]; localCRS.m12 = obj.Transform[6]; localCRS.m13 = obj.Transform[7]; - localCRS.m20 = obj.Transform[8]; localCRS.m21 = obj.Transform[9]; localCRS.m22 = obj.Transform[10]; localCRS.m23 = obj.Transform[11]; - localCRS.m30 = obj.Transform[12]; localCRS.m31 = obj.Transform[13]; localCRS.m32 = obj.Transform[14]; localCRS.m33 = obj.Transform[15]; - localCRS_pos = localCRS.GetPosition(); - localCRS_rot = localCRS.rotation.eulerAngles; - } - else - { - localCRS_pos = Vector3.zero; - localCRS_rot = Vector3.zero; - } - keyValueTags = obj.KeyvalueTags; - this.Repaint(); // TODO - } - - public WorldLink GenerateWorldLink() - { - Matrix4x4 localCRS = new Matrix4x4(); - localCRS = Matrix4x4.TRS(localCRS_pos, Quaternion.Euler(localCRS_rot), Vector3.one); - List<float> _transform3d = 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, - }; - - System.Guid _uuid = System.Guid.Parse(UUID); - System.Guid _creator = System.Guid.Parse(worldStorageUser.UUID); - System.Guid _from = System.Guid.Parse(fromUUID); - System.Guid _to = System.Guid.Parse(toUUID); - WorldLink t = new WorldLink(_uuid, _creator, _to, _from, fromType, toType, _transform3d, unit, keyValueTags); - return t; - } - } +// +// 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 +#define isDEBUG + +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEditor; +using ETSI.ARF.WorldStorage.REST; +using Assets.ETSI.ARF.ARF_World_Storage_API.Editor.Graph; +using System; + +#if USING_OPENAPI_GENERATOR +using Org.OpenAPITools.Api; +using Org.OpenAPITools.Model; +#else +using IO.Swagger.Api; +using IO.Swagger.Model; +#endif + +namespace ETSI.ARF.WorldStorage.UI +{ + public class WorldLinkWindow : EditorWindow + { + static public WorldLinkWindow winSingleton; + + [HideInInspector] public WorldStorageServer worldStorageServer; + [HideInInspector] public WorldStorageUser worldStorageUser; + + [SerializeField] public List<string> anchors = new List<string>(); + + bool groupEnabled; + private static GUILayoutOption miniButtonWidth = GUILayout.Width(50); + + // World Anchors params + string UUID = System.Guid.Empty.ToString(); + string customName = "(no name for World Links)"; + string creatorUUID = System.Guid.Empty.ToString(); + // From... + private bool showListFrom = true; + string fromName = "(none)"; + string fromUUID = System.Guid.Empty.ToString(); + // To... + private bool showListTo = true; + string toName = "(none)"; + string toUUID = System.Guid.Empty.ToString(); + + UnitSystem unit = UnitSystem.CM; + ObjectType fromType = ObjectType.NotIdentified, toType = ObjectType.NotIdentified; + Vector3 localCRS_pos; + Vector3 localCRS_rot; + [SerializeField] Dictionary<string, List<string>> keyValueTags = new Dictionary<string, List<string>>(); + + // UI stuffs + private Vector2 scrollPos; + private Color ori; + private GUIStyle gsTest; + + //graph + public ARFEdgeLink graphEdge; + + public static void ShowWindow(WorldStorageServer ws, WorldStorageUser user, string UUID = "") + { + Type inspectorType = Type.GetType("UnityEditor.InspectorWindow,UnityEditor.dll"); + GetWindow<WorldLinkWindow>("Menu Editor", true, inspectorType); + winSingleton = EditorWindow.GetWindow(typeof(WorldLinkWindow), false, WorldStorageWindow.winName) as WorldLinkWindow; + winSingleton.worldStorageServer = ws; + winSingleton.worldStorageUser = user; + if (!string.IsNullOrEmpty(UUID)) + { + winSingleton.UUID = UUID; + winSingleton.GetWorldLinkParams(); + } + } + + public WorldLinkWindow() + { + // init somne stuffs + } + + void OnGUI() + { + ori = GUI.backgroundColor; // remember ori color + + gsTest = new GUIStyle("window"); + gsTest.normal.textColor = WorldStorageWindow.arfColors[0]; + gsTest.fontStyle = FontStyle.Bold; + + scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.ExpandWidth(true)); + WorldStorageWindow.DrawCopyright(); + + DrawAnchorStuffs(); + + EditorGUILayout.EndScrollView(); + + if (GUILayout.Button("Close Window")) + { + Close(); + } + } + + void DrawAnchorStuffs() + { + GUILayout.BeginVertical("World Link Editor", gsTest); + // + GUILayout.Label("Server: " + worldStorageServer.serverName, EditorStyles.whiteLargeLabel); + GUILayout.Label("User: " + worldStorageUser.userName, EditorStyles.whiteLargeLabel); + EditorGUILayout.Space(); + + //GUILayout.BeginHorizontal(); + customName = EditorGUILayout.TextField("Name of Link", customName); +#if isDEBUG + GUILayout.Label("UUID: " + UUID, EditorStyles.miniLabel); // readonly + GUILayout.Label("Creator UID: " + creatorUUID, EditorStyles.miniLabel); // readonly +#endif + EditorGUILayout.Space(); + + GUI.backgroundColor = WorldStorageWindow.arfColors[1]; + if (GUILayout.Button("Read Parameters")) + { + UUID = WorldStorageWindow.GetUUIDFromString(customName); + if (UUID == null) UUID = customName; // try this + GetWorldLinkParams(); + } + GUI.backgroundColor = ori; + + unit = (UnitSystem)EditorGUILayout.EnumPopup("Unit System:", unit); + + EditorGUILayout.Space(); + showListFrom = EditorGUILayout.Foldout(showListFrom, "Parent Object (From)"); + if (showListFrom) + { + EditorGUILayout.BeginHorizontal(); + fromUUID = EditorGUILayout.TextField("UUID", fromUUID); + GUI.backgroundColor = WorldStorageWindow.arfColors[1]; + if (GUILayout.Button("Find", EditorStyles.miniButtonLeft, miniButtonWidth)) + { + // TODO Request the object from the server + fromName = "(not implemented yet)"; + fromType = ObjectType.NotIdentified; + } + EditorGUILayout.EndHorizontal(); + GUI.backgroundColor = ori; + fromName = EditorGUILayout.TextField("Name", fromName); + fromType = (ObjectType)EditorGUILayout.EnumPopup("Type:", fromType); + } + + EditorGUILayout.Space(); + showListTo = EditorGUILayout.Foldout(showListTo, "Child Object (To)"); + if (showListTo) + { + EditorGUILayout.BeginHorizontal(); + toUUID = EditorGUILayout.TextField("UUID", toUUID); + GUI.backgroundColor = WorldStorageWindow.arfColors[1]; + if (GUILayout.Button("Find", EditorStyles.miniButtonLeft, miniButtonWidth)) + { + // TODO Request the object from the server + toName = "(not implemented yet)"; + toType = ObjectType.NotIdentified; + } + EditorGUILayout.EndHorizontal(); + GUI.backgroundColor = ori; + toName = EditorGUILayout.TextField("Name", toName); + toType = (ObjectType)EditorGUILayout.EnumPopup("Type:", toType); + } + + EditorGUILayout.Space(10); + GUILayout.Label("Local CRS:"); + localCRS_pos = EditorGUILayout.Vector3Field("Position:", localCRS_pos); + localCRS_rot = EditorGUILayout.Vector3Field("Rotation:", localCRS_rot); + + EditorGUILayout.Space(); + groupEnabled = EditorGUILayout.BeginToggleGroup("Optional Parameters:", groupEnabled); + //EditorGUILayout.IntField("Number of KeyValues", 0); + //EditorGUILayout.Space(); + //EditorGUILayout.TextField("Key", ""); + //EditorGUILayout.TextField("Value", ""); + if (GUILayout.Button("Generate Dummy Key Values")) + { + // dummy + keyValueTags.Clear(); + keyValueTags.Add("Location", new List<string> { "Room1" }); + } + EditorGUILayout.EndToggleGroup(); + // + GUILayout.EndVertical(); + + // ########################################################### + GUI.backgroundColor = WorldStorageWindow.arfColors[1]; + if (GUILayout.Button("Create New World Link")) + { + UUID = "0"; + if (string.IsNullOrEmpty(UUID) || UUID == "0") UUID = System.Guid.Empty.ToString(); + WorldLink obj = GenerateWorldLink(); + UUID = WorldLinkRequest.AddWorldLink(worldStorageServer, obj); + + if (WorldStorageWindow.WorldStorageWindowSingleton != null) + { + WorldStorageWindow.WorldStorageWindowSingleton.GetWorldLinks(); + WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); + } + if (graphEdge != null/*GraphWindow.graphWindowSingleton != null*/) + { + UUID = UUID.Replace("\"", ""); + obj.UUID = System.Guid.Parse(UUID); + graphEdge.worldLink = obj; + } + Close(); + } + + GUI.backgroundColor = WorldStorageWindow.arfColors[2]; + if (GUILayout.Button("Modify World Link")) + { + Debug.Log("PUT World Link"); + + if (!string.IsNullOrEmpty(UUID) && UUID != "0") + { + WorldLink obj = GenerateWorldLink(); + UUID = WorldLinkRequest.UpdateWorldLink(worldStorageServer, obj); + + if (WorldStorageWindow.WorldStorageWindowSingleton != null) + { + WorldStorageWindow.WorldStorageWindowSingleton.GetWorldLinks(); + WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); + } + } + Close(); + } + + // ########################################################### + GUI.backgroundColor = WorldStorageWindow.arfColors[3]; + if (GUILayout.Button("Delete World Link")) + { + Debug.Log("Delete World Link"); + WorldLinkRequest.DeleteWorldLink(worldStorageServer, UUID); + UUID = System.Guid.Empty.ToString(); + creatorUUID = System.Guid.Empty.ToString(); + unit = UnitSystem.CM; + + if (WorldStorageWindow.WorldStorageWindowSingleton != null) + { + WorldStorageWindow.WorldStorageWindowSingleton.GetWorldLinks(); + WorldStorageWindow.WorldStorageWindowSingleton.Repaint(); + } + Close(); + } + GUI.backgroundColor = ori; + + // ########################################################### + GUI.backgroundColor = WorldStorageWindow.arfColors[5]; + if (GUILayout.Button("Generate GameObject Component")) + { + } + GUI.backgroundColor = ori; + } + + private void GetWorldLinkParams() + { + WorldLink obj = WorldLinkRequest.GetWorldLink(worldStorageServer, UUID); + //customName = obj.Name; + creatorUUID = obj.CreatorUUID.ToString(); + fromUUID = obj.UUIDFrom.ToString(); + toUUID = obj.UUIDTo.ToString(); + fromType = obj.TypeFrom; + toType = obj.TypeTo; + unit = obj.Unit; + if (obj.Transform.Count == 16) + { + Matrix4x4 localCRS = new Matrix4x4(); + localCRS.m00 = obj.Transform[0]; localCRS.m01 = obj.Transform[1]; localCRS.m02 = obj.Transform[2]; localCRS.m03 = obj.Transform[3]; + localCRS.m10 = obj.Transform[4]; localCRS.m11 = obj.Transform[5]; localCRS.m12 = obj.Transform[6]; localCRS.m13 = obj.Transform[7]; + localCRS.m20 = obj.Transform[8]; localCRS.m21 = obj.Transform[9]; localCRS.m22 = obj.Transform[10]; localCRS.m23 = obj.Transform[11]; + localCRS.m30 = obj.Transform[12]; localCRS.m31 = obj.Transform[13]; localCRS.m32 = obj.Transform[14]; localCRS.m33 = obj.Transform[15]; + localCRS_pos = localCRS.GetPosition(); + localCRS_rot = localCRS.rotation.eulerAngles; + } + else + { + localCRS_pos = Vector3.zero; + localCRS_rot = Vector3.zero; + } + keyValueTags = obj.KeyvalueTags; + this.Repaint(); // TODO + } + + public WorldLink GenerateWorldLink() + { + Matrix4x4 localCRS = new Matrix4x4(); + localCRS = Matrix4x4.TRS(localCRS_pos, Quaternion.Euler(localCRS_rot), Vector3.one); + List<float> _transform3d = 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, + }; + + System.Guid _uuid = System.Guid.Parse(UUID); + System.Guid _creator = System.Guid.Parse(worldStorageUser.UUID); + System.Guid _from = System.Guid.Parse(fromUUID); + System.Guid _to = System.Guid.Parse(toUUID); + WorldLink t = new WorldLink(_uuid, _creator, _from, _to, fromType, toType, _transform3d, unit, keyValueTags); + return t; + } + + public static void preFill(ARFNode nodeFrom, ARFNode nodeTo) + { + //fromNode + ARFNodeTrackable nodeFromTrackable = nodeFrom as ARFNodeTrackable; + ARFNodeWorldAnchor nodeFromWorldAnchor = nodeFrom as ARFNodeWorldAnchor; + if (nodeFromTrackable != null) + { + Trackable trackFrom = nodeFromTrackable.trackable; + winSingleton.fromName = trackFrom.Name; + winSingleton.fromUUID = trackFrom.UUID.ToString(); + winSingleton.fromType = ObjectType.Trackable; + } + else if (nodeFromWorldAnchor != null) + { + WorldAnchor worldAnchorFrom = nodeFromWorldAnchor.worldAnchor; + winSingleton.fromName = worldAnchorFrom.Name; + winSingleton.fromUUID = worldAnchorFrom.UUID.ToString(); + winSingleton.fromType = ObjectType.WorldAnchor; + } + + //toNode + ARFNodeTrackable nodeToTrackable = nodeTo as ARFNodeTrackable; + ARFNodeWorldAnchor nodeToWorldAnchor = nodeTo as ARFNodeWorldAnchor; + if (nodeToTrackable != null) + { + Trackable trackTo = nodeToTrackable.trackable; + winSingleton.toName = trackTo.Name; + winSingleton.toUUID = trackTo.UUID.ToString(); + winSingleton.toType = ObjectType.Trackable; + } + else if (nodeToWorldAnchor != null) + { + WorldAnchor worldAnchorTo = nodeToWorldAnchor.worldAnchor; + winSingleton.toName = worldAnchorTo.Name; + winSingleton.toUUID = worldAnchorTo.UUID.ToString(); + winSingleton.toType = ObjectType.WorldAnchor; + } + winSingleton.Repaint(); + } + } } \ No newline at end of file diff --git a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldStorageWindow.cs.meta b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldStorageWindow.cs.meta index c8d7fb07f3381194035bfdd86bde1d0ea9b49ac6..ec99c51dab094a4ad96d5a8815ad02617d7c3307 100644 --- a/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldStorageWindow.cs.meta +++ b/Assets/ETSI.ARF/ARF World Storage API/Editor/Windows/WorldStorageWindow.cs.meta @@ -3,7 +3,10 @@ guid: a1647df9b48bf4f49a664a929fff57ff MonoImporter: externalObjects: {} serializedVersion: 2 - defaultReferences: [] + defaultReferences: + - m_ViewDataDictionary: {instanceID: 0} + - worldStorageServer: {fileID: 11400000, guid: 4f997253243de534dad12937f1284975, type: 2} + - worldStorageUser: {fileID: 11400000, guid: c0696089e4a855b46ad490437919b1e8, type: 2} executionOrder: 0 icon: {instanceID: 0} userData: diff --git a/Assets/ETSI.ARF/ARF World Storage API/Materials.meta b/Assets/ETSI.ARF/ARF World Storage API/Materials.meta new file mode 100644 index 0000000000000000000000000000000000000000..3f1c3d96d5cbfcab3996a3e6a46aba00213712c0 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/Materials.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b5cde36cc09a55741b364219c48efe3e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ETSI.ARF/ARF World Storage API/World Storage/LocalHost8080.asset b/Assets/ETSI.ARF/ARF World Storage API/World Storage/LocalHost8080.asset new file mode 100644 index 0000000000000000000000000000000000000000..d00574d15efa157ab1299a9cf17b9e26af1de824 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/World Storage/LocalHost8080.asset @@ -0,0 +1,19 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e4b7be4c33f68d0418c3b4e1a7053d91, type: 3} + m_Name: LocalHost8080 + m_EditorClassIdentifier: + serverName: Local hosted World Storage + company: b<>com + basePath: http://10.55.11.9 + port: 8080 + currentUser: {fileID: 11400000, guid: c0696089e4a855b46ad490437919b1e8, type: 2} diff --git a/Assets/ETSI.ARF/ARF World Storage API/World Storage/LocalHost8080.asset.meta b/Assets/ETSI.ARF/ARF World Storage API/World Storage/LocalHost8080.asset.meta new file mode 100644 index 0000000000000000000000000000000000000000..d979dc502f9499f33ff9b43ccc4bef65948c8d65 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/World Storage/LocalHost8080.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 3a9ba82f4e8dd124ca2b005861c64d01 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/ETSI.ARF/ARF World Storage API/World Storage/LocalHost8081.asset b/Assets/ETSI.ARF/ARF World Storage API/World Storage/LocalHost8081.asset new file mode 100644 index 0000000000000000000000000000000000000000..66e0b5042d3c94a77c747a6b66c6404462478bf0 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/World Storage/LocalHost8081.asset @@ -0,0 +1,19 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: e4b7be4c33f68d0418c3b4e1a7053d91, type: 3} + m_Name: LocalHost8081 + m_EditorClassIdentifier: + serverName: local hosted 8081 + company: b<>com + basePath: http://10.55.11.9 + port: 8081 + currentUser: {fileID: 11400000, guid: c0696089e4a855b46ad490437919b1e8, type: 2} diff --git a/Assets/ETSI.ARF/ARF World Storage API/World Storage/LocalHost8081.asset.meta b/Assets/ETSI.ARF/ARF World Storage API/World Storage/LocalHost8081.asset.meta new file mode 100644 index 0000000000000000000000000000000000000000..b86dce60532dd1b5b3deaf953ae03c1f9c9a1892 --- /dev/null +++ b/Assets/ETSI.ARF/ARF World Storage API/World Storage/LocalHost8081.asset.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 777684ed8f62c9d408a1813e8382c676 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/ProjectSettings/EditorSettings.asset b/ProjectSettings/EditorSettings.asset index de5d0b2dff999c2fb46455e5a995c4dbebc8c727..621c5458599cc89fedd54048a072cc35b8fb6171 100644 --- a/ProjectSettings/EditorSettings.asset +++ b/ProjectSettings/EditorSettings.asset @@ -4,7 +4,6 @@ EditorSettings: m_ObjectHideFlags: 0 serializedVersion: 11 - m_ExternalVersionControlSupport: Visible Meta Files m_SerializationMode: 2 m_LineEndingsForNewScripts: 0 m_DefaultBehaviorMode: 0 @@ -12,19 +11,32 @@ EditorSettings: m_PrefabUIEnvironment: {fileID: 0} m_SpritePackerMode: 0 m_SpritePackerPaddingPower: 1 + m_Bc7TextureCompressor: 0 m_EtcTextureCompressorBehavior: 1 m_EtcTextureFastCompressor: 1 m_EtcTextureNormalCompressor: 2 m_EtcTextureBestCompressor: 4 m_ProjectGenerationIncludedExtensions: txt;xml;fnt;cd;asmdef;rsp;asmref m_ProjectGenerationRootNamespace: - m_CollabEditorSettings: - inProgressEnabled: 1 m_EnableTextureStreamingInEditMode: 1 m_EnableTextureStreamingInPlayMode: 1 m_AsyncShaderCompilation: 1 + m_CachingShaderPreprocessor: 1 + m_PrefabModeAllowAutoSave: 1 m_EnterPlayModeOptionsEnabled: 0 m_EnterPlayModeOptions: 3 - m_ShowLightmapResolutionOverlay: 1 + m_GameObjectNamingDigits: 1 + m_GameObjectNamingScheme: 0 + m_AssetNamingUsesSpace: 1 m_UseLegacyProbeSampleCount: 0 - m_SerializeInlineMappingsOnOneLine: 1 \ No newline at end of file + m_SerializeInlineMappingsOnOneLine: 1 + m_DisableCookiesInLightmapper: 0 + m_AssetPipelineMode: 1 + m_RefreshImportMode: 0 + m_CacheServerMode: 0 + m_CacheServerEndpoint: + m_CacheServerNamespacePrefix: default + m_CacheServerEnableDownload: 1 + m_CacheServerEnableUpload: 1 + m_CacheServerEnableAuth: 0 + m_CacheServerEnableTls: 0 diff --git a/ProjectSettings/ProjectSettings.asset b/ProjectSettings/ProjectSettings.asset index e29f9aa0df1eaf8d6145d251ec40fad2ccab8568..cb14926b1ea41efba0e033bbc94eb0386827302e 100644 --- a/ProjectSettings/ProjectSettings.asset +++ b/ProjectSettings/ProjectSettings.asset @@ -152,7 +152,8 @@ PlayerSettings: resolutionScalingMode: 0 androidSupportedAspectRatio: 1 androidMaxAspectRatio: 2.1 - applicationIdentifier: {} + applicationIdentifier: + Standalone: com.DefaultCompany.My-project buildNumber: Standalone: 0 iPhone: 0 diff --git a/UserSettings/Layouts/default-2021.dwlt b/UserSettings/Layouts/default-2021.dwlt index db25c22e7a3030a569462bb864fd244411d141b5..aff4bb35650cf53043c42f28eca027b3561aa8af 100644 --- a/UserSettings/Layouts/default-2021.dwlt +++ b/UserSettings/Layouts/default-2021.dwlt @@ -1,30 +1,6 @@ %YAML 1.1 %TAG !u! tag:unity3d.com,2011: --- !u!114 &1 -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: 0 - m_Script: {fileID: 12004, guid: 0000000000000000e000000000000000, type: 0} - m_Name: - m_EditorClassIdentifier: - m_PixelRect: - serializedVersion: 2 - x: 464 - y: 157.33333 - width: 696.44446 - height: 876.8889 - m_ShowMode: 0 - m_Title: ETSI ARF - Authoring Editor - m_RootView: {fileID: 4} - m_MinSize: {x: 100, y: 121} - m_MaxSize: {x: 4000, y: 4021} - m_Maximized: 0 ---- !u!114 &2 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -38,118 +14,17 @@ MonoBehaviour: m_EditorClassIdentifier: m_PixelRect: serializedVersion: 2 - x: 12.888889 - y: 72 - width: 1365.3334 - height: 935.11115 + x: 0 + y: 42 + width: 1600 + height: 818 m_ShowMode: 4 - m_Title: Console - m_RootView: {fileID: 11} + m_Title: Graph Editor + m_RootView: {fileID: 6} m_MinSize: {x: 875, y: 300} m_MaxSize: {x: 10000, y: 10000} - m_Maximized: 0 ---- !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: 0 - m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} - m_Name: WorldStorageWindow - m_EditorClassIdentifier: - m_Children: [] - m_Position: - serializedVersion: 2 - x: 0 - y: 0 - width: 696.44446 - height: 876.8889 - m_MinSize: {x: 100, y: 121} - m_MaxSize: {x: 4000, y: 4021} - m_ActualView: {fileID: 17} - m_Panes: - - {fileID: 17} - m_Selected: 0 - m_LastSelected: 0 ---- !u!114 &4 -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: 0 - m_Script: {fileID: 12010, guid: 0000000000000000e000000000000000, type: 0} - m_Name: - m_EditorClassIdentifier: - m_Children: - - {fileID: 3} - m_Position: - serializedVersion: 2 - x: 0 - y: 0 - width: 696.44446 - height: 876.8889 - m_MinSize: {x: 100, y: 121} - m_MaxSize: {x: 4000, y: 4021} - vertical: 0 - controlID: 1081 ---- !u!114 &5 -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: 0 - m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} - m_Name: ConsoleWindow - m_EditorClassIdentifier: - m_Children: [] - m_Position: - serializedVersion: 2 - x: 469.33334 - y: 0 - width: 534.22217 - height: 350.00006 - m_MinSize: {x: 102, y: 121} - m_MaxSize: {x: 4002, y: 4021} - m_ActualView: {fileID: 24} - m_Panes: - - {fileID: 24} - m_Selected: 0 - m_LastSelected: 0 ---- !u!114 &6 -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: 0 - m_Script: {fileID: 12010, guid: 0000000000000000e000000000000000, type: 0} - m_Name: - m_EditorClassIdentifier: - m_Children: - - {fileID: 10} - - {fileID: 5} - m_Position: - serializedVersion: 2 - x: 0 - y: 535.1111 - width: 1003.55554 - height: 350.00006 - m_MinSize: {x: 200, y: 100} - m_MaxSize: {x: 16192, y: 8096} - vertical: 0 - controlID: 17 ---- !u!114 &7 + m_Maximized: 1 +--- !u!114 &2 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -162,19 +37,19 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Children: - - {fileID: 14} - - {fileID: 8} + - {fileID: 9} + - {fileID: 3} m_Position: serializedVersion: 2 x: 0 y: 30 - width: 1365.3334 - height: 885.11115 + width: 1600 + height: 768 m_MinSize: {x: 300, y: 200} m_MaxSize: {x: 24288, y: 16192} vertical: 0 controlID: 15 ---- !u!114 &8 +--- !u!114 &3 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -184,23 +59,24 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 1 m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} - m_Name: + m_Name: NodeEditorWindow m_EditorClassIdentifier: m_Children: [] m_Position: serializedVersion: 2 - x: 1003.55554 + x: 1186 y: 0 - width: 361.77783 - height: 885.11115 - m_MinSize: {x: 276, y: 71} + width: 414 + height: 768 + m_MinSize: {x: 101, y: 121} m_MaxSize: {x: 4001, y: 4021} - m_ActualView: {fileID: 20} + m_ActualView: {fileID: 12} m_Panes: - - {fileID: 20} - m_Selected: 0 - m_LastSelected: 0 ---- !u!114 &9 + - {fileID: 15} + - {fileID: 12} + m_Selected: 1 + m_LastSelected: 1 +--- !u!114 &4 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -217,16 +93,16 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 239.55556 - height: 535.1111 + width: 314 + height: 455 m_MinSize: {x: 201, y: 221} m_MaxSize: {x: 4001, y: 4021} - m_ActualView: {fileID: 21} + m_ActualView: {fileID: 16} m_Panes: - - {fileID: 21} + - {fileID: 16} m_Selected: 0 m_LastSelected: 0 ---- !u!114 &10 +--- !u!114 &5 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -236,23 +112,24 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 1 m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} - m_Name: ProjectBrowser + m_Name: ConsoleWindow m_EditorClassIdentifier: m_Children: [] m_Position: serializedVersion: 2 x: 0 - y: 0 - width: 469.33334 - height: 350.00006 - m_MinSize: {x: 231, y: 271} - m_MaxSize: {x: 10001, y: 10021} + y: 455 + width: 1186 + height: 313 + m_MinSize: {x: 101, y: 121} + m_MaxSize: {x: 4001, y: 4021} m_ActualView: {fileID: 19} m_Panes: + - {fileID: 14} - {fileID: 19} - m_Selected: 0 + m_Selected: 1 m_LastSelected: 0 ---- !u!114 &11 +--- !u!114 &6 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -265,22 +142,22 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Children: - - {fileID: 12} - {fileID: 7} - - {fileID: 13} + - {fileID: 2} + - {fileID: 8} m_Position: serializedVersion: 2 x: 0 y: 0 - width: 1365.3334 - height: 935.11115 + width: 1600 + height: 818 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 &12 +--- !u!114 &7 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -297,12 +174,12 @@ MonoBehaviour: serializedVersion: 2 x: 0 y: 0 - width: 1365.3334 + width: 1600 height: 30 m_MinSize: {x: 0, y: 0} m_MaxSize: {x: 0, y: 0} m_LastLoadedLayoutName: ---- !u!114 &13 +--- !u!114 &8 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -318,12 +195,12 @@ MonoBehaviour: m_Position: serializedVersion: 2 x: 0 - y: 915.11115 - width: 1365.3334 + y: 798 + width: 1600 height: 20 m_MinSize: {x: 0, y: 0} m_MaxSize: {x: 0, y: 0} ---- !u!114 &14 +--- !u!114 &9 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -336,19 +213,19 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Children: - - {fileID: 15} - - {fileID: 6} + - {fileID: 10} + - {fileID: 5} m_Position: serializedVersion: 2 x: 0 y: 0 - width: 1003.55554 - height: 885.11115 + width: 1186 + height: 768 m_MinSize: {x: 200, y: 200} m_MaxSize: {x: 16192, y: 16192} vertical: 1 - controlID: 16 ---- !u!114 &15 + controlID: 83 +--- !u!114 &10 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -361,19 +238,19 @@ MonoBehaviour: m_Name: m_EditorClassIdentifier: m_Children: - - {fileID: 9} - - {fileID: 16} + - {fileID: 4} + - {fileID: 11} m_Position: serializedVersion: 2 x: 0 y: 0 - width: 1003.55554 - height: 535.1111 + width: 1186 + height: 455 m_MinSize: {x: 200, y: 100} m_MaxSize: {x: 16192, y: 8096} vertical: 0 - controlID: 102 ---- !u!114 &16 + controlID: 84 +--- !u!114 &11 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -383,25 +260,25 @@ MonoBehaviour: m_Enabled: 1 m_EditorHideFlags: 1 m_Script: {fileID: 12006, guid: 0000000000000000e000000000000000, type: 0} - m_Name: + m_Name: WorldGraphWindow m_EditorClassIdentifier: m_Children: [] m_Position: serializedVersion: 2 - x: 239.55556 + x: 314 y: 0 - width: 764 - height: 535.1111 - m_MinSize: {x: 202, y: 221} + width: 872 + height: 455 + m_MinSize: {x: 102, y: 121} m_MaxSize: {x: 4002, y: 4021} - m_ActualView: {fileID: 22} + m_ActualView: {fileID: 13} m_Panes: - - {fileID: 22} - - {fileID: 23} + - {fileID: 17} - {fileID: 18} - m_Selected: 0 - m_LastSelected: 1 ---- !u!114 &17 + - {fileID: 13} + m_Selected: 2 + m_LastSelected: 2 +--- !u!114 &12 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -410,33 +287,27 @@ MonoBehaviour: m_GameObject: {fileID: 0} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: a1647df9b48bf4f49a664a929fff57ff, type: 3} + m_Script: {fileID: 11500000, guid: e219817d65c8b1f40ad85e6185e89e92, type: 3} m_Name: m_EditorClassIdentifier: m_MinSize: {x: 100, y: 100} m_MaxSize: {x: 4000, y: 4000} m_TitleContent: - m_Text: ETSI ARF - Authoring Editor + m_Text: Trackable Editor m_Image: {fileID: 0} m_Tooltip: m_Pos: serializedVersion: 2 - x: 464 - y: 157.33333 - width: 696.44446 - height: 855.8889 + x: 1186 + y: 72 + width: 413 + height: 747 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default m_SaveData: [] - worldStorageServer: {fileID: 11400000, guid: 4f997253243de534dad12937f1284975, type: 2} - worldStorageUser: {fileID: 11400000, guid: ce0f40be06008b14283766424922b729, type: 2} - creators: [] - trackables: [] - anchors: [] - links: - - c6998f4f-1b8d-460b-9de8-4793b92fae2a ---- !u!114 &18 + type: 2 +--- !u!114 &13 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -444,27 +315,29 @@ MonoBehaviour: m_PrefabAsset: {fileID: 0} m_GameObject: {fileID: 0} m_Enabled: 1 - m_EditorHideFlags: 1 - m_Script: {fileID: 12111, guid: 0000000000000000e000000000000000, type: 0} + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 2c1a0c92306453d46897c1af6cb5c2f9, type: 3} m_Name: m_EditorClassIdentifier: - m_MinSize: {x: 400, y: 100} - m_MaxSize: {x: 2048, y: 2048} + m_MinSize: {x: 100, y: 100} + m_MaxSize: {x: 4000, y: 4000} m_TitleContent: - m_Text: Asset Store - m_Image: {fileID: -7444545952099596278, guid: 0000000000000000d000000000000000, type: 0} + m_Text: Graph Editor + m_Image: {fileID: 0} m_Tooltip: m_Pos: serializedVersion: 2 - x: 468 - y: 181 - width: 973 - height: 501 + x: 314 + y: 72 + width: 870 + height: 434 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default m_SaveData: [] ---- !u!114 &19 + worldStorageServer: {fileID: 11400000, guid: 3a9ba82f4e8dd124ca2b005861c64d01, type: 2} + worldStorageUser: {fileID: 11400000, guid: c0696089e4a855b46ad490437919b1e8, type: 2} +--- !u!114 &14 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -484,10 +357,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 12.888889 - y: 637.3333 - width: 468.33334 - height: 329.00006 + x: 0 + y: 527 + width: 1185.5 + height: 292 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -505,22 +378,22 @@ MonoBehaviour: m_SkipHidden: 0 m_SearchArea: 1 m_Folders: - - Assets/ETSI.ARF/ARF World Storage API/World Storage + - Assets/ETSI.ARF/ARF World Storage API/Editor/Windows m_Globs: [] m_OriginalText: m_ViewMode: 1 - m_StartGridSize: 16 + m_StartGridSize: 64 m_LastFolders: - - Assets/ETSI.ARF/ARF World Storage API/World Storage - m_LastFoldersGridSize: 16 - m_LastProjectPath: D:\Fraunhofer\Projects\ETSI\GitLab (STF)\unity-world-storage-editor + - Assets/ETSI.ARF/ARF World Storage API/Editor/Windows + m_LastFoldersGridSize: -1 + m_LastProjectPath: C:\Dev\unity-world-storage-editor m_LockTracker: m_IsLocked: 0 m_FolderTreeState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: 5e4b0000 - m_LastClickedID: 19294 - m_ExpandedIDs: 00000000424b0000444b0000464b0000484b00004a4b00004c4b00004e4b000000ca9a3bffffff7f + m_SelectedIDs: 644b0000 + m_LastClickedID: 19300 + m_ExpandedIDs: 00000000504b0000524b0000544b0000564b000000ca9a3bffffff7f m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -536,7 +409,7 @@ MonoBehaviour: m_IsRenaming: 0 m_OriginalEventType: 11 m_IsRenamingFilename: 1 - m_ClientGUIView: {fileID: 10} + m_ClientGUIView: {fileID: 0} m_SearchString: m_CreateAssetUtility: m_EndAction: {fileID: 0} @@ -548,7 +421,7 @@ MonoBehaviour: scrollPos: {x: 0, y: 0} m_SelectedIDs: m_LastClickedID: 0 - m_ExpandedIDs: 00000000424b0000444b0000464b0000484b00004a4b00004c4b00004e4b0000 + m_ExpandedIDs: 00000000504b0000524b0000544b0000564b0000 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -573,10 +446,10 @@ MonoBehaviour: m_Icon: {fileID: 0} m_ResourceFile: m_ListAreaState: - m_SelectedInstanceIDs: - m_LastClickedInstanceID: 0 + m_SelectedInstanceIDs: d80c0000 + m_LastClickedInstanceID: 3288 m_HadKeyboardFocusLastEvent: 1 - m_ExpandedInstanceIDs: c6230000de4b0000 + m_ExpandedInstanceIDs: c6230000 m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -592,7 +465,7 @@ MonoBehaviour: m_IsRenaming: 0 m_OriginalEventType: 11 m_IsRenamingFilename: 1 - m_ClientGUIView: {fileID: 10} + m_ClientGUIView: {fileID: 5} m_CreateAssetUtility: m_EndAction: {fileID: 0} m_InstanceID: 0 @@ -601,10 +474,10 @@ MonoBehaviour: m_ResourceFile: m_NewAssetIndexInList: -1 m_ScrollPosition: {x: 0, y: 0} - m_GridSize: 16 + m_GridSize: 64 m_SkipHiddenPackages: 0 - m_DirectoriesAreaWidth: 248.11111 ---- !u!114 &20 + m_DirectoriesAreaWidth: 207 +--- !u!114 &15 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -624,10 +497,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 1016.44446 - y: 102.22222 - width: 360.77783 - height: 864.11115 + x: 1186.5 + y: 72 + width: 412.5 + height: 747 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -638,14 +511,14 @@ MonoBehaviour: m_CachedPref: 160 m_ControlHash: -371814159 m_PrefName: Preview_InspectorPreview - m_LastInspectedObjectInstanceID: -1 + m_LastInspectedObjectInstanceID: 3288 m_LastVerticalScrollValue: 0 m_GlobalObjectId: m_InspectorMode: 0 m_LockTracker: m_IsLocked: 0 m_PreviewWindow: {fileID: 0} ---- !u!114 &21 +--- !u!114 &16 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -665,10 +538,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 12.888889 - y: 102.22222 - width: 238.55556 - height: 514.1111 + x: 0 + y: 72 + width: 313 + height: 434 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -676,9 +549,9 @@ MonoBehaviour: m_SceneHierarchy: m_TreeViewState: scrollPos: {x: 0, y: 0} - m_SelectedIDs: 844b0000 + m_SelectedIDs: d80c0000 m_LastClickedID: 0 - m_ExpandedIDs: 34fbffff + m_ExpandedIDs: 38fbffff m_RenameOverlay: m_UserAcceptedRename: 0 m_Name: @@ -701,8 +574,8 @@ MonoBehaviour: m_LockTracker: m_IsLocked: 0 m_CurrentSortingName: TransformSorting - m_WindowGUID: 26d3cc4a749ad3148bdaac8cbfc0727d ---- !u!114 &22 + m_WindowGUID: 4c969a2b90040154d917609493e03593 +--- !u!114 &17 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -722,10 +595,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 252.44444 - y: 102.22222 - width: 762 - height: 514.1111 + x: 302.5 + y: 72 + width: 917 + height: 434 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default @@ -736,7 +609,7 @@ MonoBehaviour: collapsed: 0 displayed: 1 snapOffset: {x: 0, y: 0} - snapOffsetDelta: {x: -98.22223, y: -25.777771} + snapOffsetDelta: {x: -98, y: -26} snapCorner: 3 id: Tool Settings index: 0 @@ -917,7 +790,7 @@ MonoBehaviour: id: Scene View/Particles index: 10 layout: 4 - m_WindowGUID: f5dcb30f0be3f8447834243ac481bdf9 + m_WindowGUID: cc27987af1a868c49b0894db9c0f5429 m_Gizmos: 1 m_OverrideSceneCullingMask: 6917529027641081856 m_SceneIsLit: 1 @@ -940,9 +813,9 @@ MonoBehaviour: m_ExposureSliderValue: 0 m_SceneViewState: m_AlwaysRefresh: 0 - showFog: 1 - showSkybox: 1 - showFlares: 1 + showFog: 0 + showSkybox: 0 + showFlares: 0 showImageEffects: 1 showParticleSystems: 1 showVisualEffectGraphs: 1 @@ -990,7 +863,7 @@ MonoBehaviour: m_CameraSettings: m_Speed: 1 m_SpeedNormalized: 0.5 - m_SpeedMin: 0.01 + m_SpeedMin: 0.001 m_SpeedMax: 2 m_EasingEnabled: 1 m_EasingDuration: 0.4 @@ -1007,7 +880,7 @@ MonoBehaviour: m_SceneVisActive: 1 m_LastLockedObject: {fileID: 0} m_ViewIsLockedToObject: 0 ---- !u!114 &23 +--- !u!114 &18 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -1041,7 +914,7 @@ MonoBehaviour: m_ShowGizmos: 0 m_TargetDisplay: 0 m_ClearColor: {r: 0, g: 0, b: 0, a: 0} - m_TargetSize: {x: 3447, y: 1730.25} + m_TargetSize: {x: 1532, y: 769} m_TextureFilterMode: 0 m_TextureHideFlags: 61 m_RenderIMGUI: 0 @@ -1056,10 +929,10 @@ MonoBehaviour: m_VRangeLocked: 0 hZoomLockedByDefault: 0 vZoomLockedByDefault: 0 - m_HBaseRangeMin: -766 - m_HBaseRangeMax: 766 - m_VBaseRangeMin: -384.5 - m_VBaseRangeMax: 384.5 + m_HBaseRangeMin: -383 + m_HBaseRangeMax: 383 + m_VBaseRangeMin: -192.25 + m_VBaseRangeMax: 192.25 m_HAllowExceedBaseRangeMin: 1 m_HAllowExceedBaseRangeMax: 1 m_VAllowExceedBaseRangeMin: 1 @@ -1079,7 +952,7 @@ MonoBehaviour: y: 21 width: 1532 height: 769 - m_Scale: {x: 1, y: 1} + m_Scale: {x: 2, y: 2} m_Translation: {x: 766, y: 384.5} m_MarginLeft: 0 m_MarginRight: 0 @@ -1087,19 +960,19 @@ MonoBehaviour: m_MarginBottom: 0 m_LastShownAreaInsideMargins: serializedVersion: 2 - x: -766 - y: -384.5 - width: 1532 - height: 769 + x: -383 + y: -192.25 + width: 766 + height: 384.5 m_MinimalGUI: 1 - m_defaultScale: 1 - m_LastWindowPixelSize: {x: 3447, y: 1777.5} + m_defaultScale: 2 + m_LastWindowPixelSize: {x: 3064, y: 1580} m_ClearInEditMode: 1 m_NoCameraWarning: 1 - m_LowResolutionForAspectRatios: 00000000000000000000 + m_LowResolutionForAspectRatios: 01000000000000000000 m_XRRenderMode: 0 m_RenderTexture: {fileID: 0} ---- !u!114 &24 +--- !u!114 &19 MonoBehaviour: m_ObjectHideFlags: 52 m_CorrespondingSourceObject: {fileID: 0} @@ -1119,10 +992,10 @@ MonoBehaviour: m_Tooltip: m_Pos: serializedVersion: 2 - x: 482.22223 - y: 637.3333 - width: 532.22217 - height: 329.00006 + x: 0 + y: 527 + width: 1185 + height: 292 m_ViewDataDictionary: {fileID: 0} m_OverlayCanvas: m_LastAppliedPresetName: Default diff --git a/UserSettings/Search.index b/UserSettings/Search.index new file mode 100644 index 0000000000000000000000000000000000000000..299c246c3aa0b3b91210b18535c74eb7d9d9df82 --- /dev/null +++ b/UserSettings/Search.index @@ -0,0 +1,13 @@ +{ + "name": "Assets", + "roots": ["Assets"], + "includes": [], + "excludes": ["Temp/", "External/"], + "options": { + "types": true, + "properties": false, + "extended": false, + "dependencies": false + }, + "baseScore": 999 +} \ No newline at end of file diff --git a/UserSettings/Search.settings b/UserSettings/Search.settings new file mode 100644 index 0000000000000000000000000000000000000000..93e90a3b24b0f7ba9e9b407a99a4b242e5bb535e --- /dev/null +++ b/UserSettings/Search.settings @@ -0,0 +1,67 @@ +trackSelection = true +fetchPreview = true +wantsMore = false +keepOpen = false +queryFolder = "Assets" +onBoardingDoNotAskAgain = true +showPackageIndexes = false +showStatusBar = false +scopes = { + "last_search.8040E7BB" = "fast" + "OpenInspectorPreview.8040E7BB" = "0" + "currentGroup.8040E7BB" = "all" +} +providers = { + adb = { + active = false + priority = 2500 + defaultAction = null + } + asset = { + active = true + priority = 25 + defaultAction = null + } + store = { + active = true + priority = 100 + defaultAction = null + } + find = { + active = true + priority = 25 + defaultAction = null + } + log = { + active = false + priority = 210 + defaultAction = null + } + packages = { + active = true + priority = 90 + defaultAction = null + } + performance = { + active = false + priority = 100 + defaultAction = null + } + scene = { + active = true + priority = 50 + defaultAction = null + } +} +recentSearches = [ +] +searchItemFavorites = [ +] +savedSearchesSortOrder = 0 +showSavedSearchPanel = false +expandedQueries = [ +] +queryBuilder = false +ignoredProperties = "id;name;classname;imagecontentshash" +helperWidgetCurrentArea = "all" +disabledIndexers = "" \ No newline at end of file