VertexAnimation/Runtime/Scripts/ModelBaker/VA_ModelBaker.cs
max abd6cc9e9e ModelBaker Test
MeshCombiner, combine SkinnedMeshRenderers and MeshRenderers into one.
AnimationBaker, bake SkinnedMeshRenderer with of animations into vertex animations.
Test shader, flipped Y compared to previvious version, it now starts at 0,0 and goes into the positive direciton.
2021-01-09 15:56:38 +01:00

37 lines
854 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace TAO.VertexAnimation
{
[CreateAssetMenu(fileName = "new ModelBaker", menuName = "VA_ModelBaker/ModelBaker", order = 400)]
public class VA_ModelBaker : ScriptableObject
{
public GameObject model;
public AnimationClip[] animationClips;
public int fps = 24;
public int textureWidth = 512;
public bool saveBakedDataToAsset = true;
public bool generateAnimationBook = false;
[SerializeField]
private AnimationBaker.BakedData bakedData;
public AnimationBaker.BakedData BakedData
{
get
{
return bakedData;
}
}
public void Bake()
{
var target = Instantiate(model);
target.ConbineAndConvertGameObject();
bakedData = target.Bake(animationClips, fps, textureWidth);
DestroyImmediate(target);
}
}
}