Skip to content
Snippets Groups Projects
Commit a3687e09 authored by Jérémy Lacoche's avatar Jérémy Lacoche
Browse files

Add Key Value edit in world graph editor, add encoding information in editor window

parent 805ae642
No related branches found
No related tags found
No related merge requests found
...@@ -29,6 +29,7 @@ using ETSI.ARF.WorldStorage.UI; ...@@ -29,6 +29,7 @@ using ETSI.ARF.WorldStorage.UI;
using ETSI.ARF.WorldStorage.Editor.Graph; using ETSI.ARF.WorldStorage.Editor.Graph;
using ETSI.ARF.OpenAPI.WorldStorage; using ETSI.ARF.OpenAPI.WorldStorage;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using UnityEngine.UIElements;
namespace ETSI.ARF.WorldStorage.Editor.Windows namespace ETSI.ARF.WorldStorage.Editor.Windows
{ {
...@@ -56,9 +57,6 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows ...@@ -56,9 +57,6 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
public Vector3 local_rot; public Vector3 local_rot;
public Vector3 local_pos; public Vector3 local_pos;
//test
string m_newKey = "";
List<string> m_newValues = new List<string>();
// UI stuffs // UI stuffs
private Vector2 scrollPos; private Vector2 scrollPos;
...@@ -699,9 +697,43 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows ...@@ -699,9 +697,43 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
{ {
floatVersion = EditorGUILayout.DelayedFloatField(0); floatVersion = EditorGUILayout.DelayedFloatField(0);
} }
trackable.TrackableEncodingInformation.Version = floatVersion.ToString(); trackable.TrackableEncodingInformation.Version = floatVersion.ToString(System.Globalization.CultureInfo.InvariantCulture);
EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal();
string toEdit = String.Empty;
string newKey = String.Empty;
string newValue = "";
foreach(var item in trackable.KeyvalueTags)
{
string key = item.Key;
string value = item.Value[0];
string oldKey = key;
string oldValue = value;
if (!key.Contains("unityAuthoringPos"))
{
key = EditorGUILayout.TextField("Key ", key);
value = EditorGUILayout.TextField("Value " , value);
if (key!= oldKey || oldValue != value)
{
newKey = key;
toEdit = oldKey;
newValue = value;
}
}
}
if (toEdit.Length > 0)
{
trackable.KeyvalueTags.Remove(toEdit);
trackable.KeyvalueTags.Add(newKey, new Collection<string> { newValue });
}
if (GUILayout.Button("Add Key Value"))
{
trackable.KeyvalueTags.Add("key" + trackable.KeyvalueTags.Count, new Collection<string>() { "test" });
}
/*//trackable payload /*//trackable payload
EditorGUILayout.BeginHorizontal(); EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Trackable Payload ", EditorStyles.boldLabel, GUILayout.Width(140)); EditorGUILayout.LabelField("Trackable Payload ", EditorStyles.boldLabel, GUILayout.Width(140));
......
...@@ -44,6 +44,8 @@ namespace ETSI.ARF.WorldStorage.UI ...@@ -44,6 +44,8 @@ namespace ETSI.ARF.WorldStorage.UI
string creatorUUID = System.Guid.Empty.ToString(); string creatorUUID = System.Guid.Empty.ToString();
double confidence = 0f; double confidence = 0f;
TrackableType type = TrackableType.OTHER; TrackableType type = TrackableType.OTHER;
EncodingInformationStructureDataFormat format = EncodingInformationStructureDataFormat.ARCORE;
float versionEncoding = 1.01f;
UnitSystem unit = UnitSystem.CM; UnitSystem unit = UnitSystem.CM;
Vector3 trackableSize; Vector3 trackableSize;
Vector3 localCRS_pos; Vector3 localCRS_pos;
...@@ -237,6 +239,17 @@ namespace ETSI.ARF.WorldStorage.UI ...@@ -237,6 +239,17 @@ namespace ETSI.ARF.WorldStorage.UI
} }
} }
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Trackable Information ", EditorStyles.boldLabel);
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Format ", GUILayout.Width(50));
format = (EncodingInformationStructureDataFormat)EditorGUILayout.EnumPopup(format);
EditorGUILayout.LabelField("Version ", GUILayout.Width(50));
versionEncoding = EditorGUILayout.FloatField(versionEncoding);
EditorGUILayout.EndHorizontal();
// --------------------- // ---------------------
// Keyvalues // Keyvalues
// --------------------- // ---------------------
...@@ -284,6 +297,10 @@ namespace ETSI.ARF.WorldStorage.UI ...@@ -284,6 +297,10 @@ namespace ETSI.ARF.WorldStorage.UI
localCRS_rot = Vector3.zero; localCRS_rot = Vector3.zero;
} }
EncodingInformationStructure encoding = obj.TrackableEncodingInformation;
format = encoding.DataFormat;
float.TryParse(encoding.Version, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out versionEncoding);
// --------------------- // ---------------------
// Keyvalues // Keyvalues
// --------------------- // ---------------------
...@@ -331,10 +348,12 @@ namespace ETSI.ARF.WorldStorage.UI ...@@ -331,10 +348,12 @@ namespace ETSI.ARF.WorldStorage.UI
public override Trackable GenerateObject() public override Trackable GenerateObject()
{ {
Debug.Log(" Coucou " +versionEncoding);
EncodingInformationStructure trackableEncodingInformation = new EncodingInformationStructure() EncodingInformationStructure trackableEncodingInformation = new EncodingInformationStructure()
{ {
DataFormat = EncodingInformationStructureDataFormat.ARCORE, DataFormat = format ,
Version = "1.0" Version = versionEncoding.ToString(System.Globalization.CultureInfo.InvariantCulture)
}; };
Debug.Log("Created encoding information"); Debug.Log("Created encoding information");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment