浏览代码

Fix material animation in reflection probes

/main
Evgenii Golubev 7 年前
当前提交
8ffeafaf
共有 1 个文件被更改,包括 13 次插入13 次删除
  1. 26
      ScriptableRenderPipeline/Core/CoreRP/Utilities/CoreUtils.cs

26
ScriptableRenderPipeline/Core/CoreRP/Utilities/CoreUtils.cs


bool animateMaterials = true;
#if UNITY_EDITOR
animateMaterials = false;
animateMaterials = Application.isPlaying;
if (camera.cameraType == CameraType.Game)
if (camera.cameraType == CameraType.SceneView)
animateMaterials = Application.isPlaying;
}
else if (camera.cameraType == CameraType.Preview)
{
animateMaterials = false;
foreach (UnityEditor.MaterialEditor med in Resources.FindObjectsOfTypeAll(typeof(UnityEditor.MaterialEditor)))
foreach (UnityEditor.SceneView sv in Resources.FindObjectsOfTypeAll(typeof(UnityEditor.SceneView)))
// Warning: currently, there's no way to determine whether a given camera corresponds to this MaterialEditor.
// Therefore, if at least one of the visible MaterialEditors is in Play Mode, all of them will play.
if (med.isVisible && med.RequiresConstantRepaint())
if (sv.camera == camera && sv.sceneViewState.showMaterialUpdate)
{
animateMaterials = true;
break;

else
else if (camera.cameraType == CameraType.Preview)
animateMaterials = false;
foreach (UnityEditor.SceneView sv in Resources.FindObjectsOfTypeAll(typeof(UnityEditor.SceneView)))
foreach (UnityEditor.MaterialEditor med in Resources.FindObjectsOfTypeAll(typeof(UnityEditor.MaterialEditor)))
if (sv.camera == camera && sv.sceneViewState.showMaterialUpdate)
// Warning: currently, there's no way to determine whether a given camera corresponds to this MaterialEditor.
// Therefore, if at least one of the visible MaterialEditors is in Play Mode, all of them will play.
if (med.isVisible && med.RequiresConstantRepaint())
{
animateMaterials = true;
break;

正在加载...
取消
保存