|
|
|
|
|
|
namespace UnityEditor.ShaderGraph |
|
|
|
{ |
|
|
|
[Serializable] |
|
|
|
public class SerializableCubemap |
|
|
|
public class SerializableCubemap : ISerializationCallbackReceiver |
|
|
|
{ |
|
|
|
[SerializeField] |
|
|
|
private string m_SerializedCubemap; |
|
|
|
|
|
|
public Cubemap cubemap; |
|
|
|
} |
|
|
|
|
|
|
|
Cubemap m_Cubemap; |
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(m_SerializedCubemap)) |
|
|
|
return null; |
|
|
|
|
|
|
|
var cube = new CubemapHelper(); |
|
|
|
EditorJsonUtility.FromJsonOverwrite(m_SerializedCubemap, cube); |
|
|
|
return cube.cubemap; |
|
|
|
if (m_Cubemap == null && !string.IsNullOrEmpty(m_SerializedCubemap)) |
|
|
|
{ |
|
|
|
var cube = new CubemapHelper(); |
|
|
|
EditorJsonUtility.FromJsonOverwrite(m_SerializedCubemap, cube); |
|
|
|
m_Cubemap = cube.cubemap; |
|
|
|
m_SerializedCubemap = null; |
|
|
|
} |
|
|
|
return m_Cubemap; |
|
|
|
set |
|
|
|
{ |
|
|
|
if (cubemap == value) |
|
|
|
return; |
|
|
|
set { m_Cubemap = value; } |
|
|
|
} |
|
|
|
var cube = new CubemapHelper(); |
|
|
|
cube.cubemap = value; |
|
|
|
m_SerializedCubemap = EditorJsonUtility.ToJson(cube, true); |
|
|
|
} |
|
|
|
public void OnBeforeSerialize() |
|
|
|
{ |
|
|
|
var cube = new CubemapHelper { cubemap = cubemap }; |
|
|
|
m_SerializedCubemap = EditorJsonUtility.ToJson(cube, true); |
|
|
|
} |
|
|
|
|
|
|
|
public void OnAfterDeserialize() |
|
|
|
{ |
|
|
|
} |
|
|
|
} |
|
|
|
} |