Skip to content
Snippets Groups Projects
Commit a3687e09 authored by lacoche's avatar 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;
using ETSI.ARF.WorldStorage.Editor.Graph;
using ETSI.ARF.OpenAPI.WorldStorage;
using System.Collections.ObjectModel;
using UnityEngine.UIElements;
namespace ETSI.ARF.WorldStorage.Editor.Windows
{
......@@ -56,9 +57,6 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
public Vector3 local_rot;
public Vector3 local_pos;
//test
string m_newKey = "";
List<string> m_newValues = new List<string>();
// UI stuffs
private Vector2 scrollPos;
......@@ -699,9 +697,43 @@ namespace ETSI.ARF.WorldStorage.Editor.Windows
{
floatVersion = EditorGUILayout.DelayedFloatField(0);
}
trackable.TrackableEncodingInformation.Version = floatVersion.ToString();
trackable.TrackableEncodingInformation.Version = floatVersion.ToString(System.Globalization.CultureInfo.InvariantCulture);
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
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Trackable Payload ", EditorStyles.boldLabel, GUILayout.Width(140));
......
......@@ -44,6 +44,8 @@ namespace ETSI.ARF.WorldStorage.UI
string creatorUUID = System.Guid.Empty.ToString();
double confidence = 0f;
TrackableType type = TrackableType.OTHER;
EncodingInformationStructureDataFormat format = EncodingInformationStructureDataFormat.ARCORE;
float versionEncoding = 1.01f;
UnitSystem unit = UnitSystem.CM;
Vector3 trackableSize;
Vector3 localCRS_pos;
......@@ -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
// ---------------------
......@@ -284,6 +297,10 @@ namespace ETSI.ARF.WorldStorage.UI
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
// ---------------------
......@@ -331,10 +348,12 @@ namespace ETSI.ARF.WorldStorage.UI
public override Trackable GenerateObject()
{
Debug.Log(" Coucou " +versionEncoding);
EncodingInformationStructure trackableEncodingInformation = new EncodingInformationStructure()
{
DataFormat = EncodingInformationStructureDataFormat.ARCORE,
Version = "1.0"
DataFormat = format ,
Version = versionEncoding.ToString(System.Globalization.CultureInfo.InvariantCulture)
};
Debug.Log("Created encoding information");
......
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