浏览代码

Added collapsing of not-connected slots

/main
Peter Bay Bastian 8 年前
当前提交
e7cb8660
共有 3 个文件被更改,包括 27 次插入21 次删除
  1. 44
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/NodeDrawer.cs
  2. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Styles/MaterialGraph.uss.imported.asset
  3. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Styles/MaterialGraph.uss.imported.asset.meta

44
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/NodeDrawer.cs


HeaderDrawer m_HeaderDrawer;
HeaderDrawData m_HeaderData;
VisualContainer m_SlotContainer;
List<AnchorDrawData> m_currentAnchors;
List<AnchorDrawData> m_CurrentAnchors;
List<ControlDrawData> m_currentControlDrawData;
List<ControlDrawData> m_CurrentControlDrawData;
bool m_CurrentExpanded;
public NodeDrawer()
{

};
m_SlotContainer.AddChild(outputs);
m_currentAnchors = new List<AnchorDrawData>();
m_CurrentAnchors = new List<AnchorDrawData>();
// Add controls container
m_ControlsContainer = new VisualContainer

};
AddChild(m_ControlsContainer);
m_currentControlDrawData = new List<ControlDrawData>();
m_CurrentControlDrawData = new List<ControlDrawData>();
}
private void AddHeader(NodeDrawData nodeData)

var inputsContainer = m_SlotContainer.GetChildAtIndex(0) as VisualContainer;
var outputsContainer = m_SlotContainer.GetChildAtIndex(1) as VisualContainer;
if (!anchors.ItemsReferenceEquals(m_currentAnchors))
if (anchors.ItemsReferenceEquals(m_CurrentAnchors) && m_CurrentExpanded == nodeData.expanded)
m_currentAnchors = anchors;
inputsContainer.ClearChildren();
outputsContainer.ClearChildren();
return;
}
foreach (var anchor in nodeData.elements.OfType<AnchorDrawData>())
{
if (anchor.direction == Direction.Input)
inputsContainer.AddChild(new NodeAnchor(anchor));
else
outputsContainer.AddChild(new NodeAnchor(anchor));
}
m_CurrentAnchors = anchors;
inputsContainer.ClearChildren();
outputsContainer.ClearChildren();
foreach (var anchor in anchors)
{
var hidden = !nodeData.expanded && !anchor.connected;
if (!hidden && anchor.direction == Direction.Input)
inputsContainer.AddChild(new NodeAnchor(anchor));
else if (!hidden && anchor.direction == Direction.Output)
outputsContainer.AddChild(new NodeAnchor(anchor));
}
}

if (!nodeData.expanded)
{
m_ControlsContainer.ClearChildren();
m_currentControlDrawData.Clear();
m_CurrentControlDrawData.Clear();
if (controlDrawData.ItemsReferenceEquals(m_currentControlDrawData))
if (controlDrawData.ItemsReferenceEquals(m_CurrentControlDrawData))
{
for (int i = 0; i < controlDrawData.Count; i++)
{

else
{
m_ControlsContainer.ClearChildren();
m_currentControlDrawData.Clear();
m_CurrentControlDrawData.Clear();
foreach (var controlData in controlDrawData)
{

height = controlData.GetHeight()
};
m_ControlsContainer.AddChild(imContainer);
m_currentControlDrawData.Add(controlData);
m_CurrentControlDrawData.Add(controlData);
}
}
}

AddHeader(nodeData);
AddSlots(nodeData);
AddControls(nodeData);
m_CurrentExpanded = nodeData.expanded;
}
}
}

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Styles/MaterialGraph.uss.imported.asset


m_Enabled: 1
m_EditorHideFlags: 1
m_Script: {fileID: 11997, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_Name: MaterialGraph.uss.imported
m_EditorClassIdentifier:
matchers:
- specificity: 2

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Styles/MaterialGraph.uss.imported.asset.meta


fileFormatVersion: 2
guid: 13814e9314253674e8d4966bba14d963
timeCreated: 1478599475
timeCreated: 1478601727
licenseType: Pro
NativeFormatImporter:
userData:
正在加载...
取消
保存