浏览代码
Add Comparison node
Add Comparison node
- Add boolean field for property list - Fix missing ConcreteValueTypeToString entry/main
Matt Dean
7 年前
当前提交
2ed31ce4
共有 7 个文件被更改,包括 160 次插入 和 0 次删除
-
2MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Implementation/NodeUtils.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/CodeFunctionNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/ShaderPropertyView.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic.meta
-
131MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/ComparisonNode.cs
-
8MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Nodes/Utility/Logic/ComparisonNode.cs.meta
|
|||
fileFormatVersion: 2 |
|||
guid: 1c5103f75b5ec7445bb4c7b5a36f6aec |
|||
folderAsset: yes |
|||
DefaultImporter: |
|||
externalObjects: {} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Reflection; |
|||
using UnityEngine; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
|
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
public enum ComparisonType |
|||
{ |
|||
Equal, |
|||
NotEqual, |
|||
Less, |
|||
LessOrEqual, |
|||
Greater, |
|||
GreaterOrEqual |
|||
}; |
|||
|
|||
[Title("Utility", "Logic", "Comparison")] |
|||
public class ComparisonNode : CodeFunctionNode |
|||
{ |
|||
public ComparisonNode() |
|||
{ |
|||
name = "Comparison"; |
|||
} |
|||
|
|||
[SerializeField] |
|||
private ComparisonType m_ComparisonType = ComparisonType.Equal; |
|||
|
|||
[EnumControl("")] |
|||
public ComparisonType comparisonType |
|||
{ |
|||
get { return m_ComparisonType; } |
|||
set |
|||
{ |
|||
if (m_ComparisonType == value) |
|||
return; |
|||
|
|||
m_ComparisonType = value; |
|||
Dirty(ModificationScope.Graph); |
|||
} |
|||
} |
|||
|
|||
public override bool hasPreview |
|||
{ |
|||
get { return false; } |
|||
} |
|||
|
|||
protected override MethodInfo GetFunctionToConvert() |
|||
{ |
|||
return GetType().GetMethod(string.Format("Unity_Comparison_{0}", comparisonType), BindingFlags.Static | BindingFlags.NonPublic); |
|||
} |
|||
|
|||
static string Unity_Comparison_Equal( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector A, |
|||
[Slot(1, Binding.None)] DynamicDimensionVector B, |
|||
[Slot(2, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = A == B ? 1 : 0; |
|||
} |
|||
";
|
|||
} |
|||
|
|||
static string Unity_Comparison_NotEqual( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector A, |
|||
[Slot(1, Binding.None)] DynamicDimensionVector B, |
|||
[Slot(2, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = A != B ? 1 : 0; |
|||
} |
|||
";
|
|||
} |
|||
|
|||
static string Unity_Comparison_Less( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector A, |
|||
[Slot(1, Binding.None)] DynamicDimensionVector B, |
|||
[Slot(2, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = A < B ? 1 : 0; |
|||
} |
|||
";
|
|||
} |
|||
|
|||
static string Unity_Comparison_LessOrEqual( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector A, |
|||
[Slot(1, Binding.None)] DynamicDimensionVector B, |
|||
[Slot(2, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = A <= B ? 1 : 0; |
|||
} |
|||
";
|
|||
} |
|||
|
|||
static string Unity_Comparison_Greater( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector A, |
|||
[Slot(1, Binding.None)] DynamicDimensionVector B, |
|||
[Slot(2, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = A > B ? 1 : 0; |
|||
} |
|||
";
|
|||
} |
|||
|
|||
static string Unity_Comparison_GreaterOrEqual( |
|||
[Slot(0, Binding.None)] DynamicDimensionVector A, |
|||
[Slot(1, Binding.None)] DynamicDimensionVector B, |
|||
[Slot(2, Binding.None)] out Boolean Out) |
|||
{ |
|||
return |
|||
@"
|
|||
{ |
|||
Out = A >= B ? 1 : 0; |
|||
} |
|||
";
|
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: c66cc68d0d0862b4c8ddfc00093d0ae0 |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
撰写
预览
正在加载...
取消
保存
Reference in new issue