mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-15 07:21:01 -05:00
keep prefab reference on BlendShapeClip
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user