浏览代码

Minor improvements to graph inspector

/main
Peter Bay Bastian 8 年前
当前提交
cb87ed84
共有 2 个文件被更改,包括 19 次插入14 次删除
  1. 18
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphInspector.cs
  2. 15
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphInspector.cs

18
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphInspector.cs


{
private readonly TypeMapper m_DataMapper = new TypeMapper(typeof(BasicNodeInspector));
protected List<INode> m_SelectedNodes;
protected List<INode> m_SelectedNodes = new List<INode>();
protected List<AbstractNodeInspector> m_Inspectors = new List<AbstractNodeInspector>();

if (m_GraphAsset == null)
return;
var selectedNodes = m_GraphAsset.drawingData.selection.Select(m_GraphAsset.graph.GetNodeFromGuid).ToList();
if (m_SelectedNodes != null && m_Inspectors.All(i => i.node != null) && selectedNodes.SequenceEqual(m_SelectedNodes))
return;
OnSelectionChanged(selectedNodes);
using (var selectedNodes = ListPool<INode>.GetDisposable())
{
selectedNodes.value.AddRange(m_GraphAsset.drawingData.selection.Select(m_GraphAsset.graph.GetNodeFromGuid));
if (m_SelectedNodes == null || m_Inspectors.Any(i => i.node == null) || !selectedNodes.value.SequenceEqual(m_SelectedNodes))
OnSelectionChanged(selectedNodes.value);
}
protected virtual void OnSelectionChanged(List<INode> selectedNodes)
protected virtual void OnSelectionChanged(IEnumerable<INode> selectedNodes)
m_SelectedNodes = selectedNodes;
m_SelectedNodes.Clear();
m_SelectedNodes.AddRange(selectedNodes);
m_Inspectors.Clear();
foreach (var node in m_SelectedNodes.OfType<SerializableNode>())
{

15
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/MaterialGraphInspector.cs


{
private bool m_RequiresTime;
private GUIContent m_Title = new GUIContent();
private AbstractMaterialNode m_PreviewNode;
private AbstractMaterialNode previewNode

ForEachChild(m_PreviewNode, (node) => node.onModified -= OnPreviewNodeModified);
m_PreviewNode = value;
m_NodePreviewPresenter.Initialize(value);
m_Title.text = m_PreviewNode.name;
m_RequiresTime = false;
ForEachChild(m_PreviewNode,
(node) =>

{
m_NodePreviewPresenter.modificationScope = scope;
Repaint();
}
protected override void AddTypeMappings(Action<Type, Type> map)
{
map(typeof(AbstractSurfaceMasterNode), typeof(SurfaceMasterNodeInspector));
}
public override void OnEnable()

previewNode = materialGraph.masterNode as AbstractMaterialNode;
}
protected override void AddTypeMappings(Action<Type, Type> map)
{
map(typeof(AbstractSurfaceMasterNode), typeof(SurfaceMasterNodeInspector));
}
public override bool HasPreviewGUI()
{
return m_PreviewNode != null;

public override GUIContent GetPreviewTitle()
{
return new GUIContent(m_PreviewNode.name);
return m_Title;
}
private void ForEachChild(INode node, Action<INode> action)

正在加载...
取消
保存