浏览代码

Focus graph when changing selection.

/main
Tim Cooper 8 年前
当前提交
8133e0c7
共有 3 个文件被更改,包括 14 次插入5 次删除
  1. 13
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/AbstractGraphEditWindow.cs
  2. 2
      MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/GraphEditorDrawer.cs
  3. 4
      MaterialGraphProject/Assets/NewUI/Editor/Views/GraphView.cs

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


using System;
using System.Runtime.Remoting.Messaging;
using RMGUI.GraphView;
using UnityEngine;
using UnityEngine.Graphing;

protected GraphView graphView
{
get { return m_GraphEditorDrawer.GraphView; }
get { return m_GraphEditorDrawer.graphView; }
}
private GraphEditorDrawer m_GraphEditorDrawer;

Repaint();
}
private bool focused { get; set; }
private void Focus(TimerState timerState)
{
m_GraphEditorDrawer.graphView.FrameAll();
focused = true;
}
void OnSelectionChange()
{
if (Selection.activeObject == null || !EditorUtility.IsPersistent(Selection.activeObject))

var source = CreateDataSource();
source.Initialize(m_LastSelection, this);
m_GraphEditorDrawer.dataSource = source;
focused = false;
m_GraphEditorDrawer.graphView.Schedule(Focus).StartingIn(1).Until(() => focused);
}
}
}

2
MaterialGraphProject/Assets/GraphFramework/SerializableGraph/Editor/Drawing/Drawer/GraphEditorDrawer.cs


{
private GraphView m_GraphView;
public GraphView GraphView
public GraphView graphView
{
get { return m_GraphView; }
}

4
MaterialGraphProject/Assets/NewUI/Editor/Views/GraphView.cs


return EventPropagation.Stop;
}
protected EventPropagation FrameAll()
public EventPropagation FrameAll()
{
return Frame(FrameType.All);
}

return Frame(FrameType.Selection);
}
protected EventPropagation FrameOrigin()
public EventPropagation FrameOrigin()
{
return Frame(FrameType.Origin);
}

正在加载...
取消
保存