mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-05-13 05:54:59 -05:00
restore expression
This commit is contained in:
parent
1584ca90d5
commit
d059cbea79
|
|
@ -8,24 +8,24 @@ namespace UniVRM10
|
|||
{
|
||||
public static class ExpressionExtensions
|
||||
{
|
||||
// public static MorphTargetBinding? Build10(this MorphTargetBind bind, GameObject root, Vrm10Importer.ModelMap loader, VrmLib.Model model)
|
||||
// {
|
||||
// if (bind.Node.TryGetValidIndex(model.Nodes.Count, out var nodeIndex))
|
||||
// {
|
||||
// var libNode = model.Nodes[nodeIndex];
|
||||
// if (libNode.MeshGroup == null)
|
||||
// {
|
||||
// return default;
|
||||
// }
|
||||
// var node = loader.Nodes[libNode].transform;
|
||||
// var relativePath = node.RelativePathFrom(root.transform);
|
||||
// return new MorphTargetBinding(relativePath, bind.Index.Value, bind.Weight.Value);
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return default;
|
||||
// }
|
||||
// }
|
||||
public static MorphTargetBinding? Build10(this MorphTargetBind bind, GameObject root, Vrm10Importer importer)
|
||||
{
|
||||
if (bind.Node.TryGetValidIndex(importer.Nodes.Count, out var nodeIndex))
|
||||
{
|
||||
var node = importer.Nodes[nodeIndex];
|
||||
var smr = node.GetComponent<SkinnedMeshRenderer>();
|
||||
if (smr == null)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
var relativePath = node.RelativePathFrom(root.transform);
|
||||
return new MorphTargetBinding(relativePath, bind.Index.Value, bind.Weight.Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
return default;
|
||||
}
|
||||
}
|
||||
|
||||
public static UniVRM10.MaterialColorBinding? Build10(this MaterialColorBind bind, IReadOnlyList<MaterialFactory.MaterialLoadInfo> materials)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -420,15 +420,15 @@ namespace UniVRM10
|
|||
clip.OverrideLookAt = expression.OverrideLookAt;
|
||||
clip.OverrideMouth = expression.OverrideMouth;
|
||||
|
||||
// if (expression.MorphTargetBinds != null)
|
||||
// {
|
||||
// clip.MorphTargetBindings = expression.MorphTargetBinds?
|
||||
// .Select(x => x.Build10(Root, m_map, m_model))
|
||||
// .Where(x => x.HasValue)
|
||||
// .Select(x => x.Value)
|
||||
// .ToArray();
|
||||
// }
|
||||
// else
|
||||
if (expression.MorphTargetBinds != null)
|
||||
{
|
||||
clip.MorphTargetBindings = expression.MorphTargetBinds?
|
||||
.Select(x => x.Build10(Root, this))
|
||||
.Where(x => x.HasValue)
|
||||
.Select(x => x.Value)
|
||||
.ToArray();
|
||||
}
|
||||
else
|
||||
{
|
||||
clip.MorphTargetBindings = new MorphTargetBinding[] { };
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user