浏览代码
[Shader Graph]
[Shader Graph]
Remove properties as they are not needed (will expose property setting per input node) Add support for compact node UI view Add Vector3 node Update some example graphs/main
Tim Cooper
9 年前
当前提交
28d3f4cc
共有 27 个文件被更改,包括 1283 次插入 和 1394 次删除
-
6UnityProject/Assets/UnityShaderEditor/Editor/Source/BaseMaterialGraph.cs
-
42UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/DrawableMaterialNode.cs
-
1UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/MaterialGraphDataSource.cs
-
1UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/MaterialWindow.cs
-
2UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/SimpleWidgets.cs
-
33UnityProject/Assets/UnityShaderEditor/Editor/Source/MaterialGraph.cs
-
40UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/BaseMaterialNode.cs
-
40UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/ColorNode.cs
-
80UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/PropertyNode.cs
-
44UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/TextureNode.cs
-
42UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/Vector1Node.cs
-
43UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/Vector2Node.cs
-
44UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/Vector4Node.cs
-
20UnityProject/Assets/UnityShaderEditor/Editor/Source/PixelGraph.cs
-
5UnityProject/Assets/UnityShaderEditor/Editor/Source/Util/ShaderGenerator.cs
-
66UnityProject/Assets/UnityShaderEditor/Graphs/LayeredTarp.ShaderGraph
-
27UnityProject/ProjectSettings/GraphicsSettings.asset
-
2UnityProject/ProjectSettings/ProjectVersion.txt
-
67UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/Vector3Node.cs
-
12UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/Vector3Node.cs.meta
-
1001UnityProject/Assets/UnityShaderEditor/Graphs/onenode.ShaderGraph
-
8UnityProject/Assets/UnityShaderEditor/Graphs/onenode.ShaderGraph.meta
-
34UnityProject/Assets/UnityShaderEditor/Editor/Source/Editors/PropertyNodeEditor.cs
-
8UnityProject/Assets/UnityShaderEditor/Editor/Source/Editors/PropertyNodeEditor.cs.meta
-
8UnityProject/Assets/UnityShaderEditor/Graphs/SimpleMetal.ShaderGraph.meta
-
1001UnityProject/Assets/UnityShaderEditor/Graphs/SimpleMetal.ShaderGraph
|
|||
m_EditorVersion: 5.3.0b6 |
|||
m_EditorVersion: 5.4.0b3 |
|||
m_StandardAssetsVersion: 0 |
|
|||
using System; |
|||
using UnityEditor.Graphs; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.MaterialGraph |
|||
{ |
|||
[Title("Generate/Vector 3 Node")] |
|||
class Vector3Node : PropertyNode, IGeneratesBodyCode |
|||
{ |
|||
private const string kOutputSlotName = "Value"; |
|||
|
|||
[SerializeField] |
|||
private Vector3 m_Value; |
|||
|
|||
public override void OnCreate() |
|||
{ |
|||
base.OnCreate(); |
|||
name = "V3Node"; |
|||
} |
|||
|
|||
public override void OnEnable() |
|||
{ |
|||
base.OnEnable(); |
|||
AddSlot(new MaterialGraphSlot(new Slot(SlotType.OutputSlot, kOutputSlotName), SlotValueType.Vector3)); |
|||
} |
|||
|
|||
public override PropertyType propertyType |
|||
{ |
|||
get { return PropertyType.Vector3; } |
|||
} |
|||
|
|||
public override void GeneratePropertyUsages(ShaderGenerator visitor, GenerationMode generationMode, ConcreteSlotValueType valueType) |
|||
{ |
|||
if (exposed || generationMode.IsPreview()) |
|||
visitor.AddShaderChunk("float3 " + GetPropertyName() + ";", true); |
|||
} |
|||
|
|||
public void GenerateNodeCode(ShaderGenerator visitor, GenerationMode generationMode) |
|||
{ |
|||
if (exposed || generationMode.IsPreview()) |
|||
return; |
|||
|
|||
visitor.AddShaderChunk(precision + "3 " + GetPropertyName() + " = " + precision + "3 (" + m_Value.x + ", " + m_Value.y + ", " + m_Value.z + ");", true); |
|||
} |
|||
|
|||
public override bool NodeUI(Rect drawArea) |
|||
{ |
|||
base.NodeUI(drawArea); |
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
m_Value = EditorGUI.Vector3Field(new Rect(drawArea.x, drawArea.y, drawArea.width, EditorGUIUtility.singleLineHeight), "Value", m_Value); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
return true; |
|||
return false; |
|||
} |
|||
|
|||
public override PreviewProperty GetPreviewProperty() |
|||
{ |
|||
return new PreviewProperty |
|||
{ |
|||
m_Name = GetPropertyName(), |
|||
m_PropType = PropertyType.Vector3, |
|||
m_Vector4 = m_Value |
|||
}; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 1350e4a38ff5ae44a9d8627d33b48de8 |
|||
timeCreated: 1453378777 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1001
UnityProject/Assets/UnityShaderEditor/Graphs/onenode.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
fileFormatVersion: 2 |
|||
guid: 12258f82ca70f6847b551eaf28207d88 |
|||
timeCreated: 1450784498 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
|
|||
namespace UnityEditor.MaterialGraph |
|||
{ |
|||
[CustomEditor(typeof(PropertyNode), true)] |
|||
class PropertyNodeEditor : Editor |
|||
{ |
|||
public override void OnInspectorGUI() |
|||
{ |
|||
var propertyNode = target as PropertyNode; |
|||
if (propertyNode == null) |
|||
return; |
|||
|
|||
// find available properties
|
|||
var allowedBindings = propertyNode.FindValidPropertyBindings().ToList(); |
|||
|
|||
var names = new List<string> {"none"}; |
|||
names.AddRange(allowedBindings.Select(x => x.name)); |
|||
var currentIndex = names.IndexOf(propertyNode.boundProperty == null ? "none" : propertyNode.boundProperty.name); |
|||
|
|||
EditorGUI.BeginChangeCheck(); |
|||
currentIndex = EditorGUILayout.Popup("Bound Property", currentIndex, names.ToArray()); |
|||
if (EditorGUI.EndChangeCheck()) |
|||
{ |
|||
ShaderProperty selected = null; |
|||
if (currentIndex > 0) |
|||
selected = allowedBindings[currentIndex - 1]; |
|||
|
|||
propertyNode.BindProperty(selected, true); |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 30abe8c249112c9408f055b48acef7d8 |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|
|||
fileFormatVersion: 2 |
|||
guid: 9686b8ceda059fd43af5a7a3f5e61f10 |
|||
timeCreated: 1444117524 |
|||
licenseType: Pro |
|||
NativeFormatImporter: |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
1001
UnityProject/Assets/UnityShaderEditor/Graphs/SimpleMetal.ShaderGraph
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
撰写
预览
正在加载...
取消
保存
Reference in new issue