using System; using System.Collections.Generic; using System.IO; using UnityEditor; using UnityEditor.UIElements; using UnityEngine.Perception.Randomization.Parameters; using UnityEngine.UIElements; namespace UnityEngine.Perception.Randomization.Editor { class ParameterElement : VisualElement { int m_ParameterIndex; bool m_Filtered; VisualElement m_Properties; VisualElement m_ExtraProperties; VisualElement m_TargetContainer; ToolbarMenu m_TargetPropertyMenu; SerializedProperty m_SerializedProperty; SerializedProperty m_TargetGameObjectProperty; const string k_CollapsedParameterClass = "collapsed-parameter"; public ParameterConfigurationEditor ConfigEditor { get; private set; } Parameter parameter => ConfigEditor.config.parameters[m_ParameterIndex]; CategoricalParameterBase categoricalParameter => (CategoricalParameterBase)parameter; public int ParameterIndex => parent.IndexOf(this); public bool Collapsed { get => parameter.collapsed; set { parameter.collapsed = value; if (value) AddToClassList(k_CollapsedParameterClass); else RemoveFromClassList(k_CollapsedParameterClass); } } public bool Filtered { get => m_Filtered; set { m_Filtered = value; style.display = value ? new StyleEnum(DisplayStyle.Flex) : new StyleEnum(DisplayStyle.None); } } public ParameterElement(int index, ParameterConfigurationEditor paramConfigEditor) { ConfigEditor = paramConfigEditor; var template = AssetDatabase.LoadAssetAtPath( $"{StaticData.uxmlDir}/ParameterElement.uxml"); template.CloneTree(this); m_ParameterIndex = index; m_SerializedProperty = ConfigEditor.serializedObject.FindProperty("parameters").GetArrayElementAtIndex(m_ParameterIndex); this.AddManipulator(new ParameterDragManipulator()); Collapsed = parameter.collapsed; var removeButton = this.Q