using System; using UnityEditor.Experimental.UIElements.GraphView; using UnityEngine; using UnityEngine.Experimental.UIElements; namespace UnityEditor.ShaderGraph.Drawing { class BlackboardRow : GraphElement { private VisualElement m_Root; private Button m_ExpandButton; private VisualElement m_ItemContainer; private VisualElement m_PropertyViewContainer; private bool m_Expanded = true; public bool expanded { get { return m_Expanded; } set { if (m_Expanded == value) { return; } m_Expanded = value; if (m_Expanded) { m_Root.Add(m_PropertyViewContainer); AddToClassList("expanded"); } else { m_Root.Remove(m_PropertyViewContainer); RemoveFromClassList("expanded"); } } } public BlackboardRow(VisualElement item, VisualElement propertyView) { var tpl = AssetDatabase.LoadAssetAtPath("Assets/UnityShaderEditor/Editor/Resources/UXML/GraphView/BlackboardRow.uxml") as VisualTreeAsset; VisualElement mainContainer = tpl.CloneTree(null); mainContainer.AddToClassList("mainContainer"); m_Root = mainContainer.Q("root"); m_ItemContainer = mainContainer.Q("itemContainer"); m_PropertyViewContainer = mainContainer.Q("propertyViewContainer"); m_ExpandButton = mainContainer.Q