Commit 11be4ddf authored by Sylvain Renault's avatar Sylvain Renault
Browse files

Different wrapper scripts for trackables, anchors and admin.

No links for the moment (todo).
parent 001b24b4
Loading
Loading
Loading
Loading

Editor/CreateARTrackable.cs

deleted100644 → 0
+0 −108
Original line number Diff line number Diff line
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using UnityEngine.UIElements;

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 wnd = GetWindow<CreateARTrackable>();
        wnd.titleContent = new GUIContent("ETSI ARF - Authoring Editor");
    }

    /*public void CreateGUI()
    {
        rootVisualElement.Add(new Label("Hello"));
    }*/

    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;
    }
    

}
+1 −1
Original line number Diff line number Diff line
fileFormatVersion: 2
guid: dd7d9751c977f5c46b3f59d2e8d10197
guid: 9b41a6c85d75773499fee865a0a245e6
folderAsset: yes
DefaultImporter:
  externalObjects: {}
+2 −2
Original line number Diff line number Diff line
fileFormatVersion: 2
guid: 7661796a672c33d4da3af558bf4290f8
guid: 5d8884e5b43d30c44a0dd7f6d04e4930
PluginImporter:
  externalObjects: {}
  serializedVersion: 2
@@ -7,7 +7,7 @@ PluginImporter:
  executionOrder: {}
  defineConstraints: []
  isPreloaded: 0
  isOverridable: 1
  isOverridable: 0
  isExplicitlyReferenced: 0
  validateReferences: 1
  platformData:
+2 −2
Original line number Diff line number Diff line
fileFormatVersion: 2
guid: a1b6adabb31d3bd41bb648467a7fef8e
guid: 8e129f0a00a01af4e9687332997ac12e
PluginImporter:
  externalObjects: {}
  serializedVersion: 2
@@ -7,7 +7,7 @@ PluginImporter:
  executionOrder: {}
  defineConstraints: []
  isPreloaded: 0
  isOverridable: 1
  isOverridable: 0
  isExplicitlyReferenced: 0
  validateReferences: 1
  platformData:
+7.5 KiB (69.5 KiB)

File changed.

No diff preview for this file type.

Loading