namespace Sandbox;
public partial class Model
{
///
/// Number of animations this model has.
///
public int AnimationCount => native.GetNumAnim();
///
/// Returns name of an animation at given animation index.
///
/// Animation index to get name of, starting at 0.
/// Name of the animation.
/// Thrown when given index exceeds range of [0,AnimationCount-1]
public string GetAnimationName( int animationIndex )
{
if ( animationIndex < 0 || animationIndex >= AnimationCount )
throw new ArgumentOutOfRangeException( "animationIndex", $"Tried to access out of range animation index {animationIndex}, range is 0-{AnimationCount - 1}" );
return native.GetAnimationName( animationIndex );
}
private List _animationNames;
public IReadOnlyList AnimationNames => _animationNames ??= Enumerable.Range( 0, AnimationCount )
.Select( GetAnimationName ).ToList();
///
/// Get the animgraph this model uses.
///
public AnimationGraph AnimGraph => AnimationGraph.FromNative( native.GetAnimationGraph() );
}