using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; public class CreateARTrackable : EditorWindow { bool groupEnabled; string uid = "0"; string basePath = "http://localhost:8080"; string type = "?"; string unit = "?"; Vector2Int dim; [MenuItem("ISG-ARF/AR Trackables and Anchors Editor")] public static void ShowWindow() { EditorWindow.GetWindow(typeof(CreateARTrackable), false, "ETSI ARF - Authoring Editor"); } void OnGUI() { Color ori = GUI.backgroundColor; Color button = new Color(0.5f, 1, 0); GUILayoutOption[] opt = new GUILayoutOption[] { null }; // Title GUILayout.Label("Augmented Reality Framework", EditorStyles.boldLabel); GUILayout.Label("BSD 3-Clause License"); GUILayout.Label("Copyright(c) 2022, ETSI"); EditorGUILayout.Space(); basePath = EditorGUILayout.TextField("Base Path", basePath); EditorGUILayout.Space(); GUILayout.Label("AR Trackable:", EditorStyles.boldLabel); GUILayout.BeginVertical("", "window"); { uid = EditorGUILayout.TextField("Creator UID", uid); GUILayout.Button("Generate UID"); EditorGUILayout.Space(); GUILayout.Label("Metadata:", EditorStyles.boldLabel); type = EditorGUILayout.TextField("Trackable Type", type); unit = EditorGUILayout.TextField("Unit System", unit); EditorGUILayout.Space(); dim = EditorGUILayout.Vector2IntField("Dimension", dim); EditorGUILayout.Space(); GUILayout.Button("Payload from File.."); EditorGUILayout.Space(); GUILayout.Label("Optional Parameters:", EditorStyles.boldLabel); //GUILayout.BeginVertical("Optional Parameters", "window"); { groupEnabled = EditorGUILayout.BeginToggleGroup("Key Values", groupEnabled); EditorGUILayout.IntField("Number of KeyValues", 0); EditorGUILayout.Space(); EditorGUILayout.TextField("Key", ""); EditorGUILayout.TextField("Value", ""); EditorGUILayout.EndToggleGroup(); } //GUILayout.EndVertical(); } GUILayout.EndVertical(); GUI.backgroundColor = button; if (GUILayout.Button("Create Trackable")) { RESTRequest.PostAddTrackable(basePath); Debug.Log("PostAddTrackable"); } GUI.backgroundColor = ori; EditorGUILayout.Space(); GUILayout.Label("AR World Anchor:", EditorStyles.boldLabel); GUILayout.BeginVertical("", "window"); { uid = EditorGUILayout.TextField("Creator UID", uid); GUILayout.Button("Generate UID"); EditorGUILayout.Space(); GUILayout.Label("Metadata:", EditorStyles.boldLabel); type = EditorGUILayout.TextField("Anchor Type", type); unit = EditorGUILayout.TextField("Unit System", unit); } GUILayout.EndVertical(); GUI.backgroundColor = button; if (GUILayout.Button("Create Anchor")) { RESTRequest.PostAddWorldAnchor(basePath); Debug.Log("PostAddWorldAnchor"); } GUI.backgroundColor = ori; } }