keep prefab reference on BlendShapeClip

This commit is contained in:
ousttrue
2018-04-20 09:54:43 +09:00
parent ac55b6333b
commit 3dd41ce271
4 changed files with 40 additions and 17 deletions

View File

@@ -24,6 +24,26 @@ namespace VRM
[CreateAssetMenu(menuName = "VRM/BlendShapeClip")]
public class BlendShapeClip : ScriptableObject
{
[SerializeField]
GameObject m_prefab;
public GameObject Prefab
{
set { m_prefab = value; }
get {
#if UNITY_EDITOR
if (m_prefab == null)
{
var assetPath = UnityEditor.AssetDatabase.GetAssetPath(this);
if (!string.IsNullOrEmpty(assetPath))
{
m_prefab = UnityEditor.AssetDatabase.LoadAssetAtPath<GameObject>(assetPath);
}
}
#endif
return m_prefab;
}
}
[SerializeField]
public string BlendShapeName = "";
@@ -74,14 +94,5 @@ namespace VRM
}
*/
}
public static BlendShapeClip Create(BlendShapePreset preset)
{
var clip = ScriptableObject.CreateInstance<BlendShapeClip>();
clip.Preset = preset;
clip.BlendShapeName = preset.ToString();
clip.name = preset.ToString();
return clip;
}
}
}