浏览代码

Ensure the blackboard remains in view after deserialization

/main
Peter Bay Bastian 6 年前
当前提交
fe56266d
共有 1 个文件被更改,包括 13 次插入2 次删除
  1. 15
      ShaderGraph/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs

15
ShaderGraph/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs


m_MasterPreviewView.previewTextureView.style.width = StyleValue<float>.Create(m_FloatingWindowsLayout.masterPreviewSize.x);
m_MasterPreviewView.previewTextureView.style.height = StyleValue<float>.Create(m_FloatingWindowsLayout.masterPreviewSize.y);
// Restore blackboard layout
m_BlackboardProvider.blackboard.layout = m_FloatingWindowsLayout.blackboardLayout.GetLayout(this.layout);
// Restore blackboard layout, and make sure that it remains in the view.
Rect blackboardRect = m_FloatingWindowsLayout.blackboardLayout.GetLayout(this.layout);
// Make sure the dimensions are sufficiently large.
blackboardRect.width = Mathf.Clamp(blackboardRect.width, 160f, m_GraphView.contentContainer.layout.width);
blackboardRect.height = Mathf.Clamp(blackboardRect.height, 160f, m_GraphView.contentContainer.layout.height);
// Make sure that the positionining is on screen.
blackboardRect.x = Mathf.Clamp(blackboardRect.x, 0f, Mathf.Max(1f, m_GraphView.contentContainer.layout.width - blackboardRect.width - blackboardRect.width));
blackboardRect.y = Mathf.Clamp(blackboardRect.y, 0f, Mathf.Max(1f, m_GraphView.contentContainer.layout.height - blackboardRect.height - blackboardRect.height));
// Set the processed blackboard layout.
m_BlackboardProvider.blackboard.layout = blackboardRect;
previewManager.ResizeMasterPreview(m_FloatingWindowsLayout.masterPreviewSize);
}

正在加载...
取消
保存