using System; using System.Collections.Generic; using UnityEditor; using UnityEditor.UIElements; using UnityEngine.Perception.Randomization.ParameterBehaviours; using UnityEngine.Perception.Randomization.Parameters; using UnityEngine.UIElements; namespace UnityEngine.Perception.Randomization.Editor { class ParameterListItemElement : VisualElement { VisualElement m_Properties; VisualElement m_TargetContainer; ToolbarMenu m_TargetPropertyMenu; SerializedProperty m_SerializedProperty; SerializedProperty m_Collapsed; const string k_CollapsedParameterClass = "collapsed-parameter"; public bool collapsed { get => m_Collapsed.boolValue; set { m_Collapsed.boolValue = value; m_SerializedProperty.serializedObject.ApplyModifiedProperties(); if (value) AddToClassList(k_CollapsedParameterClass); else RemoveFromClassList(k_CollapsedParameterClass); } } public string displayName => m_SerializedProperty.displayName; public bool filtered { set => style.display = value ? new StyleEnum(DisplayStyle.Flex) : new StyleEnum(DisplayStyle.None); } public ParameterListItemElement(SerializedProperty property) { var template = AssetDatabase.LoadAssetAtPath( $"{StaticData.uxmlDir}/ParameterListItemElement.uxml"); template.CloneTree(this); m_SerializedProperty = property; var parameter = (Parameter)StaticData.GetManagedReferenceValue(property); m_Collapsed = property.FindPropertyRelative("collapsed"); var parameterTypeLabel = this.Query