浏览代码

Search window respects shader stage

/main
Peter Bay Bastian 6 年前
当前提交
495c97b8
共有 2 个文件被更改,包括 12 次插入6 次删除
  1. 12
      ShaderGraph/com.unity.shadergraph/Editor/Data/Graphs/MaterialSlot.cs
  2. 6
      ShaderGraph/com.unity.shadergraph/Editor/Drawing/SearchWindowProvider.cs

12
ShaderGraph/com.unity.shadergraph/Editor/Data/Graphs/MaterialSlot.cs


public bool IsCompatibleWith(MaterialSlot otherSlot)
{
if(stageCapability != ShaderStageCapability.All && otherSlot.stageCapability != ShaderStageCapability.All)
{
if(stageCapability != otherSlot.stageCapability)
return false;
}
return otherSlot != null
&& otherSlot.owner != owner
&& otherSlot.isInputSlot != isInputSlot

}
public bool IsCompatibleStageWith(MaterialSlot otherSlot)
{
var candidateStage = otherSlot.stageCapability;
return stageCapability == ShaderStageCapability.All || candidateStage == stageCapability;
}
public virtual string GetDefaultValue(GenerationMode generationMode)

6
ShaderGraph/com.unity.shadergraph/Editor/Drawing/SearchWindowProvider.cs


return !materialSlot.IsCompatibleWith(connectedSlot);
});
m_Slots.RemoveAll(slot =>
{
var materialSlot = (MaterialSlot)slot;
return !materialSlot.IsCompatibleStageWith(connectedSlot);
});
if (hasSingleSlot && m_Slots.Count == 1)
{
nodeEntries.Add(new NodeEntry

正在加载...
取消
保存