浏览代码

Various bug fixes

* Clean up master preview render data
* Add size check to IndexSet.Contains
/main
Peter Bay Bastian 7 年前
当前提交
e1f95448
共有 4 个文件被更改,包括 23 次插入21 次删除
  1. 37
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewManager.cs
  2. 3
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PreviewSceneResources.cs
  3. 2
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Util/IndexSet.cs
  4. 2
      MaterialGraphProject/ProjectSettings/ProjectVersion.txt

37
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/PreviewManager.cs


}
}
void DestroyRenderData(PreviewRenderData renderData)
{
if (renderData.shaderData.shader != null && renderData.shaderData.shader != m_UberShader)
Object.DestroyImmediate(renderData.shaderData.shader, true);
if (renderData.renderTexture != null)
Object.DestroyImmediate(renderData.renderTexture, true);
var node = renderData.shaderData.node;
if (node != null)
node.onModified -= OnNodeModified;
}
if (renderData.shaderData.shader != null && renderData.shaderData.shader != m_UberShader)
Object.DestroyImmediate(renderData.shaderData.shader, true);
if (renderData.renderTexture != null)
Object.DestroyImmediate(renderData.renderTexture, true);
var node = renderData.shaderData.node;
if (node != null)
node.onModified -= OnNodeModified;
if (masterRenderData != null && masterRenderData.shaderData != null && masterRenderData.shaderData.node == renderData.shaderData.node)
masterRenderData.shaderData = m_RenderDatas.Where(x => x != null && x.shaderData.node is IMasterNode).Select(x => x.shaderData).FirstOrDefault();
DestroyRenderData(renderData);
m_TimeDependentPreviews.Remove(nodeId.index);
m_DirtyPreviews.Remove(nodeId.index);

if (masterRenderData.shaderData != null && masterRenderData.shaderData.node == node)
masterRenderData.shaderData = m_RenderDatas.Where(x => x != null && x.shaderData.node is IMasterNode).Select(x => x.shaderData).FirstOrDefault();
renderData.shaderData.shader = null;
renderData.renderTexture = null;
renderData.texture = null;
renderData.onPreviewChanged = null;
}
}

m_SceneResources.Dispose();
m_SceneResources = null;
}
foreach (var renderData in m_RenderDatas.ToList())
DestroyPreview(renderData.shaderData.node.tempId);
if (m_MasterRenderData != null)
DestroyRenderData(m_MasterRenderData);
foreach (var renderData in m_RenderDatas.ToList().Where(x => x != null))
DestroyRenderData(renderData);
m_RenderDatas.Clear();
}
public void Dispose()

3
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Drawing/Views/PreviewSceneResources.cs


light1.color = new Color(.4f, .4f, .45f, 0f) * .7f;
m_CheckerboardMaterial = new Material(Shader.Find("Hidden/Checkerboard"));
checkerboardMaterial.shader.hideFlags = HideFlags.HideAndDontSave;
checkerboardMaterial.hideFlags = HideFlags.HideAndDontSave;
if (s_Meshes[0] == null)

if (checkerboardMaterial != null)
{
UnityEngine.Object.DestroyImmediate(checkerboardMaterial);
UnityEngine.Object.DestroyImmediate(checkerboardMaterial, true);
m_CheckerboardMaterial = null;
}

2
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Util/IndexSet.cs


{
var maskIndex = index >> 5;
var bitIndex = index & 31;
return (m_Masks[maskIndex] & ((uint)1 << bitIndex)) > 0;
return maskIndex < m_Masks.Count && (m_Masks[maskIndex] & ((uint)1 << bitIndex)) > 0;
}
public void CopyTo(int[] array, int arrayIndex)

2
MaterialGraphProject/ProjectSettings/ProjectVersion.txt


m_EditorVersion: 2018.1.0b2
m_EditorVersion: 2018.1.0b1
正在加载...
取消
保存