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