浏览代码

Merge remote-tracking branch 'origin/master' into tidyup

# Conflicts:
#	MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs
/main
Tim Cooper 7 年前
当前提交
209da78a
共有 8 个文件被更改,包括 104 次插入511 次删除
  1. 13
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/VectorControl.cs
  2. 182
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs
  3. 26
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewSystem.cs
  4. 21
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs
  5. 12
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorPresenter.cs.meta
  6. 94
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorPresenter.cs
  7. 260
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs.orig
  8. 7
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs.orig.meta

13
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Controls/VectorControl.cs


public MultiFloatControlView(string label, string subLabel1, string subLabel2, string subLabel3, string subLabel4, AbstractMaterialNode node, PropertyInfo propertyInfo)
{
int components;
if (propertyInfo.PropertyType == typeof(float))
components = 1;
else if (propertyInfo.PropertyType == typeof(Vector2))
components = 2;
else if (propertyInfo.PropertyType == typeof(Vector3))
components = 3;
else if (propertyInfo.PropertyType == typeof(Vector4))
components = 4;
else
var components = Array.IndexOf(validTypes, propertyInfo.PropertyType) + 1;
if (components == -1)
throw new ArgumentException("Property must be of type float, Vector2, Vector3 or Vector4.", "propertyInfo");
m_Node = node;

value[index] = (float)evt.newValue;
SetValue(value);
m_UndoGroup = -1;
// Dirty(ChangeType.Repaint);
});
doubleField.RegisterCallback<InputEvent>(evt =>
{

182
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs


using System;
using System.Collections.Generic;
using UnityEngine.Experimental.UIElements.StyleEnums;
using UnityEngine.Experimental.UIElements.StyleSheets;
using UnityEngine.Graphing;
using UnityEngine.Graphing;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing.Inspector

[SerializeField]
GraphInspectorPresenter m_Presenter;
VisualElement m_Title;
VisualElement m_PropertyItems;
VisualElement m_LayerItems;
VisualElement m_ContentContainer;

Image m_Preview;
VisualElement m_TopContainer;
AbstractMaterialGraph m_Graph;
PreviewData m_PreviewHandle;
public GraphInspectorView()
public GraphInspectorView(string assetName, PreviewSystem previewSystem, AbstractMaterialGraph graph)
m_Graph = graph;
var masterNode = graph.GetNodes<MasterNode>().FirstOrDefault();
if (masterNode != null)
{
m_PreviewHandle = previewSystem.GetPreview(masterNode);
m_PreviewHandle.onPreviewChanged += OnPreviewChanged;
}
m_SelectedNodes = new List<INode>();
m_TopContainer = new VisualElement { name = "top" };
var topContainer = new VisualElement {name = "top"};
var headerContainer = new VisualElement { name = "header" };
var headerContainer = new VisualElement {name = "header"};
m_Title = new VisualElement() { name = "title" };
headerContainer.Add(m_Title);
headerContainer.Add(new VisualElement {name = "title", text = assetName});
m_TopContainer.Add(headerContainer);
topContainer.Add(headerContainer);
m_ContentContainer = new VisualElement { name = "content" };
m_TopContainer.Add(m_ContentContainer);
m_ContentContainer = new VisualElement {name = "content"};
topContainer.Add(m_ContentContainer);
Add(m_TopContainer);
Add(topContainer);
var bottomContainer = new VisualElement { name = "bottom" };
var bottomContainer = new VisualElement {name = "bottom"};
var propertiesContainer = new VisualElement { name = "properties" };
var propertiesContainer = new VisualElement {name = "properties"};
var header = new VisualElement { name = "header" };
var header = new VisualElement {name = "header"};
var title = new VisualElement { name = "title", text = "Properties" };
var title = new VisualElement {name = "title", text = "Properties"};
var addPropertyButton = new Button(OnAddProperty) { text = "Add", name = "addButton" };
var addPropertyButton = new Button(OnAddProperty) {text = "Add", name = "addButton"};
m_PropertyItems = new VisualContainer { name = "items" };
m_PropertyItems = new VisualContainer {name = "items"};
propertiesContainer.Add(m_PropertyItems);
}
bottomContainer.Add(propertiesContainer);

bottomContainer.Add(layersContainer);
}
m_Preview = new Image { name = "preview", image = Texture2D.blackTexture};
m_Preview = new Image {name = "preview", image = Texture2D.blackTexture};
foreach (var property in m_Graph.properties)
m_PropertyItems.Add(new ShaderPropertyView(m_Graph, property));
m_Graph.onChange += OnGraphChange;
var layerGraph = m_Graph as LayeredShaderGraph;
if (layerGraph != null)
foreach (var layer in layerGraph.layers)
m_LayerItems.Add(new ShaderLayerView(layerGraph, layer));
// Nodes missing custom editors:
// - PropertyNode
// - SubGraphInputNode

