Files
UmaViewer/Assets/Scripts/Pose/SerializableMorph.cs
T
2023-12-18 17:20:34 +01:00

35 lines
768 B
C#

using Gallop;
using System;
[System.Serializable]
public class SerializableMorph
{
public string Name = "";
public float Value = 0;
/// <summary> Reference to original morph for runtime. Not saved to file. </summary>
[NonSerialized] public FacialMorph Morph;
public SerializableMorph() { }
public SerializableMorph(FacialMorph morph)
{
Name = morph.name;
Value = morph.weight;
Morph = morph;
}
public void ApplyTo(UmaContainerCharacter character, FacialMorph morph, bool applyImmediately = true)
{
if (applyImmediately)
{
character.FaceDrivenKeyTarget.ChangeMorphWeight(morph, Value);
}
else
{
morph.weight = Value;
}
}
}