959e80cf72
assets upload description.
43 lines
1.3 KiB
C#
43 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using RPGCreationKit;
|
|
|
|
namespace RPGCreationKit
|
|
{
|
|
/// <summary>
|
|
/// Manages the child blendshapes of the Head, like eyes, mouth, etc. I.E. Moves Eye's blendshapes in the same position of the eye socket position of the Head Mesh.
|
|
/// </summary>
|
|
|
|
// public SkinnedMeshRenderer Hair;
|
|
|
|
[System.Serializable]
|
|
struct BlendshapeChildOfHead
|
|
{
|
|
public SkinnedMeshRenderer meshRenderer;
|
|
}
|
|
|
|
public class HeadBlendshapesManager : MonoBehaviour
|
|
{
|
|
[SerializeField] SkinnedMeshRenderer headMesh;
|
|
[SerializeField] public SkinnedMeshRenderer HairMesh;
|
|
[SerializeField] BlendshapeChildOfHead[] blendshapesChildOfHead;
|
|
|
|
public void AdjustChildBlendshapes()
|
|
{
|
|
for (int i = 0; i < blendshapesChildOfHead.Length; i++)
|
|
{
|
|
SetBlendShapes(blendshapesChildOfHead[i].meshRenderer);
|
|
}
|
|
SetBlendShapes(HairMesh);
|
|
}
|
|
|
|
public void SetBlendShapes(SkinnedMeshRenderer a)
|
|
{
|
|
for (int k = 0; k < a.sharedMesh.blendShapeCount; k++)
|
|
{
|
|
a.SetBlendShapeWeight(k, headMesh.GetBlendShapeWeight(k));
|
|
}
|
|
}
|
|
}
|
|
} |