// { typeof(AbstractSurfaceMasterNode), typeof(SurfaceMasterNodeEditorView) }
// { typeof(AbstractSurfaceMasterNode), typeof(SurfaceMasterNodeEditorView) }
List<INode> m_SelectedNodes;
void OnAddProperty()
{

gm.AddItem(new GUIContent("Vector4"), false, () => AddProperty(new Vector4ShaderProperty()));
gm.AddItem(new GUIContent("Color"), false, () => AddProperty(new ColorShaderProperty()));
gm.AddItem(new GUIContent("Texture"), false, () => AddProperty(new TextureShaderProperty()));
gm.ShowAsContext();
}
void AddProperty(IShaderProperty property)
{
m_Presenter.graph.owner.RegisterCompleteObjectUndo("Add Property");
m_Presenter.graph.AddShaderProperty(property);
gm.ShowAsContext();
var layerGraph = m_Presenter.graph as LayeredShaderGraph;
var layerGraph = m_Graph as LayeredShaderGraph;
if (layerGraph == null)
return;

public void OnChange(GraphInspectorPresenter.ChangeType changeType)
{
if (presenter == null)
{
m_ContentContainer.Clear();
m_SelectionHash = 0;
return;
}
if ((changeType & GraphInspectorPresenter.ChangeType.AssetName) != 0)
m_Title.text = presenter.assetName;
void AddProperty(IShaderProperty property)
{
m_Graph.owner.RegisterCompleteObjectUndo("Add Property");
m_Graph.AddShaderProperty(property);
}
if ((changeType & GraphInspectorPresenter.ChangeType.SelectedNodes) != 0)
{
var selectionHash = UIUtilities.GetHashCode(presenter.selectedNodes.Count, presenter.selectedNodes != null ? presenter.selectedNodes.FirstOrDefault() : null);
if (selectionHash != m_SelectionHash)
{
m_SelectionHash = selectionHash;
m_ContentContainer.Clear();
if (presenter.selectedNodes.Count > 1)
{
var element = new VisualElement { name = "selectionCount", text = string.Format("{0} nodes selected.", presenter.selectedNodes.Count) };
m_ContentContainer.Add(element);
}
else if (presenter.selectedNodes.Count == 1)
{
var node = presenter.selectedNodes.First();
var view = (AbstractNodeEditorView)Activator.CreateInstance(m_TypeMapper.MapType(node.GetType()));
view.node = node;
m_ContentContainer.Add(view);
}
}
}
void OnPreviewChanged()
{
m_Preview.image = m_PreviewHandle.texture ?? Texture2D.blackTexture;
}
if ((changeType & GraphInspectorPresenter.ChangeType.PreviewTexture) != 0)
{
m_Preview.image = presenter.previewTexture ?? Texture2D.blackTexture;
}
public void UpdateSelection(IEnumerable<INode> nodes)
{
m_SelectedNodes.Clear();
m_SelectedNodes.AddRange(nodes);
if ((changeType & GraphInspectorPresenter.ChangeType.Graph) != 0)
var selectionHash = UIUtilities.GetHashCode(m_SelectedNodes.Count,
m_SelectedNodes != null ? m_SelectedNodes.FirstOrDefault() : null);
if (selectionHash != m_SelectionHash)
if (m_Graph != null)
m_SelectionHash = selectionHash;
m_ContentContainer.Clear();
if (m_SelectedNodes.Count > 1)
m_Graph.onChange -= OnGraphChange;
m_PropertyItems.Clear();
m_LayerItems.Clear();
m_Graph = null;
var element = new VisualElement
{
name = "selectionCount",
text = string.Format("{0} nodes selected.", m_SelectedNodes.Count)
};
m_ContentContainer.Add(element);
if (m_Presenter.graph != null)
else if (m_SelectedNodes.Count == 1)
m_Graph = m_Presenter.graph;
foreach (var property in m_Graph.properties)
m_PropertyItems.Add(new ShaderPropertyView(m_Graph, property));
var layerGraph = m_Presenter.graph as LayeredShaderGraph;
if (layerGraph != null)
foreach (var layer in layerGraph.layers)
m_LayerItems.Add(new ShaderLayerView(layerGraph, layer));
m_Graph.onChange += OnGraphChange;
var node = m_SelectedNodes.First();
var view = (AbstractNodeEditorView) Activator.CreateInstance(m_TypeMapper.MapType(node.GetType()));
view.node = node;
m_ContentContainer.Add(view);
}
}
}
void OnGraphChange(GraphChange change)

}
}
AbstractMaterialGraph m_Graph;
public GraphInspectorPresenter presenter
public void Dispose()
get { return m_Presenter; }
set
if (m_PreviewHandle != null)
if (m_Presenter == value)
return;
if (m_Presenter != null)
m_Presenter.onChange -= OnChange;
m_Presenter = value;
OnChange(GraphInspectorPresenter.ChangeType.All);
m_Presenter.onChange += OnChange;
m_PreviewHandle.onPreviewChanged -= OnPreviewChanged;
m_PreviewHandle = null;
}
public void Dispose()
{
if (m_Presenter != null)
m_Presenter.onChange -= OnChange;
}
}
}

