浏览代码

Serialize layout of floating windows in GraphEditorView

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

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


namespace UnityEditor.ShaderGraph.Drawing
{
[Serializable]
class FloatingWindowsLayout
{
public Rect inspectorLayout;
public Rect previewLayout;
}
public class GraphEditorView : VisualElement, IDisposable
{
MaterialGraphView m_GraphView;

PreviewManager m_PreviewManager;
SearchWindowProvider m_SearchWindowProvider;
EdgeConnectorListener m_EdgeConnectorListener;
string m_FloatingWindowsLayoutKey;
FloatingWindowsLayout m_FLoatingWindowsLayout;
public Action onUpdateAssetClick
{

m_GraphView.Add(m_MasterNodeView);
m_GraphView.graphViewChanged = GraphViewChanged;
m_FloatingWindowsLayoutKey = assetName + "_FloatingWindowsLayout";
string serializedWindowLayout = EditorUserSettings.GetConfigValue(m_FloatingWindowsLayoutKey);
if (!String.IsNullOrEmpty(serializedWindowLayout))
{
m_FLoatingWindowsLayout = JsonUtility.FromJson<FloatingWindowsLayout>(serializedWindowLayout);
m_GraphInspectorView.layout = m_FLoatingWindowsLayout.inspectorLayout;
m_MasterNodeView.layout = m_FLoatingWindowsLayout.previewLayout;
}
else
{
m_FLoatingWindowsLayout = new FloatingWindowsLayout();
}
}
m_SearchWindowProvider = ScriptableObject.CreateInstance<SearchWindowProvider>();

Object.DestroyImmediate(m_SearchWindowProvider);
m_SearchWindowProvider = null;
}
m_FLoatingWindowsLayout.inspectorLayout = m_GraphInspectorView.layout;
m_FLoatingWindowsLayout.previewLayout = m_MasterNodeView.layout;
string serializedWindowLayout = JsonUtility.ToJson(m_FLoatingWindowsLayout);
EditorUserSettings.SetConfigValue(m_FloatingWindowsLayoutKey, serializedWindowLayout);
}
}
}
正在加载...
取消
保存