浏览代码

Remove legacy code from MaterialGraphView, which was causing the selection to be cleared when zooming/panning (#45)

/main
Peter Bay Bastian 7 年前
当前提交
262456fb
共有 1 个文件被更改,包括 0 次插入29 次删除
  1. 29
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialGraphView.cs

29
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/MaterialGraphView.cs


{
public sealed class MaterialGraphView : GraphView
{
[SerializeField]
GraphDrawingData m_DrawingData = new GraphDrawingData();
public GraphDrawingData drawingData
{
get { return m_DrawingData; }
}
public MaterialGraphView()
{
this.AddManipulator(new ContentZoomer());

var graphDataSource = GetPresenter<MaterialGraphPresenter>();
graphDataSource.AddNode(node);
}
public override void OnDataChanged()
{
base.OnDataChanged();
var graphDataSource = GetPresenter<MaterialGraphPresenter>();
if (graphDataSource == null)
return;
if (drawingData.selection.SequenceEqual(selection.OfType<MaterialNodeView>().Select(d => ((MaterialNodePresenter)d.presenter).node.guid))) return;
var selectedDrawers = drawingData.selection
.Select(guid => contentViewContainer
.OfType<MaterialNodeView>()
.FirstOrDefault(drawer => ((MaterialNodePresenter)drawer.presenter).node.guid == guid))
.ToList();
ClearSelection();
foreach (var drawer in selectedDrawers)
AddToSelection(drawer);
}
void PropagateSelection()

正在加载...
取消
保存