26
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewSystem.cs


m_LastUpdate = updateTime;
PropagateNodeSet(m_DirtyShaders);
foreach (var nodeGuid in m_DirtyShaders)
if (m_DirtyShaders.Any())
UpdateShader(nodeGuid);
PropagateNodeSet(m_DirtyShaders);
EditorUtility.DisplayProgressBar("Shader Graph", "Compiling preview shaders", 0f);
var count = m_DirtyShaders.Count;
try
{
var i = 0;
foreach (var nodeGuid in m_DirtyShaders)
{
UpdateShader(nodeGuid);
i++;
EditorUtility.DisplayProgressBar("Shader Graph", "Compiling preview shaders", (float)i / count);
}
}
finally
{
EditorUtility.ClearProgressBar();
}
m_DirtyPreviews.UnionWith(m_DirtyShaders);
m_DirtyShaders.Clear();
m_DirtyPreviews.UnionWith(m_DirtyShaders);
m_DirtyShaders.Clear();
m_DirtyPreviews.UnionWith(m_TimeDependentPreviews);
PropagateNodeSet(m_DirtyPreviews);

21
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs


[SerializeField]
MaterialGraphPresenter m_GraphPresenter;
[SerializeField]
GraphInspectorPresenter m_GraphInspectorPresenter;
public Action onUpdateAssetClick { get; set; }
public Action onConvertToSubgraphClick { get; set; }
public Action onShowInProjectClick { get; set; }

