浏览代码

Remove defaults value section in inspector

/main
Peter Bay Bastian 7 年前
当前提交
59ca63f8
共有 1 个文件被更改,包括 0 次插入30 次删除
  1. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/StandardNodeEditorView.cs

30
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/StandardNodeEditorView.cs


public class StandardNodeEditorView : AbstractNodeEditorView
{
NodeEditorHeaderView m_HeaderView;
VisualElement m_SlotsContainer;
VisualElement m_DefaultSlotValuesSection;
int m_SlotsHash;
public override INode node
{

m_HeaderView = new NodeEditorHeaderView() { type = "node" };
Add(m_HeaderView);
m_DefaultSlotValuesSection = new VisualElement();
m_DefaultSlotValuesSection.AddToClassList("section");
{
var sectionTitle = new VisualElement { text = "Default Slot Values" };
sectionTitle.AddToClassList("title");
m_DefaultSlotValuesSection.Add(sectionTitle);
m_SlotsContainer = new VisualElement { name = "slots" };
m_DefaultSlotValuesSection.Add(m_SlotsContainer);
}
Add(m_DefaultSlotValuesSection);
}
void OnModified(INode changedNode, ModificationScope scope)

m_HeaderView.title = node.name;
var slotsHash = UIUtilities.GetHashCode(node.GetInputSlots<MaterialSlot>().Select(s => UIUtilities.GetHashCode(s.slotReference.nodeGuid.GetHashCode(), s.slotReference.slotId)));
if (slotsHash != m_SlotsHash)
{
m_SlotsHash = slotsHash;
m_SlotsContainer.Clear();
foreach (var slot in node.GetInputSlots<MaterialSlot>())
m_SlotsContainer.Add(new IMGUISlotEditorView(slot));
if (m_SlotsContainer.Any())
m_DefaultSlotValuesSection.RemoveFromClassList("hidden");
else
m_DefaultSlotValuesSection.AddToClassList("hidden");
}
}
}
}
正在加载...
取消
保存