|
|
|
|
|
|
using System; |
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Linq; |
|
|
|
using UnityEditor.Experimental.UIElements.GraphView; |
|
|
|
using UnityEditor.MaterialGraph.Drawing; |
|
|
|
|
|
|
using UnityEngine.MaterialGraph; |
|
|
|
using UnityEngine.Graphing; |
|
|
|
using Object = UnityEngine.Object; |
|
|
|
|
|
|
|
namespace UnityEditor.MaterialGraph.Drawing |
|
|
|
{ |
|
|
|
|
|
|
GraphInspectorView m_GraphInspectorView; |
|
|
|
ToolbarView m_ToolbarView; |
|
|
|
ToolbarButtonView m_TimeButton; |
|
|
|
ToolbarButtonView m_CopyToClipboardButton; |
|
|
|
|
|
|
|
PreviewSystem m_PreviewSystem; |
|
|
|
|
|
|
|
|
|
|
m_TimeButton.text = "Preview rate: " + previewRate; |
|
|
|
})); |
|
|
|
m_ToolbarView.Add(m_TimeButton); |
|
|
|
|
|
|
|
m_ToolbarView.Add(new ToolbarSeparatorView()); |
|
|
|
|
|
|
|
m_CopyToClipboardButton = new ToolbarButtonView() { text = "Copy shader to clipboard" }; |
|
|
|
m_CopyToClipboardButton.AddManipulator(new Clickable(() => |
|
|
|
{ |
|
|
|
AbstractMaterialNode masterNode = graph.GetNodes<MasterNode>().First(); |
|
|
|
var textureInfo = new List<PropertyCollector.TextureInfo>(); |
|
|
|
PreviewMode previewMode; |
|
|
|
string shader = graph.GetShader(masterNode, GenerationMode.ForReals, assetName, out textureInfo, out previewMode); |
|
|
|
GUIUtility.systemCopyBuffer = shader; |
|
|
|
} |
|
|
|
)); |
|
|
|
|
|
|
|
m_ToolbarView.Add(m_CopyToClipboardButton); |
|
|
|
|
|
|
|
m_ToolbarView.Add(new ToolbarSeparatorView()); |
|
|
|
} |
|
|
|