Restore BlendShapeClip.Apply

This commit is contained in:
ousttrue
2018-12-19 16:49:38 +09:00
parent e1d0912b05
commit b05a51c02c

View File

@@ -58,6 +58,50 @@ namespace VRM
return m_prefab;
}
}
/// <summary>
/// Apply BlendShape for Preview
/// </summary>
/// <param name="root"></param>
/// <param name="value"></param>
public void Apply(Transform root, float value)
{
if (Values != null)
{
foreach (var x in Values)
{
var target = root.Find(x.RelativePath);
if (target != null)
{
var sr = target.GetComponent<SkinnedMeshRenderer>();
if (sr != null)
{
sr.SetBlendShapeWeight(x.Index, x.Weight * value);
}
}
}
}
/*
if (MaterialValues != null)
{
foreach (var x in MaterialValues)
{
var target = root.Find(x.RelativePath);
if (target != null)
{
var sr = target.GetComponent<SkinnedMeshRenderer>();
if (sr != null)
{
var m = sr.sharedMaterials[x.Index];
var color = x.BaseValue + (x.TargetValue - x.BaseValue) * value;
m.SetColor(x.ValueName, color);
}
}
}
}
*/
}
#endif
/// <summary>