浏览代码

Add hide flags to master preview rendertexture (fixed #225)

/main
Jens Holm 7 年前
当前提交
9c44af93
共有 1 个文件被更改,包括 10 次插入20 次删除
  1. 30
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Inspector/MasterPreviewView.cs

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


middleContainer.AddManipulator(new Scrollable(OnScroll));
}
Add(middleContainer);
EditorApplication.playmodeStateChanged += RefreshRenderTextureSize;
}
void BuildContextualMenu(ContextualMenuPopulateEvent evt)

public void RefreshRenderTextureSize()
{
RenderTextureDescriptor descriptor = m_PreviewRenderHandle.renderTexture.descriptor;
RenderTextureDescriptor descriptor;
if (m_PreviewRenderHandle.renderTexture)
{
descriptor = m_PreviewRenderHandle.renderTexture.descriptor;
descriptor.width = (int)m_PreviewTextureView.contentRect.width;
descriptor.height = (int)m_PreviewTextureView.contentRect.height;
if (Mathf.Approximately(descriptor.width, descriptor.height) && Mathf.Approximately(descriptor.height, descriptor.height))
{
return;
}
m_PreviewRenderHandle.renderTexture.Release();
Object.DestroyImmediate(m_PreviewRenderHandle.renderTexture);
}
else
if (Mathf.Approximately(descriptor.width, targetHeight) && Mathf.Approximately(descriptor.height, targetWidth))
descriptor = new RenderTextureDescriptor((int)targetWidth, (int)targetHeight, RenderTextureFormat.ARGB32, 16);
return;
descriptor.width = (int)m_PreviewTextureView.contentRect.width;
descriptor.height = (int)m_PreviewTextureView.contentRect.height;
m_PreviewRenderHandle.renderTexture.Release();
Object.DestroyImmediate(m_PreviewRenderHandle.renderTexture);
DirtyMasterNode(ModificationScope.Node);
}

正在加载...
取消
保存