浏览代码

[FIX] fixes #176 When validating the graph we check if the outputslot and the input slot are compatible. If not, then we do not create the edge.

/main
Martin Thorzen 7 年前
当前提交
878e4c49
共有 1 个文件被更改,包括 11 次插入2 次删除
  1. 13
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/AbstractMaterialGraph.cs

13
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/AbstractMaterialGraph.cs


var outputNode = GetNodeFromGuid(edge.outputSlot.nodeGuid);
var inputNode = GetNodeFromGuid(edge.inputSlot.nodeGuid);
MaterialSlot outputSlot = null;
MaterialSlot inputSlot = null;
if (outputNode != null && inputNode != null)
{
outputSlot = outputNode.FindOutputSlot<MaterialSlot>(edge.outputSlot.slotId);
inputSlot = inputNode.FindInputSlot<MaterialSlot>(edge.inputSlot.slotId);
}
|| outputNode.FindOutputSlot<ISlot>(edge.outputSlot.slotId) == null
|| inputNode.FindInputSlot<ISlot>(edge.inputSlot.slotId) == null)
|| outputSlot == null
|| inputSlot == null
|| !outputSlot.IsCompatibleWith(inputSlot))
{
//orphaned edge
RemoveEdgeNoValidate(edge);

正在加载...
取消
保存