Martin Thorzen
7 年前
当前提交
cfd61180
共有 9 个文件被更改,包括 72 次插入 和 184 次删除
-
17HDPipeline/HDUnlitSubShader.cs
-
10com.unity.shadergraph/Editor/Data/MasterNodes/ISubShader.cs
-
41com.unity.shadergraph/Editor/Data/MasterNodes/PBRMasterNode.cs
-
13com.unity.shadergraph/Editor/Data/MasterNodes/UnlitMasterNode.cs
-
25com.unity.shadergraph/Editor/Data/Nodes/MasterNode.cs
-
11com.unity.shadergraph/Editor/Drawing/Views/PBRSettingsView.cs.meta
-
11com.unity.shadergraph/Editor/Drawing/Views/UnlitSettingsView.cs.meta
-
76com.unity.shadergraph/Editor/Drawing/Views/PBRSettingsView.cs
-
52com.unity.shadergraph/Editor/Drawing/Views/UnlitSettingsView.cs
|
|||
using System; |
|||
using UnityEditor.Graphing; |
|||
using UnityEngine.Experimental.UIElements; |
|||
namespace UnityEditor.ShaderGraph { |
|||
namespace UnityEditor.ShaderGraph |
|||
{ |
|||
IMasterNode owner { get; set; } |
|||
VisualElement CreateSettingsElement(); |
|||
void UpdateAfterDeserialization(); |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: fb3f520aadbbd854985c98fa2134a207 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
fileFormatVersion: 2 |
|||
guid: f42e97c8565928c40bbca9cc1d26fd9a |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Linq; |
|||
using UnityEditor.Experimental.UIElements; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.Graphing.Util; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.UIElements; |
|||
|
|||
namespace UnityEditor.ShaderGraph.Drawing |
|||
{ |
|||
public class PBRSettingsView : VisualElement |
|||
{ |
|||
PBRMasterNode m_Node; |
|||
public PBRSettingsView(INode node) |
|||
{ |
|||
AddStyleSheetPath("Styles/PBRSettings"); |
|||
m_Node = (PBRMasterNode)node; |
|||
|
|||
this.Add(new VisualElement { name = "container" }, (container) => |
|||
{ |
|||
container.Add(new VisualElement(), (row) => |
|||
{ |
|||
row.AddToClassList("row"); |
|||
|
|||
row.Add(new Label("Model"), (label) => |
|||
{ |
|||
label.AddToClassList("label"); |
|||
}); |
|||
|
|||
row.Add(new EnumField(PBRMasterNode.Model.Metallic), (enumField) => |
|||
{ |
|||
enumField.value = m_Node.model; |
|||
enumField.OnValueChanged(ChangeModel); |
|||
enumField.AddToClassList("enumcontainer"); |
|||
}); |
|||
}); |
|||
|
|||
container.Add(new VisualElement(), (row) => |
|||
{ |
|||
row.AddToClassList("row"); |
|||
|
|||
row.Add(new Label("Alpha Mode"), (label) => |
|||
{ |
|||
label.AddToClassList("label"); |
|||
}); |
|||
row.Add(new EnumField(AlphaMode.Additive), (enumField) => |
|||
{ |
|||
enumField.value = m_Node.alphaMode; |
|||
enumField.OnValueChanged(ChangeAlphaMode); |
|||
enumField.AddToClassList("enumcontainer"); |
|||
}); |
|||
}); |
|||
}); |
|||
} |
|||
|
|||
void ChangeModel(ChangeEvent<Enum> evt) |
|||
{ |
|||
if (Equals(m_Node.model, evt.newValue)) |
|||
return; |
|||
|
|||
m_Node.owner.owner.RegisterCompleteObjectUndo("Enum Change"); |
|||
m_Node.model = (PBRMasterNode.Model)evt.newValue; |
|||
} |
|||
|
|||
void ChangeAlphaMode(ChangeEvent<Enum> evt) |
|||
{ |
|||
if (Equals(m_Node.alphaMode, evt.newValue)) |
|||
return; |
|||
|
|||
m_Node.owner.owner.RegisterCompleteObjectUndo("Alpha Mode Change"); |
|||
m_Node.alphaMode = (AlphaMode)evt.newValue; |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
|
|||
using System; |
|||
using System.Linq; |
|||
using UnityEditor.Experimental.UIElements; |
|||
using UnityEditor.Graphing; |
|||
using UnityEditor.Graphing.Util; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.UIElements; |
|||
|
|||
namespace UnityEditor.ShaderGraph.Drawing |
|||
{ |
|||
public class UnlitSettingsView : VisualElement |
|||
{ |
|||
VisualElement m_Container; |
|||
|
|||
EnumField m_AlphaMode; |
|||
UnlitMasterNode m_Node; |
|||
public UnlitSettingsView(INode node) |
|||
{ |
|||
AddStyleSheetPath("Styles/UnlitSettings"); |
|||
m_Node = (UnlitMasterNode)node; |
|||
this.Add(new VisualElement{ name="container" }, (container) => |
|||
{ |
|||
container.Add( new VisualElement(), (row) => |
|||
{ |
|||
row.AddToClassList("row"); |
|||
row.Add(new Label { text = "Alpha Mode"}, (label) => |
|||
{ |
|||
label.AddToClassList("label"); |
|||
}); |
|||
|
|||
row.Add(new EnumField(AlphaMode.Additive), (enumField) => |
|||
{ |
|||
enumField.AddToClassList("enumcontainer"); |
|||
enumField.value = m_Node.alphaMode; |
|||
enumField.OnValueChanged(ChangeAlphaMode); |
|||
}); |
|||
}); |
|||
} ); |
|||
} |
|||
|
|||
void ChangeAlphaMode(ChangeEvent<Enum> evt) |
|||
{ |
|||
if (Equals(m_Node.alphaMode, evt.newValue)) |
|||
return; |
|||
|
|||
m_Node.owner.owner.RegisterCompleteObjectUndo("Alpha Mode Change"); |
|||
m_Node.alphaMode = (AlphaMode)evt.newValue; |
|||
} |
|||
} |
|||
} |
|||
|
|||
|
撰写
预览
正在加载...
取消
保存
Reference in new issue