VertexAnimation/Runtime/Scripts/VA_AnimationLibrary.cs
max ea1d2412b1 AnimationLibrary
AnimationLibraryBook editor setup.
AnimationLibrary AnimationData generation and material setup.
AnimationBook added support for non animation textures as well. This allows the user for example, to link Albedo maps with animations.
MaterialData is now in one component.
Note: Only 1/3th of the performance when having 4 swapping texture maps/arrays.
2020-12-14 20:27:44 +01:00

43 lines
847 B
C#

using System.Collections.Generic;
using UnityEngine;
namespace TAO.VertexAnimation
{
[CreateAssetMenu(fileName = "new AnimationLibrary", menuName = "AnimationLibrary", order = 0)]
public class VA_AnimationLibrary : ScriptableObject
{
[SerializeField]
private VA_AnimationBook[] animationBooks;
[HideInInspector]
public List<VA_AnimationData> animations = null;
public void Create()
{
foreach (VA_AnimationBook book in animationBooks)
{
book.Create();
}
ConvertAnimations();
}
private void OnValidate()
{
// TODO: Check for naming conflicts in AnimationBooks.
}
private void ConvertAnimations()
{
animations = new List<VA_AnimationData>();
if (animationBooks != null)
{
foreach (var ab in animationBooks)
{
animations.AddRange(ab.GetAnimationData());
}
}
}
}
}