Tim Cooper
9 年前
当前提交
3da9634f
共有 16 个文件被更改,包括 516 次插入 和 403 次删除
-
36UnityProject/Assets/GraphFramework/Canvas2D/Editor/Graph.cs
-
183UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/DrawableMaterialNode.cs
-
19UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/MaterialGraphDataSource.cs
-
3UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/MaterialWindow.cs
-
211UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/SimpleWidgets.cs
-
152UnityProject/Assets/UnityShaderEditor/Graphs/GlowMud.ShaderGraph
-
96UnityProject/Assets/UnityShaderEditor/Graphs/LayeredTarp.ShaderGraph
-
5UnityProject/ProjectSettings/GraphicsSettings.asset
-
2UnityProject/ProjectSettings/ProjectSettings.asset
-
2UnityProject/ProjectSettings/ProjectVersion.txt
-
59UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/MyNodeAdapters.cs
-
12UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/MyNodeAdapters.cs.meta
-
85UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/NodeAnchor.cs
-
12UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/NodeAnchor.cs.meta
-
30UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/NodeOutputAnchor.cs
-
12UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/NodeOutputAnchor.cs.meta
|
|||
m_EditorVersion: 5.3.0b2 |
|||
m_EditorVersion: 5.3.0b5 |
|||
m_StandardAssetsVersion: 0 |
|
|||
using UnityEditor.Experimental.Graph; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.MaterialGraph |
|||
{ |
|||
internal class PortSource<T> |
|||
{ |
|||
} |
|||
|
|||
internal static class MyNodeAdapters |
|||
{ |
|||
internal static bool Adapt(this NodeAdapter value, PortSource<int> a, PortSource<int> b) |
|||
{ |
|||
// run adapt code for int to int connections
|
|||
return true; |
|||
} |
|||
|
|||
internal static bool Adapt(this NodeAdapter value, PortSource<float> a, PortSource<float> b) |
|||
{ |
|||
// run adapt code for float to float connections
|
|||
return true; |
|||
} |
|||
|
|||
internal static bool Adapt(this NodeAdapter value, PortSource<int> a, PortSource<float> b) |
|||
{ |
|||
// run adapt code for int to float connections, perhaps by insertion a conversion node
|
|||
return true; |
|||
} |
|||
|
|||
internal static bool Adapt(this NodeAdapter value, PortSource<Vector3> a, PortSource<Vector3> b) |
|||
{ |
|||
// run adapt code for vec3 to vec3 connections
|
|||
return true; |
|||
} |
|||
|
|||
internal static bool Adapt(this NodeAdapter value, PortSource<Color> a, PortSource<Color> b) |
|||
{ |
|||
// run adapt code for Color to Color connections
|
|||
return true; |
|||
} |
|||
|
|||
internal static bool Adapt(this NodeAdapter value, PortSource<Vector3> a, PortSource<Color> b) |
|||
{ |
|||
// run adapt code for vec3 to Color connections
|
|||
return true; |
|||
} |
|||
internal static bool Adapt(this NodeAdapter value, PortSource<Vector4> a, PortSource<Vector4> b) |
|||
{ |
|||
// run adapt code for vec3 to Color connections
|
|||
return true; |
|||
} |
|||
|
|||
internal static bool Adapt(this NodeAdapter value, PortSource<Color> a, PortSource<Vector3> b) |
|||
{ |
|||
// run adapt code for Color to vec3 connections
|
|||
return true; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 27057ec4cbcfc30409186b9319c5f8c8 |
|||
timeCreated: 1445503903 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEditor.Experimental; |
|||
using UnityEditor.Experimental.Graph; |
|||
using UnityEditor.Graphs; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.MaterialGraph |
|||
{ |
|||
public class NodeAnchor : CanvasElement, IConnect |
|||
{ |
|||
protected Type m_Type; |
|||
protected object m_Source; |
|||
protected Direction m_Direction; |
|||
private MaterialGraphDataSource m_Data; |
|||
public Slot m_Slot; |
|||
|
|||
public NodeAnchor(Vector3 position, Type type, Slot slot, MaterialGraphDataSource data) |
|||
{ |
|||
m_Type = type; |
|||
scale = new Vector3(15.0f, 15.0f, 1.0f); |
|||
translation = position; |
|||
AddManipulator(new EdgeConnector<NodeAnchor>()); |
|||
m_Direction = Direction.eInput; |
|||
|
|||
Type genericClass = typeof (PortSource<>); |
|||
Type constructedClass = genericClass.MakeGenericType(type); |
|||
m_Source = Activator.CreateInstance(constructedClass); |
|||
m_Data = data; |
|||
m_Slot = slot; |
|||
} |
|||
|
|||
public override void Render(Rect parentRect, Canvas2D canvas) |
|||
{ |
|||
var anchorColor = Color.yellow; |
|||
anchorColor.a = 0.7f; |
|||
base.Render(parentRect, canvas); |
|||
EditorGUI.DrawRect(new Rect(translation.x, translation.y, scale.x, scale.y), anchorColor); |
|||
Rect labelRect = new Rect(translation.x + scale.x + 10.0f, translation.y, parentRect.width, 20.0f); |
|||
GUI.Label(labelRect, m_Slot.name); |
|||
} |
|||
|
|||
// IConnect
|
|||
public Direction GetDirection() |
|||
{ |
|||
return m_Direction; |
|||
} |
|||
|
|||
public void Highlight(bool highlighted) |
|||
{ |
|||
} |
|||
|
|||
public void RenderOverlay(Canvas2D canvas) |
|||
{ |
|||
Rect thisRect = canvasBoundingRect; |
|||
thisRect.x += 4; |
|||
thisRect.y += 4; |
|||
thisRect.width -= 8; |
|||
thisRect.height -= 8; |
|||
thisRect = canvas.CanvasToScreen(thisRect); |
|||
EditorGUI.DrawRect(thisRect, new Color(0.0f, 0.0f, 0.8f)); |
|||
} |
|||
|
|||
public object Source() |
|||
{ |
|||
return m_Source; |
|||
} |
|||
|
|||
public Vector3 ConnectPosition() |
|||
{ |
|||
return canvasBoundingRect.center; |
|||
} |
|||
|
|||
public void OnConnect(IConnect other) |
|||
{ |
|||
if (other == null) |
|||
return; |
|||
|
|||
NodeAnchor otherAnchor = other as NodeAnchor; |
|||
m_Data.Connect(this, otherAnchor); |
|||
|
|||
ParentCanvas().ReloadData(); |
|||
} |
|||
|
|||
}; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: e1fc1c5ab58718146be7e985ba8d2c8e |
|||
timeCreated: 1445503903 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
|
|||
using System; |
|||
using UnityEditor.Experimental; |
|||
using UnityEditor.Experimental.Graph; |
|||
using UnityEditor.Graphs; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.MaterialGraph |
|||
{ |
|||
public class NodeOutputAnchor : NodeAnchor |
|||
{ |
|||
public NodeOutputAnchor(Vector3 position, Type type, Slot slot, MaterialGraphDataSource data) |
|||
: base(position, type, slot, data) |
|||
{ |
|||
m_Direction = Direction.eOutput; |
|||
} |
|||
|
|||
public override void Render(Rect parentRect, Canvas2D canvas) |
|||
{ |
|||
var anchorColor = Color.yellow; |
|||
anchorColor.a = 0.7f; |
|||
base.Render(parentRect, canvas); |
|||
EditorGUI.DrawRect(new Rect(translation.x, translation.y, scale.x, scale.y), anchorColor); |
|||
Vector2 sizeOfText = GUIStyle.none.CalcSize(new GUIContent(m_Type.Name)); |
|||
|
|||
Rect labelRect = new Rect(translation.x - sizeOfText.x - 4.0f, translation.y, sizeOfText.x + 4.0f, sizeOfText.y + 4.0f); |
|||
GUI.Label(labelRect, m_Slot.name); |
|||
} |
|||
|
|||
}; |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 7d206272c8dc0c942a9bf61ccf1310dd |
|||
timeCreated: 1445503903 |
|||
licenseType: Pro |
|||
MonoImporter: |
|||
serializedVersion: 2 |
|||
defaultReferences: [] |
|||
executionOrder: 0 |
|||
icon: {instanceID: 0} |
|||
userData: |
|||
assetBundleName: |
|||
assetBundleVariant: |
撰写
预览
正在加载...
取消
保存
Reference in new issue