using System; using UnityEngine; using UnityEngine.UIElements; namespace UnityEditor.Rendering.Universal { internal class RenderPipelineConverterItemVisualElement : VisualElement { const string k_Uxml = "Packages/com.unity.render-pipelines.universal/Editor/Converter/converter_widget_item.uxml"; static Lazy s_VisualTreeAsset = new Lazy(() => AssetDatabase.LoadAssetAtPath(k_Uxml)); VisualElement m_RootVisualElement; Toggle m_ItemSelectedToggle; ConverterItemState m_ConverterItemState; public Action itemSelectionChanged; public RenderPipelineConverterItemVisualElement() { m_RootVisualElement = new VisualElement(); s_VisualTreeAsset.Value.CloneTree(m_RootVisualElement); m_ItemSelectedToggle = m_RootVisualElement.Q("converterItemActive"); m_ItemSelectedToggle.RegisterCallback(evt => { if (m_ConverterItemState != null) { m_ConverterItemState.isActive = !m_ConverterItemState.isActive; itemSelectionChanged?.Invoke(); } }); Add(m_RootVisualElement); } public void Bind(ConverterItemState itemState) { m_ConverterItemState = itemState; m_ItemSelectedToggle.SetValueWithoutNotify(m_ConverterItemState.isActive); var desc = m_ConverterItemState.descriptor; m_RootVisualElement.Q