浏览代码

Change window layout serialization to happen when resize or dragging of master preview finished changing

/main
Jens Holm 7 年前
当前提交
46fe1f23
共有 1 个文件被更改,包括 14 次插入8 次删除
  1. 22
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/GraphEditorView.cs

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


MaterialGraphView m_GraphView;
GraphInspectorView m_GraphInspectorView;
MasterPreviewView m_MasterNodeView;
MasterPreviewView m_MasterPreviewView;
private EditorWindow m_EditorWindow;

m_GraphView.Add(m_GraphInspectorView);
m_MasterNodeView = new MasterPreviewView(assetName, previewManager, graph) { name = "masterNodePreview" };
m_MasterNodeView.RegisterCallback<PostLayoutEvent>(UpdateSerializedWindowLayout);
m_MasterPreviewView = new MasterPreviewView(assetName, previewManager, graph) { name = "masterNodePreview" };
m_GraphView.Add(m_MasterNodeView);
WindowDraggable masterPreviewViewDraggable = new WindowDraggable();
masterPreviewViewDraggable.OnDragFinished += UpdateSerializedWindowLayout;
m_MasterPreviewView.AddManipulator(masterPreviewViewDraggable);
m_GraphView.Add(m_MasterPreviewView);
ResizeBorderFrame masterPreviewResizeBorderFrame = new ResizeBorderFrame(m_MasterPreviewView) { name = "resizeBorderFrame" };
masterPreviewResizeBorderFrame.OnResizeFinished += UpdateSerializedWindowLayout;
m_MasterPreviewView.Add(masterPreviewResizeBorderFrame);
m_FloatingWindowsLayoutKey = "FloatingWindowsLayout";
m_FloatingWindowsLayoutKey = "UnityEditor.ShaderGraph.FloatingWindowsLayout";
string serializedWindowLayout = EditorUserSettings.GetConfigValue(m_FloatingWindowsLayoutKey);
if (!String.IsNullOrEmpty(serializedWindowLayout))

m_GraphInspectorView.layout = m_FLoatingWindowsLayout.inspectorLayout;
m_MasterNodeView.layout = m_FLoatingWindowsLayout.previewLayout;
m_MasterPreviewView.layout = m_FLoatingWindowsLayout.previewLayout;
}
else
{

}
}
void UpdateSerializedWindowLayout(PostLayoutEvent evt)
void UpdateSerializedWindowLayout()
m_FLoatingWindowsLayout.previewLayout = m_MasterNodeView.layout;
m_FLoatingWindowsLayout.previewLayout = m_MasterPreviewView.layout;
string serializedWindowLayout = JsonUtility.ToJson(m_FLoatingWindowsLayout);
EditorUserSettings.SetConfigValue(m_FloatingWindowsLayoutKey, serializedWindowLayout);

正在加载...
取消
保存