using System; using System.Collections.Generic; using System.Linq; using Unity.Entities; using UnityEditor.UIElements; using UnityEditorInternal; using UnityEngine; using UnityEngine.Perception.GroundTruth; using UnityEngine.PlayerLoop; using UnityEngine.Rendering.UI; using UnityEngine.UIElements; namespace UnityEditor.Perception.GroundTruth { [CustomEditor(typeof(Labeling))] class LabelingEditor : Editor { class MyBinding : IBinding { private LabelingEditor m_Editor; public MyBinding(LabelingEditor editor) { m_Editor = editor; } public void PreUpdate() { } public void Update() { m_Editor.RefreshUi(); } public void Release() { } } private Labeling m_Labeling; private SerializedProperty m_SerializedLabelsArray; private VisualElement m_Root; private BindableElement m_OuterElement; private ListView m_CurrentLabelsListView; private ListView m_SuggestLabelsListView_FromName; private ListView m_SuggestLabelsListView_FromPath; private ListView m_SuggestLabelsListView_FromDB; private Button m_AddButton; private string m_UxmlDir = "Packages/com.unity.perception/Editor/GroundTruth/Uxml/"; private string m_UxmlPath; private string[] nameSeparators = {".","-", "_"}; private string[] pathSeparators = {"/"}; public List suggestedLabelsBasedOnName = new List(); public List suggestedLabelsBasedOnPath = new List(); private void OnEnable() { m_SerializedLabelsArray = serializedObject.FindProperty("labels"); m_Labeling = (Labeling) target; m_UxmlPath = m_UxmlDir + "Labeling_Main.uxml"; m_Root = AssetDatabase.LoadAssetAtPath(m_UxmlPath).CloneTree(); m_OuterElement = m_Root.Q("outer-container"); m_OuterElement.binding = new MyBinding(this); m_OuterElement.bindingPath = "labels"; m_CurrentLabelsListView = m_Root.Q("current-labels-listview"); m_SuggestLabelsListView_FromName = m_Root.Q("suggested-labels-name-listview"); m_SuggestLabelsListView_FromPath = m_Root.Q("suggested-labels-path-listview"); m_SuggestLabelsListView_FromDB = m_Root.Q("suggested-labels-db-listview"); m_AddButton = m_Root.Q