Peter Bay Bastian
7 年前
当前提交
dc8375d3
共有 4 个文件被更改,包括 120 次插入 和 28 次删除
-
50MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
-
42MaterialGraphProject/Assets/UnityShaderEditor/Editor/Resources/Styles/MaterialGraph.uss
-
53MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GradientEdge.cs
-
3MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GradientEdge.cs.meta
|
|||
using UnityEditor.Experimental.UIElements.GraphView; |
|||
using UnityEngine; |
|||
using UnityEngine.Experimental.UIElements.StyleSheets; |
|||
using UnityEngine.MaterialGraph; |
|||
|
|||
namespace UnityEditor.MaterialGraph.Drawing |
|||
{ |
|||
public class GradientEdge : Edge |
|||
{ |
|||
const string k_InputColorProperty = "edge-input-color"; |
|||
const string k_OutputColorProperty = "edge-output-color"; |
|||
|
|||
StyleValue<Color> m_InputColor; |
|||
StyleValue<Color> m_OutputColor; |
|||
|
|||
public Color inputColor |
|||
{ |
|||
get { return m_InputColor.GetSpecifiedValueOrDefault(defaultColor); } |
|||
} |
|||
|
|||
public Color outputColor |
|||
{ |
|||
get { return m_OutputColor.GetSpecifiedValueOrDefault(defaultColor); } |
|||
} |
|||
|
|||
public void UpdateClasses(ConcreteSlotValueType outputType, ConcreteSlotValueType inputType) |
|||
{ |
|||
ClearClassList(); |
|||
AddToClassList("edge"); |
|||
AddToClassList("from" + outputType); |
|||
AddToClassList("to" + inputType); |
|||
} |
|||
|
|||
protected override void OnStyleResolved(ICustomStyle styles) |
|||
{ |
|||
base.OnStyleResolved(styles); |
|||
styles.ApplyCustomProperty(k_InputColorProperty, ref m_InputColor); |
|||
styles.ApplyCustomProperty(k_OutputColorProperty, ref m_OutputColor); |
|||
} |
|||
|
|||
protected override void DrawEdge() |
|||
{ |
|||
if (!UpdateEdgeControl()) |
|||
return; |
|||
|
|||
edgeControl.edgeWidth = edgeWidth; |
|||
edgeControl.inputColor = isGhostEdge ? ghostColor : (selected ? selectedColor : inputColor); |
|||
edgeControl.outputColor = isGhostEdge ? ghostColor : (selected ? selectedColor : outputColor); |
|||
edgeControl.startCapColor = edgeControl.outputColor; |
|||
edgeControl.endCapColor = edgeControl.inputColor; |
|||
} |
|||
} |
|||
} |
|
|||
fileFormatVersion: 2 |
|||
guid: 161180898f1d444880080d666ab7be1d |
|||
timeCreated: 1509019463 |
撰写
预览
正在加载...
取消
保存
Reference in new issue