浏览代码

Add SerializableMesh

/main
Jens Holm 7 年前
当前提交
d52d83b7
共有 2 个文件被更改,包括 51 次插入0 次删除
  1. 40
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/SerializableMesh.cs
  2. 11
      MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/SerializableMesh.cs.meta

40
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/SerializableMesh.cs


using System;
using UnityEngine;
namespace UnityEditor.ShaderGraph
{
[Serializable]
public class SerializableMesh
{
[SerializeField]
private string m_SerializedMesh;
[Serializable]
private class MeshHelper
{
public Mesh mesh;
}
public Mesh mesh
{
get
{
if (string.IsNullOrEmpty(m_SerializedMesh))
return null;
var meshHelper = new MeshHelper();
EditorJsonUtility.FromJsonOverwrite(m_SerializedMesh, meshHelper);
return meshHelper.mesh;
}
set
{
if (mesh == value)
return;
var meshHelper = new MeshHelper();
meshHelper.mesh = value;
m_SerializedMesh = EditorJsonUtility.ToJson(meshHelper, true);
}
}
}
}

11
MaterialGraphProject/Assets/UnityShaderEditor/Editor/Data/Graphs/SerializableMesh.cs.meta


fileFormatVersion: 2
guid: 944c4fc9d004e7845adb3f86843ab742
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
正在加载...
取消
保存