浏览代码

Add Branch node

- Fix compatible types
- Fix default property name
/main
Matt Dean 7 年前
当前提交
bbd475d5
共有 4 个文件被更改,包括 46 次插入2 次删除
  1. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/BooleanShaderProperty.cs
  2. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/MaterialSlot.cs
  3. 35
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/BranchNode.cs
  4. 8
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/BranchNode.cs.meta

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/BooleanShaderProperty.cs


{
public BooleanShaderProperty()
{
displayName = "Bool";
displayName = "Boolean";
}
public override PropertyType propertyType

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/MaterialSlot.cs


|| inputType == SlotValueType.Vector1
|| inputType == SlotValueType.Dynamic;
case SlotValueType.Boolean:
return inputType == SlotValueType.Vector1;
return inputType == SlotValueType.Vector1
|| inputType == SlotValueType.Boolean;
}
return false;
}

35
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/BranchNode.cs


using System.Reflection;
using UnityEngine;
using UnityEditor.Graphing;
using UnityEditor.ShaderGraph.Drawing.Controls;
namespace UnityEditor.ShaderGraph
{
[Title("Utility", "Logic", "Branch")]
public class BranchNode : CodeFunctionNode
{
public BranchNode()
{
name = "Branch";
}
protected override MethodInfo GetFunctionToConvert()
{
return GetType().GetMethod("Unity_Branch", BindingFlags.Static | BindingFlags.NonPublic);
}
static string Unity_Branch(
[Slot(0, Binding.None)] Boolean Predicate,
[Slot(1, Binding.None)] DynamicDimensionVector True,
[Slot(2, Binding.None)] DynamicDimensionVector False,
[Slot(3, Binding.None)] out DynamicDimensionVector Out)
{
return
@"
{
Out = Predicate == 1 ? True : False;
}
";
}
}
}

8
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/BranchNode.cs.meta


fileFormatVersion: 2
guid: 15ad3dc0ff22d7748af5e82ef5503d32
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
正在加载...
取消
保存