浏览代码

TitleBarDrawData is now managed by GraphDataSource rather than GraphEditWindow

/main
Peter Bay Bastian 8 年前
当前提交
c299e028
共有 3 个文件被更改,包括 22 次插入5 次删除
  1. 11
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphDataSource.cs
  2. 5
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphEditWindow.cs
  3. 11
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/DrawData/TitleBarDrawData.cs

11
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphDataSource.cs


[SerializeField]
private List<GraphElementData> m_TempElements = new List<GraphElementData>();
[SerializeField]
private TitleBarDrawData m_TitleBar;
public TitleBarDrawData titleBar
{
get { return m_TitleBar; }
}
void OnNodeChanged(INode inNode, ModificationScope scope)
{

AddTypeMappings();
this.graphAsset = graphAsset;
m_TitleBar = CreateInstance<TitleBarDrawData>();
m_TitleBar.Initialize(graphAsset);
if (graphAsset == null)
return;

5
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphEditWindow.cs


var source = CreateDataSource();
source.Initialize(m_LastSelection);
m_GraphView.dataSource = source;
var titleBarData = CreateInstance<TitleBarDrawData>();
titleBarData.title = m_LastSelection != null ? m_LastSelection.GetScriptableObject().name : "";
m_TitleBarDrawer.dataProvider = titleBarData;
m_TitleBarDrawer.dataProvider = source.titleBar;
m_GraphView.StretchToParentSize();
Repaint();

11
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/DrawData/TitleBarDrawData.cs


using RMGUI.GraphView;
using UnityEngine;
using UnityEngine.Graphing;
namespace UnityEditor.Graphing.Drawing
{

{
}
public string title;
public string title;
public void Initialize(IGraphAsset graphAsset)
{
if (graphAsset == null)
return;
title = graphAsset.GetScriptableObject().name;
}
}
}
正在加载...
取消
保存