Skip to content
Snippets Groups Projects
Commit 0be1f919 authored by lacoche's avatar lacoche
Browse files

Move files editor to package

parent af8bd09f
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 1485 deletions
fileFormatVersion: 2
guid: a1d6d8755812e254dbe089251c2bddc5
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: e4474d3a0bcb9c44d9fd67da1ebb77c9
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 5fec767e3d1954e4e8af5dc2b3d4dd5d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: 452c5e5fd6387ad4984356aa2f11d245
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
//
// ARF - Augmented Reality Framework (ETSI ISG ARF)
//
// Copyright 2024 ETSI
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Last change: July 2022
//
using UnityEditor;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
using UnityEngine.UIElements;
using ETSI.ARF.WorldStorage.Editor.Windows;
using ETSI.ARF.OpenAPI.WorldStorage;
namespace ETSI.ARF.WorldStorage.Editor.Graph
{
public class ARFEdgeLink : Edge
{
public WorldLink worldLink;
public string GUID;
public Image savedIcon;
public ARFEdgeLink()
{
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(worldLink.ToJson());
GraphEditorWindow.ShowWindow(this);
}
public void MarkUnsaved()
{
if (savedIcon == null)
{
//the icon to add if the node does not correspond to an element in the server
Texture2D warningImage = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/ETSI.ARF/ARF World Storage API/Images/cloud.png", typeof(Texture2D));
savedIcon = new Image
{
image = warningImage
};
savedIcon.style.width = 18;
savedIcon.style.height = 18;
savedIcon.style.minWidth = 18;
savedIcon.style.minHeight = 18;
savedIcon.style.flexGrow = 1;
savedIcon.style.alignSelf = Align.Center;
}
if (!edgeControl.Contains(savedIcon))
{
edgeControl.Add(savedIcon);
}
tooltip = "This element is not synchronized with the World Storage";
}
public void MarkSaved()
{
if (edgeControl.Contains(savedIcon))
{
edgeControl.Remove(savedIcon);
tooltip = "";
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 81a94cf483be20040aa4fe8d9f93d5c5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
fileFormatVersion: 2
guid: 000c7511b9bdea24cb6c962ca1ae26ca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
//
// ARF - Augmented Reality Framework (ETSI ISG ARF)
//
// Copyright 2024 ETSI
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Last change: July 2022
//
#define USING_OPENAPI_GENERATOR // alt. is Swagger
using System;
using UnityEditor;
using UnityEngine.UIElements;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
using ETSI.ARF.WorldStorage.Editor.Graph;
using ETSI.ARF.OpenAPI.WorldStorage;
namespace ETSI.ARF.WorldStorage.UI
{
public abstract class ARFNode : Node
{
public string GUID;
public bool entryPoint = false;
public ARFPort portOut;
public ARFPort portIn;
public GUID id;
public Image savedIcon;
public ARFNode()
{
}
public override Port InstantiatePort(Orientation orientation, Direction direction, Port.Capacity capacity, Type type)
{
switch (direction)
{
case Direction.Input:
portIn = ARFPort.CreateARF<ARFEdgeLink>(orientation, direction, capacity, type);
return portIn;
case Direction.Output:
portOut = ARFPort.CreateARF<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
}
//override the BuildContextualMenu method to prevent the "disconnect" option from appearing in the contextual menu
public override void BuildContextualMenu(ContextualMenuPopulateEvent evt)
{
}
public abstract TypeWorldStorage GetElemType();
public void MarkUnsaved()
{
if(savedIcon == null)
{
//the icon to add if the node does not correspond to an element in the server
Texture2D warningImage = (Texture2D)AssetDatabase.LoadAssetAtPath("Assets/ETSI.ARF/ARF World Storage API/Images/cloud.png", typeof(Texture2D));
savedIcon = new Image
{
image = warningImage,
scaleMode = ScaleMode.ScaleToFit
};
savedIcon.style.width = 25;
savedIcon.style.height = 25;
savedIcon.style.minWidth = 25;
savedIcon.style.minHeight = 25;
savedIcon.style.left = 8;
savedIcon.style.paddingRight = 8;
savedIcon.style.alignSelf = Align.Center;
}
if (!titleContainer.Contains(savedIcon))
{
titleContainer.Insert(0,savedIcon);
}
tooltip = "This element is not synchronized with the World Storage";
}
public void MarkSaved()
{
if (titleContainer.Contains(savedIcon))
{
titleContainer.Remove(savedIcon);
tooltip = "";
}
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 0216cf1af3743f2429eb4b01db300b0e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
//
// ARF - Augmented Reality Framework (ETSI ISG ARF)
//
// Copyright 2024 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 2024
//
#define USING_OPENAPI_GENERATOR // alt. is Swagger
using UnityEngine;
using UnityEngine.UIElements;
using UnityEditor;
using UnityEditor.Experimental.GraphView;
using ETSI.ARF.WorldStorage.Editor.Windows;
using ETSI.ARF.OpenAPI.WorldStorage;
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(1, 0.31f, 0.31f, 0.9f);
//get the index of the title container
int titleIndex = mainContainer.hierarchy.IndexOf(titleContainer);
mainContainer.Insert(titleIndex+1, colorRectangle);
/*PORTS*/
var portIn = GeneratePort(this, Direction.Input, Port.Capacity.Multi);
portIn.portColor = new Color(0.66f, 0.39f, 1, 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.66f, 0.39f, 1, 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(trackable.ToJson());
GraphEditorWindow.ShowWindow(this);
}
public override TypeWorldStorage GetElemType()
{
return TypeWorldStorage.TRACKABLE;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 01bfb1a0a4a788c48a6c6675034ba8d5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
//
// ARF - Augmented Reality Framework (ETSI ISG ARF)
//
// Copyright 2024 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 2024
//
using UnityEngine;
using UnityEngine.UIElements;
using UnityEditor.Experimental.GraphView;
using ETSI.ARF.WorldStorage.Editor.Windows;
using ETSI.ARF.OpenAPI.WorldStorage;
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(1, 0.7f, 0, 0.9f);
mainContainer.Insert(1, colorRectangle);
/*PORTS*/
var portIn = GeneratePort(this, Direction.Input, Port.Capacity.Multi);
portIn.portColor = new Color(0.66f, 0.39f, 1, 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.66f, 0.39f, 1, 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()
{
GraphEditorWindow.ShowWindow(this);
}
public override TypeWorldStorage GetElemType()
{
return TypeWorldStorage.ANCHOR;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 21e22c1ed011b7a4da95fad83be1d9fa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
//
// ARF - Augmented Reality Framework (ETSI ISG ARF)
//
// Copyright 2024 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 2024
//
using System;
using System.Collections.Generic;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
using UnityEngine.UIElements;
using ETSI.ARF.WorldStorage.Editor.Windows;
using ETSI.ARF.WorldStorage.UI;
using ETSI.ARF.OpenAPI.WorldStorage;
namespace ETSI.ARF.WorldStorage.Editor.Graph
{
public class ARFPort : Port
{
protected ARFPort(Orientation portOrientation, Direction portDirection, Capacity portCapacity, Type type) : base(portOrientation, portDirection, portCapacity, type)
{
}
public override void Connect(Edge edge)
{
base.Connect(edge);
ARFNode fromNode = edge.output.node as ARFNode;
ARFNode toNode = edge.input.node as ARFNode;
if (edge is ARFEdgeLink aRFedge)
{
Transform3D transform = new Transform3D();
for (int i = 0; i < 15; i++)
{
transform.Add(0);
}
transform.Add(1);
WorldLink worldLink = new WorldLink()
{
UUID = Guid.NewGuid(),
CreatorUUID = Guid.Parse(SaveInfo.instance.worldStorageUser.UUID),
UUIDFrom = Guid.Parse(fromNode.GUID),
UUIDTo = Guid.Parse(toNode.GUID),
TypeFrom = fromNode.GetElemType(),
TypeTo = toNode.GetElemType(),
Transform = transform,
Unit = UnitSystem.CM
};
aRFedge.worldLink = worldLink;
}
}
public static ARFPort CreateARF<TEdge>(Orientation orientation, Direction direction, Capacity capacity, Type type) where TEdge : Edge, new()
{
WorldLinkListener listener = new WorldLinkListener();
ARFPort port = new(orientation, direction, capacity, type)
{
m_EdgeConnector = new EdgeConnector<TEdge>(listener)
};
port.AddManipulator(port.m_EdgeConnector);
return port;
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 3c67fa4402011954bb65be6215d52512
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
//
// ARF - Augmented Reality Framework (ETSI ISG ARF)
//
// Copyright 2024 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 2024
//
using UnityEngine;
using ETSI.ARF.WorldStorage.Editor.Windows;
using System.Collections.Generic;
using UnityEditor.Experimental.GraphView;
using static UnityEditor.Experimental.GraphView.Port;
namespace ETSI.ARF.WorldStorage.Editor.Graph
{
public class WorldLinkListener : IEdgeConnectorListener
{
private GraphViewChange m_GraphViewChange;
private List<Edge> m_EdgesToCreate;
private List<GraphElement> m_EdgesToDelete;
public WorldLinkListener()
{
m_EdgesToCreate = new List<Edge>();
m_EdgesToDelete = new List<GraphElement>();
m_GraphViewChange.edgesToCreate = m_EdgesToCreate;
}
public void OnDrop(GraphView graphView, Edge edge)
{
m_EdgesToCreate.Clear();
m_EdgesToCreate.Add(edge);
m_EdgesToDelete.Clear();
if (edge.input.capacity == Capacity.Single)
{
foreach (Edge connection in edge.input.connections)
{
if (connection != edge)
{
m_EdgesToDelete.Add(connection);
}
}
}
if (edge.output.capacity == Capacity.Single)
{
foreach (Edge connection2 in edge.output.connections)
{
if (connection2 != edge)
{
m_EdgesToDelete.Add(connection2);
}
}
}
if (m_EdgesToDelete.Count > 0)
{
graphView.DeleteElements(m_EdgesToDelete);
}
List<Edge> edgesToCreate = m_EdgesToCreate;
if (graphView.graphViewChanged != null)
{
edgesToCreate = graphView.graphViewChanged(m_GraphViewChange).edgesToCreate;
}
foreach (Edge item in edgesToCreate)
{
graphView.AddElement(item);
edge.input.Connect(item);
edge.output.Connect(item);
}
if (!SaveInfo.instance.linkIds.Contains(((ARFEdgeLink)edge).GUID))
{
((ARFEdgeLink)edge).MarkUnsaved();
}
GraphEditorWindow.ShowWindow((ARFEdgeLink)edge);
}
public void OnDropOutsidePort(Edge edge, Vector2 position)
{
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: 54dbfcfdc75de1b46bc7da09df52db34
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
fileFormatVersion: 2
guid: fbbff3217b2a8cd428764d83150c7b22
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
//
// ARF - Augmented Reality Framework (ETSI ISG ARF)
//
// Copyright 2024 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 2024
//
#define isDEBUG
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using UnityEngine;
using UnityEditor;
using TMPro;
using ETSI.ARF.WorldStorage.REST;
using ETSI.ARF.OpenAPI.WorldStorage;
namespace ETSI.ARF.WorldStorage.UI
{
public abstract class BaseWindow<T> : EditorWindow
{
[HideInInspector] public WorldStorageServer worldStorageServer;
[HideInInspector] public WorldStorageUser worldStorageUser;
[SerializeField] public List<string> trackables = new List<string>();
//
// Keyvalues
//
[SerializeField] protected KeyvalueTagList keyValueTags = new KeyvalueTagList();
protected List<(string, string)> keyValuesFixed = new List<(string, string)>(3)
{
("", ""),("", ""),("", "")
};
protected void OutputKeyValue(int n)
{
string i1 = keyValuesFixed[n].Item1;
string i2 = keyValuesFixed[n].Item2;
i1 = EditorGUILayout.TextField("Key " + n, i1);
i2 = EditorGUILayout.TextField("Value " + n, i2);
keyValuesFixed[n] = (i1, i2);
}
//
// UI stuffs
//
protected bool groupEnabled;
protected bool repaint = false;
protected Vector2 scrollPos;
protected Color ori;
protected GUIStyle gsTest;
protected string saveText = "Save";
public void Update()
{
if (repaint)
{
Repaint();
repaint = false;
}
}
void OnGUI()
{
ori = GUI.backgroundColor; // remember ori color
gsTest = new GUIStyle("window");
//gsTest.normal.textColor = WorldStorageWindow.arfColors[0];
gsTest.fontStyle = FontStyle.Bold;
gsTest.alignment = TextAnchor.UpperLeft;
gsTest.fontSize = 16;
scrollPos = EditorGUILayout.BeginScrollView(scrollPos, GUILayout.ExpandWidth(true));
WorldStorageWindow.DrawCopyright();
DrawUIStuffs();
EditorGUILayout.EndScrollView();
if (GUILayout.Button("Close Window"))
{
Close();
}
}
public abstract void DrawUIStuffs();
public virtual void GetParams()
{
}
public virtual void AddObject()
{
}
public virtual T GenerateObject()
{
return default(T);
}
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment