using System.Collections.Generic; using System.IO; using System.Linq; using UnityEngine; using UnityEngine.Perception.GroundTruth; using UnityEngine.UIElements; using Newtonsoft.Json.Linq; using UnityEditor.UIElements; namespace UnityEditor.Perception.GroundTruth { abstract class LabelConfigEditor : Editor where T : ILabelEntry { private string m_UxmlDir = "Packages/com.unity.perception/Editor/GroundTruth/Uxml/"; private string m_UxmlPath; private int m_AddedLabelsItemHeight = 37; private int m_OtherLabelsItemHeight = 27; protected abstract LabelConfig TargetLabelConfig { get; } private List m_AddedLabels = new List(); public List AddedLabels => m_AddedLabels; protected SerializedProperty m_SerializedLabelsArray; private static HashSet allLabelsInProject = new HashSet(); private List m_LabelsNotPresentInConfig = new List(); private VisualElement m_Root; private Button m_SaveButton; private Button m_AddNewLabelButton; private Button m_RemoveAllButton; private Button m_AddAllButton; private Button m_ImportFromFileButton; private Button m_ExportToFileButton; private ListView m_NonPresentLabelsListView; protected ListView m_LabelListView; protected Button m_MoveUpButton; protected Button m_MoveDownButton; protected VisualElement m_MoveButtons; protected EnumField m_StartingIdEnumField; public void OnEnable() { m_UxmlPath = m_UxmlDir + "LabelConfig_Main.uxml"; m_Root = AssetDatabase.LoadAssetAtPath(m_UxmlPath).CloneTree(); m_LabelListView = m_Root.Q("labels-listview"); m_NonPresentLabelsListView = m_Root.Q("labels-in-project-listview"); m_SaveButton = m_Root.Q