浏览代码

Add dimension check when master preview is resized

When themaster review is resized, the new size is checked, and if it has not changed, the rendertexture is not changed.
/main
Jens Holm 7 年前
当前提交
6b956d8e
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/MasterPreviewView.cs

9
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/MasterPreviewView.cs


{
RenderTextureDescriptor descriptor = m_PreviewRenderHandle.renderTexture.descriptor;
var targetWidth = m_PreviewTextureView.contentRect.width;
var targetHeight = m_PreviewTextureView.contentRect.height;
if (Mathf.Approximately(descriptor.width, targetHeight) && Mathf.Approximately(descriptor.height, targetWidth))
{
return;
}
Object.DestroyImmediate(m_PreviewRenderHandle.renderTexture);
m_PreviewRenderHandle.renderTexture = new RenderTexture(descriptor);
}

正在加载...
取消
保存