浏览代码
Added new settings files for the common settings on the master nodes, PBR and Unlit Master
/main
Added new settings files for the common settings on the master nodes, PBR and Unlit Master
/main
Martin Thorzen
7 年前
当前提交
2ff4fbd7
共有 9 个文件被更改,包括 230 次插入 和 24 次删除
-
34com.unity.shadergraph/Editor/Data/MasterNodes/PBRMasterNode.cs
-
5com.unity.shadergraph/Editor/Data/MasterNodes/UnlitMasterNode.cs
-
3com.unity.shadergraph/Editor/Data/Nodes/IMasterNode.cs
-
8com.unity.shadergraph/Editor/Data/Nodes/MasterNode.cs
-
8com.unity.shadergraph/Editor/Drawing/Views/PropertySheet.cs
-
96com.unity.shadergraph/Editor/Drawing/Views/PBRSettingsView.cs
-
11com.unity.shadergraph/Editor/Drawing/Views/PBRSettingsView.cs.meta
-
78com.unity.shadergraph/Editor/Drawing/Views/UnlitSettingsView.cs
-
11com.unity.shadergraph/Editor/Drawing/Views/UnlitSettingsView.cs.meta
|
|||
using System.Collections.Generic; |
|||
using UnityEditor.Graphing; |
|||
public interface IMasterNode |
|||
public interface IMasterNode : INode |
|||
{ |
|||
string GetShader(GenerationMode mode, string name, out List<PropertyCollector.TextureInfo> configuredTextures); |
|||
} |
|
|||
using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEditor.Experimental.UIElements; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.UIElements; |
|||
using UnityEditor.Graphing.Util; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
|
|||
namespace UnityEditor.ShaderGraph.Drawing |
|||
{ |
|||
public class PBRSettingsView : VisualElement |
|||
{ |
|||
PBRMasterNode m_Node; |
|||
public PBRSettingsView(PBRMasterNode node) |
|||
{ |
|||
AddStyleSheetPath("Styles/PBRSettings"); |
|||
m_Node = (PBRMasterNode)node; |
|||
|
|||
PropertySheet ps = new PropertySheet(); |
|||
|
|||
ps.Add(new PropertyRow(new Label("Workflow")), (row) => |
|||
{ |
|||
row.Add(new EnumField(PBRMasterNode.Model.Metallic), (field) => |
|||
{ |
|||
field.value = m_Node.model; |
|||
field.OnValueChanged(ChangeWorkFlow); |
|||
}); |
|||
}); |
|||
|
|||
ps.Add(new PropertyRow(new Label("Surface")), (row) => |
|||
{ |
|||
row.Add(new EnumField(SurfaceType.Opaque), (field) => |
|||
{ |
|||
field.value = m_Node.surfaceType; |
|||
field.OnValueChanged(ChangeSurface); |
|||
}); |
|||
}); |
|||
|
|||
ps.Add(new PropertyRow(new Label("Blend")), (row) => |
|||
{ |
|||
row.Add(new EnumField(AlphaMode.Additive), (field) => |
|||
{ |
|||
field.value = m_Node.alphaMode; |
|||
field.OnValueChanged(ChangeAlphaMode); |
|||
}); |
|||
}); |
|||
|
|||
ps.Add(new PropertyRow(new Label("Two Sided")), (row) => |
|||
{ |
|||
row.Add(new Toggle(null), (toggle) => |
|||
{ |
|||
toggle.value = m_Node.twoSided.isOn; |
|||
toggle.OnToggle(ChangeTwoSided); |
|||
}); |
|||
}); |
|||
|
|||
Add(ps); |
|||
} |
|||
|
|||
void ChangeWorkFlow(ChangeEvent<Enum> evt) |
|||
{ |
|||
if (Equals(m_Node.model, evt.newValue)) |
|||
return; |
|||
|
|||
m_Node.owner.owner.RegisterCompleteObjectUndo("Work Flow Change"); |
|||
m_Node.model = (PBRMasterNode.Model)evt.newValue; |
|||
} |
|||
|
|||
void ChangeSurface(ChangeEvent<Enum> evt) |
|||
{ |
|||
if (Equals(m_Node.surfaceType, evt.newValue)) |
|||
return; |
|||
|
|||
m_Node.owner.owner.RegisterCompleteObjectUndo("Surface Change"); |
|||
m_Node.surfaceType = (SurfaceType)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; |
|||
} |
|||
|
|||
void ChangeTwoSided() |
|||
{ |
|||
m_Node.owner.owner.RegisterCompleteObjectUndo("Two Sided Change"); |
|||
ToggleData td = m_Node.twoSided; |
|||
td.isOn ^= true; |
|||
m_Node.twoSided = td; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 0f6aa10456b30264a9bd4aeded39530a |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using System.Collections; |
|||
using System.Collections.Generic; |
|||
using UnityEditor.Experimental.UIElements; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.UIElements; |
|||
using UnityEditor.Graphing.Util; |
|||
using UnityEditor.ShaderGraph.Drawing.Controls; |
|||
|
|||
namespace UnityEditor.ShaderGraph.Drawing |
|||
{ |
|||
public class UnlitSettingsView : VisualElement |
|||
{ |
|||
UnlitMasterNode m_Node; |
|||
public UnlitSettingsView(UnlitMasterNode node) |
|||
{ |
|||
AddStyleSheetPath("Styles/UnlitSettings"); |
|||
m_Node = (UnlitMasterNode)node; |
|||
|
|||
PropertySheet ps = new PropertySheet(); |
|||
|
|||
ps.Add(new PropertyRow(new Label("Surface")), (row) => |
|||
{ |
|||
row.Add(new EnumField(SurfaceType.Opaque), (field) => |
|||
{ |
|||
field.value = m_Node.surfaceType; |
|||
field.OnValueChanged(ChangeSurface); |
|||
}); |
|||
}); |
|||
|
|||
ps.Add(new PropertyRow(new Label("Blend")), (row) => |
|||
{ |
|||
row.Add(new EnumField(AlphaMode.Additive), (field) => |
|||
{ |
|||
field.value = m_Node.alphaMode; |
|||
field.OnValueChanged(ChangeAlphaMode); |
|||
}); |
|||
}); |
|||
|
|||
ps.Add(new PropertyRow(new Label("Two Sided")), (row) => |
|||
{ |
|||
row.Add(new Toggle(null), (toggle) => |
|||
{ |
|||
toggle.value = m_Node.twoSided.isOn; |
|||
toggle.OnToggle(ChangeTwoSided); |
|||
}); |
|||
}); |
|||
|
|||
Add(ps); |
|||
} |
|||
|
|||
void ChangeSurface(ChangeEvent<Enum> evt) |
|||
{ |
|||
if (Equals(m_Node.surfaceType, evt.newValue)) |
|||
return; |
|||
|
|||
m_Node.owner.owner.RegisterCompleteObjectUndo("Surface Change"); |
|||
m_Node.surfaceType = (SurfaceType)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; |
|||
} |
|||
|
|||
void ChangeTwoSided() |
|||
{ |
|||
m_Node.owner.owner.RegisterCompleteObjectUndo("Two Sided Change"); |
|||
ToggleData td = m_Node.twoSided; |
|||
td.isOn ^= true; |
|||
m_Node.twoSided = td; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 66dcef8109abbfc4fa27499aaa708dd4 |
|||
MonoImporter: |
|||
externalObjects: {} |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue