|
|
|
|
|
|
using UnityEditor.ShaderGraph.Drawing.Inspector; |
|
|
|
using UnityEngine.Experimental.UIElements.StyleEnums; |
|
|
|
using UnityEngine.Experimental.UIElements.StyleSheets; |
|
|
|
using UnityEngine.Rendering; |
|
|
|
using Edge = UnityEditor.Experimental.UIElements.GraphView.Edge; |
|
|
|
using Object = UnityEngine.Object; |
|
|
|
#if UNITY_2018_1
|
|
|
|
|
|
|
|
|
|
|
m_BlackboardProvider = new BlackboardProvider(assetName, graph); |
|
|
|
m_GraphView.Add(m_BlackboardProvider.blackboard); |
|
|
|
m_BlackboardProvider.blackboard.style.positionType = StyleValue<PositionType>.Create(PositionType.Absolute); |
|
|
|
m_BlackboardProvider.blackboard.style.positionLeft = StyleValue<float>.Create(10f); |
|
|
|
m_BlackboardProvider.blackboard.style.positionTop = StyleValue<float>.Create(10f); |
|
|
|
Rect blackboardLayout = m_BlackboardProvider.blackboard.layout; |
|
|
|
blackboardLayout.x = 10f; |
|
|
|
blackboardLayout.y = 10f; |
|
|
|
m_BlackboardProvider.blackboard.layout = blackboardLayout; |
|
|
|
|
|
|
|
m_MasterPreviewView = new MasterPreviewView(assetName, previewManager, graph) { name = "masterPreview" }; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
m_BlackboardProvider.onDragFinished += UpdateSerializedWindowLayout; |
|
|
|
m_BlackboardProvider.onResizeFinished += UpdateSerializedWindowLayout; |
|
|
|
//m_BlackboardProvider.onDragFinished += UpdateSerializedWindowLayout;
|
|
|
|
//m_BlackboardProvider.onResizeFinished += UpdateSerializedWindowLayout;
|
|
|
|
masterPreviewViewDraggable.OnDragFinished += UpdateSerializedWindowLayout; |
|
|
|
m_MasterPreviewView.previewResizeBorderFrame.OnResizeFinished += UpdateSerializedWindowLayout; |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void StoreBlackboardLayoutOnGeometryChanged(GeometryChangedEvent evt) |
|
|
|
{ |
|
|
|
UpdateSerializedWindowLayout(); |
|
|
|
} |
|
|
|
|
|
|
|
void ApplySerializewindowLayouts(GeometryChangedEvent evt) |
|
|
|
{ |
|
|
|
UnregisterCallback<GeometryChangedEvent>(ApplySerializewindowLayouts); |
|
|
|
|
|
|
m_MasterPreviewView.previewTextureView.style.height = StyleValue<float>.Create(m_FloatingWindowsLayout.masterPreviewSize.y); |
|
|
|
|
|
|
|
// Restore blackboard layout
|
|
|
|
m_FloatingWindowsLayout.blackboardLayout.ApplyPosition(m_BlackboardProvider.blackboard); |
|
|
|
m_FloatingWindowsLayout.blackboardLayout.ApplySize(m_BlackboardProvider.blackboard); |
|
|
|
m_BlackboardProvider.blackboard.layout = m_FloatingWindowsLayout.blackboardLayout.GetLayout(this.layout); |
|
|
|
|
|
|
|
previewManager.ResizeMasterPreview(m_FloatingWindowsLayout.masterPreviewSize); |
|
|
|
} |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// After the layout is restored from the previous session, start tracking layout changes in the blackboard.
|
|
|
|
m_BlackboardProvider.blackboard.RegisterCallback<GeometryChangedEvent>(StoreBlackboardLayoutOnGeometryChanged); |
|
|
|
} |
|
|
|
|
|
|
|
void UpdateSerializedWindowLayout() |
|
|
|