using System; using UnityEngine; using UnityEditor; using UnityEditor.UIElements; using UnityEngine.Perception.Randomization.Configuration; using UnityEngine.Perception.Randomization.Parameters; using UnityEngine.Perception.Randomization.Parameters.Attributes; using UnityEngine.Perception.Randomization.Samplers; using UnityEngine.UIElements; namespace UnityEngine.Perception.Randomization.Editor { [CustomEditor(typeof(ParameterConfiguration))] class ParameterConfigurationEditor : UnityEditor.Editor { VisualElement m_Root; VisualElement m_ParameterContainer; public ParameterConfiguration config; string m_FilterString = string.Empty; public string FilterString { get => m_FilterString; private set { m_FilterString = value; var lowerFilter = m_FilterString.ToLower(); foreach (var child in m_ParameterContainer.Children()) { var paramIndex = m_ParameterContainer.IndexOf(child); var param = config.parameters[paramIndex]; ((ParameterElement)child).Filtered = param.name.ToLower().Contains(lowerFilter); } } } public override VisualElement CreateInspectorGUI() { config = (ParameterConfiguration)target; m_Root = AssetDatabase.LoadAssetAtPath( $"{StaticData.uxmlDir}/ParameterConfiguration.uxml").CloneTree(); m_ParameterContainer = m_Root.Q("parameters-container"); var filter = m_Root.Q("filter-parameters"); filter.RegisterValueChangedCallback((e) => { FilterString = e.newValue; }); var collapseAllButton = m_Root.Q