set { m_GraphPresenter = value; }
}
public GraphInspectorPresenter graphInspectorPresenter
{
get { return m_GraphInspectorPresenter; }
set { m_GraphInspectorPresenter = value; }
}
public PreviewSystem previewSystem
{
get { return m_PreviewSystem; }

previewSystem = new PreviewSystem(graph);
m_GraphInspectorPresenter = ScriptableObject.CreateInstance<GraphInspectorPresenter>();
m_GraphInspectorPresenter.Initialize(assetName, previewSystem, container);
m_GraphPresenter.onSelectionChanged += m_GraphInspectorPresenter.UpdateSelection;
m_ToolbarView = new ToolbarView { name = "TitleBar" };
{

content.name = "content";
{
m_GraphView = new MaterialGraphView { name = "GraphView", presenter = m_GraphPresenter };
m_GraphInspectorView = new GraphInspectorView() { name = "inspector", presenter = m_GraphInspectorPresenter};
m_GraphInspectorView = new GraphInspectorView(assetName, previewSystem, graph) { name = "inspector" };
m_GraphPresenter.onSelectionChanged += m_GraphInspectorView.UpdateSelection;
content.Add(m_GraphView);
content.Add(m_GraphInspectorView);
}

onConvertToSubgraphClick = null;
onShowInProjectClick = null;
if (m_GraphInspectorView != null) m_GraphInspectorView.Dispose();
if (m_GraphInspectorPresenter != null)
{
m_GraphInspectorPresenter.Dispose();
m_GraphInspectorPresenter = null;
}
if (previewSystem != null)
{
previewSystem.Dispose();

12
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorPresenter.cs.meta


fileFormatVersion: 2
guid: d8c67032914554203be73439532c83b8
timeCreated: 1502956093
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

94
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorPresenter.cs


using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.Graphing;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing.Inspector
{
public class GraphInspectorPresenter : ScriptableObject, IDisposable
{
PreviewData m_PreviewHandle;
public string assetName { get; set; }
public List<INode> selectedNodes { get; set; }
public Texture previewTexture { get; private set; }
[SerializeField]
private int m_Version;
[Flags]
public enum ChangeType
{
Graph = 1 << 0,
SelectedNodes = 1 << 1,
AssetName = 1 << 2,
PreviewTexture = 1 << 3,
All = -1
}
public delegate void OnChange(ChangeType changeType);
public OnChange onChange;
[SerializeField]
private HelperMaterialGraphEditWindow m_Owner;
public AbstractMaterialGraph graph
{
get { return m_Owner.GetMaterialGraph(); }
}
public void Dirty()
{
m_Version++;
}
public void Initialize(string assetName, PreviewSystem previewSystem, HelperMaterialGraphEditWindow window)
{
m_Owner = window;
var masterNode = graph.GetNodes<MasterNode>().FirstOrDefault();
if (masterNode != null)
{
m_PreviewHandle = previewSystem.GetPreview(masterNode);
m_PreviewHandle.onPreviewChanged += OnPreviewChanged;
}
this.assetName = assetName;
selectedNodes = new List<INode>();
NotifyChange(ChangeType.Graph | ChangeType.SelectedNodes | ChangeType.AssetName);
}
void OnPreviewChanged()
{
previewTexture = m_PreviewHandle.texture;
NotifyChange(ChangeType.PreviewTexture);
}
public void UpdateSelection(IEnumerable<INode> nodes)
{
selectedNodes.Clear();
selectedNodes.AddRange(nodes);
NotifyChange(ChangeType.SelectedNodes);
}
void NotifyChange(ChangeType changeType)
{
if (onChange != null)
onChange(changeType);
}
public void Dispose()
{
if (m_PreviewHandle != null)
{
m_PreviewHandle.onPreviewChanged -= OnPreviewChanged;
m_PreviewHandle = null;
};
}
}
}

260
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs.orig


using System;
using System.Linq;
using UnityEditor.Graphing.Util;
using UnityEngine;
using UnityEngine.Experimental.UIElements;
using UnityEngine.Experimental.UIElements.StyleEnums;
using UnityEngine.Experimental.UIElements.StyleSheets;
using UnityEngine.Graphing;
using UnityEngine.MaterialGraph;
namespace UnityEditor.MaterialGraph.Drawing.Inspector
{
public class GraphInspectorView : VisualElement, IDisposable
{
[SerializeField]
GraphInspectorPresenter m_Presenter;
int m_SelectionHash;
VisualElement m_Title;
VisualElement m_PropertyItems;
VisualElement m_LayerItems;
VisualElement m_ContentContainer;
AbstractNodeEditorView m_EditorView;
TypeMapper m_TypeMapper;
Image m_Preview;
VisualElement m_TopContainer;
public GraphInspectorView()
{
AddStyleSheetPath("Styles/MaterialGraph");
m_TopContainer = new VisualElement { name = "top" };
{
var headerContainer = new VisualElement { name = "header" };
{
m_Title = new VisualElement() { name = "title" };
headerContainer.Add(m_Title);
}
m_TopContainer.Add(headerContainer);
m_ContentContainer = new VisualElement { name = "content" };
m_TopContainer.Add(m_ContentContainer);
}
Add(m_TopContainer);
var bottomContainer = new VisualElement { name = "bottom" };
{
var propertiesContainer = new VisualElement { name = "properties" };
{
var header = new VisualElement { name = "header" };
{
var title = new VisualElement { name = "title", text = "Properties" };
header.Add(title);
var addPropertyButton = new Button(OnAddProperty) { text = "Add", name = "addButton" };
header.Add(addPropertyButton);
}
propertiesContainer.Add(header);
m_PropertyItems = new VisualContainer { name = "items" };
propertiesContainer.Add(m_PropertyItems);
}
bottomContainer.Add(propertiesContainer);
<<<<<<< HEAD
m_Preview = new Image { name = "preview", image = Texture2D.blackTexture };
=======
//if (m_Presenter.graph is LayeredShaderGraph)
{
var layersContainer = new VisualElement {name = "properties"};
{
var header = new VisualElement {name = "header"};
{
var title = new VisualElement {name = "title", text = "Layers"};
header.Add(title);
var addLayerButton = new Button(OnAddLayer) {text = "Add", name = "addButton"};
header.Add(addLayerButton);
}
propertiesContainer.Add(header);
m_LayerItems = new VisualContainer {name = "items"};
propertiesContainer.Add(m_LayerItems);
}
bottomContainer.Add(layersContainer);
}
m_Preview = new Image { name = "preview", image = Texture2D.blackTexture};
>>>>>>> exposed-prop-subgraph
bottomContainer.Add(m_Preview);
}
Add(bottomContainer);
// Nodes missing custom editors:
// - PropertyNode
// - SubGraphInputNode
// - SubGraphOutputNode
m_TypeMapper = new TypeMapper(typeof(INode), typeof(AbstractNodeEditorView), typeof(StandardNodeEditorView))
{
// { typeof(AbstractSurfaceMasterNode), typeof(SurfaceMasterNodeEditorView) }
};
}
void OnAddProperty()
{
var gm = new GenericMenu();
<<<<<<< HEAD
gm.AddItem(new GUIContent("Float"), false, () => AddProperty(new FloatShaderProperty()));
gm.AddItem(new GUIContent("Vector2"), false, () => AddProperty(new Vector2ShaderProperty()));
gm.AddItem(new GUIContent("Vector3"), false, () => AddProperty(new Vector3ShaderProperty()));
gm.AddItem(new GUIContent("Vector4"), false, () => AddProperty(new Vector4ShaderProperty()));
gm.AddItem(new GUIContent("Color"), false, () => AddProperty(new ColorShaderProperty()));
gm.AddItem(new GUIContent("Texture"), false, () => AddProperty(new TextureShaderProperty()));
gm.ShowAsContext();
}
void AddProperty(IShaderProperty property)
{
m_Presenter.graph.owner.RegisterCompleteObjectUndo("Add Property");
m_Presenter.graph.AddShaderProperty(property);
=======
gm.AddItem(new GUIContent("Float"), false, () => m_Presenter.graph.AddShaderProperty(new FloatShaderProperty()));
gm.AddItem(new GUIContent("Vector2"), false, () => m_Presenter.graph.AddShaderProperty(new Vector2ShaderProperty()));
gm.AddItem(new GUIContent("Vector3"), false, () => m_Presenter.graph.AddShaderProperty(new Vector3ShaderProperty()));
gm.AddItem(new GUIContent("Vector4"), false, () => m_Presenter.graph.AddShaderProperty(new Vector4ShaderProperty()));
gm.AddItem(new GUIContent("Color"), false, () => m_Presenter.graph.AddShaderProperty(new ColorShaderProperty()));
gm.AddItem(new GUIContent("Texture"), false, () => m_Presenter.graph.AddShaderProperty(new TextureShaderProperty()));
gm.ShowAsContext();
}
void OnAddLayer()
{
var layerGraph = m_Presenter.graph as LayeredShaderGraph;
if (layerGraph == null)
return;
layerGraph.AddLayer();
>>>>>>> exposed-prop-subgraph
}
public void OnChange(GraphInspectorPresenter.ChangeType changeType)
{
if (presenter == null)
{
m_ContentContainer.Clear();
m_SelectionHash = 0;
return;
}
if ((changeType & GraphInspectorPresenter.ChangeType.AssetName) != 0)
m_Title.text = presenter.assetName;
if ((changeType & GraphInspectorPresenter.ChangeType.SelectedNodes) != 0)
{
var selectionHash = UIUtilities.GetHashCode(presenter.selectedNodes.Count, presenter.selectedNodes != null ? presenter.selectedNodes.FirstOrDefault() : null);
if (selectionHash != m_SelectionHash)
{
m_SelectionHash = selectionHash;
m_ContentContainer.Clear();
if (presenter.selectedNodes.Count > 1)
{
var element = new VisualElement {name = "selectionCount", text = string.Format("{0} nodes selected.", presenter.selectedNodes.Count)};
m_ContentContainer.Add(element);
}
else if (presenter.selectedNodes.Count == 1)
{
var node = presenter.selectedNodes.First();
var view = (AbstractNodeEditorView) Activator.CreateInstance(m_TypeMapper.MapType(node.GetType()));
view.node = node;
m_ContentContainer.Add(view);
}
}
}
if ((changeType & GraphInspectorPresenter.ChangeType.PreviewTexture) != 0)
{
m_Preview.image = presenter.previewTexture ?? Texture2D.blackTexture;
}
if ((changeType & GraphInspectorPresenter.ChangeType.Graph) != 0)
{
if (m_Graph != null)
{
m_Graph.onChange -= OnGraphChange;
m_PropertyItems.Clear();
m_LayerItems.Clear();
m_Graph = null;
}
if (m_Presenter.graph != null)
{
m_Graph = m_Presenter.graph;
foreach (var property in m_Graph.properties)
m_PropertyItems.Add(new ShaderPropertyView(m_Graph, property));
var layerGraph = m_Presenter.graph as LayeredShaderGraph;
if (layerGraph != null)
foreach (var layer in layerGraph.layers)
m_LayerItems.Add(new ShaderLayerView(layerGraph, layer));
m_Graph.onChange += OnGraphChange;
}
}
}
void OnGraphChange(GraphChange change)
{
var propertyAdded = change as ShaderPropertyAdded;
if (propertyAdded != null)
m_PropertyItems.Add(new ShaderPropertyView(m_Graph, propertyAdded.shaderProperty));
var propertyRemoved = change as ShaderPropertyRemoved;
if (propertyRemoved != null)
{
var propertyView = m_PropertyItems.OfType<ShaderPropertyView>().FirstOrDefault(v => v.property.guid == propertyRemoved.guid);
if (propertyView != null)
m_PropertyItems.Remove(propertyView);
}
var layerGraph = m_Graph as LayeredShaderGraph;
if (layerGraph == null)
return;
var layerAdded = change as LayerAdded;
if (layerAdded != null)
m_LayerItems.Add(new ShaderLayerView(layerGraph, layerAdded.layer));
var layerRemoved = change as LayerRemoved;
if (layerRemoved != null)
{
var view = m_LayerItems.OfType<ShaderLayerView>().FirstOrDefault(v => v.layer.guid == layerRemoved.id);
if (view != null)
m_LayerItems.Remove(view);
}
}
AbstractMaterialGraph m_Graph;
public GraphInspectorPresenter presenter
{
get { return m_Presenter; }
set
{
if (m_Presenter == value)
return;
if (m_Presenter != null)
m_Presenter.onChange -= OnChange;
m_Presenter = value;
OnChange(GraphInspectorPresenter.ChangeType.All);
m_Presenter.onChange += OnChange;
}
}
public void Dispose()
{
if (m_Presenter != null)
m_Presenter.onChange -= OnChange;
}
}
}

7
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/GraphInspectorView.cs.orig.meta


fileFormatVersion: 2
guid: d82dd6376c038284f9b84c0cc59b2af4
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存