mirror of
https://github.com/maxartz15/VertexAnimation.git
synced 2024-09-19 20:55:41 +02:00
max
abd6cc9e9e
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.
37 lines
854 B
C#
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);
|
|
}
|
|
}
|
|
} |