浏览代码

Merge pull request #1352 from Unity-Technologies/sg/blackboard-deserialization-safeguard

Ensure the blackboard remains in view after deserialization
/main
GitHub 6 年前
当前提交
2b11377f
共有 2 个文件被更改,包括 14 次插入2 次删除
  1. 1
      ShaderGraph/CHANGELOG.md
  2. 15
      ShaderGraph/com.unity.shadergraph/Editor/Drawing/Views/GraphEditorView.cs

1
ShaderGraph/CHANGELOG.md


- Pasting a property node into another graph will now convert it to a concrete node. ([#300](https://github.com/Unity-Technologies/ShaderGraph/issues/300) and [#307](https://github.com/Unity-Technologies/ShaderGraph/pull/307))
- Make nodes that are copied from one graph to another spawn in the center of the current view. ([#333](https://github.com/Unity-Technologies/ShaderGraph/issues/333))
- Fixed an issue with editable sub graph paths, causing the search window to sometimes yield a null reference exception.
- Ensure that the blackboard is within view when deserialized.

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);
}

正在加载...
取消
保存