Tim Cooper
9 年前
当前提交
a99eb964
共有 6 个文件被更改,包括 138 次插入 和 11 次删除
-
2UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/DrawableMaterialNode.cs
-
18UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/MaterialGraphDataSource.cs
-
2UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/BaseMaterialNode.cs
-
6UnityProject/Assets/UnityShaderEditor/Editor/Source/Nodes/SlotValue.cs
-
52UnityProject/Assets/UnityShaderEditor/Editor/Source/Util/ShaderGenerator.cs
-
69UnityProject/Assets/UnityShaderEditor/Editor/Source/Drawing/NullInputProxy.cs
|
|||
using UnityEditor.Experimental; |
|||
using UnityEditor.Graphs; |
|||
using UnityEngine; |
|||
|
|||
namespace UnityEditor.MaterialGraph |
|||
{ |
|||
public class NullInputProxy : CanvasElement |
|||
{ |
|||
private Slot m_InputSlot; |
|||
private NodeAnchor m_NodeAnchor; |
|||
|
|||
private const int kWidth = 180; |
|||
|
|||
public NullInputProxy(Slot inputSlot, NodeAnchor nodeAnchor) |
|||
{ |
|||
m_InputSlot = inputSlot; |
|||
m_NodeAnchor = nodeAnchor; |
|||
|
|||
var size = m_NodeAnchor.scale; |
|||
size.x = kWidth; |
|||
scale = size; |
|||
|
|||
nodeAnchor.AddDependency(this); |
|||
UpdateModel(UpdateType.Update); |
|||
|
|||
var position = m_NodeAnchor.canvasBoundingRect.min; |
|||
position.x -= kWidth; |
|||
translation = position; |
|||
AddManipulator(new ImguiContainer()); |
|||
} |
|||
|
|||
|
|||
public override void Render(Rect parentRect, Canvas2D canvas) |
|||
{ |
|||
base.Render(parentRect, canvas); |
|||
|
|||
var size = m_NodeAnchor.scale; |
|||
size.x = kWidth; |
|||
scale = size; |
|||
|
|||
var position = m_NodeAnchor.canvasBoundingRect.min; |
|||
position.x -= kWidth; |
|||
translation = position; |
|||
|
|||
var bmn = (BaseMaterialNode) m_InputSlot.node; |
|||
|
|||
var rect = new Rect(0, 0, scale.x, scale.y); |
|||
EditorGUI.DrawRect(rect, new Color(0.0f, 0.0f, 0.0f, 0.7f)); |
|||
var def = bmn.GetSlotDefaultValue(m_InputSlot.name); |
|||
var changed = def.OnGUI(rect); |
|||
|
|||
if (changed) |
|||
DrawableMaterialNode.RepaintDependentNodes(bmn); |
|||
} |
|||
|
|||
public override void UpdateModel(UpdateType t) |
|||
{ |
|||
var size = m_NodeAnchor.scale; |
|||
size.x = kWidth; |
|||
scale = size; |
|||
|
|||
var position = m_NodeAnchor.canvasBoundingRect.min; |
|||
position.x -= kWidth; |
|||
translation = position; |
|||
|
|||
base.UpdateModel(t); |
|||
} |
|||
} |
|||
} |
撰写
预览
正在加载...
取消
保存
Reference in new issue