提交捏脸插件

This commit is contained in:
2025-09-18 00:07:48 +08:00
parent cde46100ff
commit aba294e510
1676 changed files with 295391 additions and 4 deletions

View File

@@ -0,0 +1,32 @@
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
namespace CC
{
public class BlendshapeManager : MonoBehaviour
{
public Dictionary<string, int> NameToIndex = new Dictionary<string, int>();
private SkinnedMeshRenderer mesh;
public void parseBlendshapes()
{
mesh = gameObject.GetComponent<SkinnedMeshRenderer>();
if (mesh.sharedMesh != null)
{
for (int i = 0; i < mesh.sharedMesh.blendShapeCount; i++)
{
string[] split = mesh.sharedMesh.GetBlendShapeName(i).Split(".");
NameToIndex.Add(split[split.Length - 1], i);
}
}
}
public void setBlendshape(string name, float value)
{
if (NameToIndex.ContainsKey(name)) mesh.SetBlendShapeWeight(NameToIndex[name], value * 100);
}
}
}