|
|
|
|
|
|
class FloatingWindowsLayout |
|
|
|
{ |
|
|
|
public Rect previewLayout; |
|
|
|
public Rect blackboardLayout; |
|
|
|
} |
|
|
|
|
|
|
|
public class GraphEditorView : VisualElement, IDisposable |
|
|
|
|
|
|
BlackboardProvider m_BlackboardProvider; |
|
|
|
|
|
|
|
string m_FloatingWindowsLayoutKey; |
|
|
|
FloatingWindowsLayout m_FLoatingWindowsLayout; |
|
|
|
FloatingWindowsLayout m_FloatingWindowsLayout; |
|
|
|
|
|
|
|
public Action saveRequested { get; set; } |
|
|
|
|
|
|
|
|
|
|
m_MasterPreviewView = new MasterPreviewView(assetName, previewManager, graph) { name = "masterPreview" }; |
|
|
|
|
|
|
|
WindowDraggable masterPreviewViewDraggable = new WindowDraggable(); |
|
|
|
masterPreviewViewDraggable.OnDragFinished += UpdateSerializedWindowLayout; |
|
|
|
m_MasterPreviewView.Add(masterPreviewResizeBorderFrame); |
|
|
|
|
|
|
|
m_BlackboardProvider.onDragFinished += UpdateSerializedWindowLayout; |
|
|
|
m_BlackboardProvider.onResizeFinished += UpdateSerializedWindowLayout; |
|
|
|
masterPreviewViewDraggable.OnDragFinished += UpdateSerializedWindowLayout; |
|
|
|
m_MasterPreviewView.Add(masterPreviewResizeBorderFrame); |
|
|
|
|
|
|
|
m_GraphView.graphViewChanged = GraphViewChanged; |
|
|
|
|
|
|
|
|
|
|
if (!String.IsNullOrEmpty(serializedWindowLayout)) |
|
|
|
{ |
|
|
|
m_FLoatingWindowsLayout = JsonUtility.FromJson<FloatingWindowsLayout>(serializedWindowLayout); |
|
|
|
m_MasterPreviewView.layout = m_FLoatingWindowsLayout.previewLayout; |
|
|
|
m_FloatingWindowsLayout = JsonUtility.FromJson<FloatingWindowsLayout>(serializedWindowLayout); |
|
|
|
m_MasterPreviewView.layout = m_FloatingWindowsLayout.previewLayout; |
|
|
|
if (m_FloatingWindowsLayout.blackboardLayout.width > 0) |
|
|
|
m_BlackboardProvider.blackboard.layout = m_FloatingWindowsLayout.blackboardLayout; |
|
|
|
m_FLoatingWindowsLayout = new FloatingWindowsLayout(); |
|
|
|
m_FloatingWindowsLayout = new FloatingWindowsLayout(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void OnSpaceDown(KeyDownEvent evt) |
|
|
|
{ |
|
|
|
if( evt.keyCode == KeyCode.Space) |
|
|
|
if(evt.keyCode == KeyCode.Space && !evt.shiftKey && !evt.altKey && !evt.ctrlKey && !evt.commandKey) |
|
|
|
{ |
|
|
|
if (graphView.nodeCreationRequest == null) |
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
void UpdateSerializedWindowLayout() |
|
|
|
{ |
|
|
|
m_FLoatingWindowsLayout.previewLayout = m_MasterPreviewView.layout; |
|
|
|
m_FloatingWindowsLayout.previewLayout = m_MasterPreviewView.layout; |
|
|
|
m_FloatingWindowsLayout.blackboardLayout = m_BlackboardProvider.blackboard.layout; |
|
|
|
string serializedWindowLayout = JsonUtility.ToJson(m_FLoatingWindowsLayout); |
|
|
|
string serializedWindowLayout = JsonUtility.ToJson(m_FloatingWindowsLayout); |
|
|
|
EditorUserSettings.SetConfigValue(m_FloatingWindowsLayoutKey, serializedWindowLayout); |
|
|
|
} |
|
|
|
|
|
|
|