| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 |
- using System;
- using System.Runtime.CompilerServices;
- using System.Runtime.InteropServices;
- namespace BansheeEngine
- {
- /** @addtogroup Animation
- * @{
- */
- /// <summary>
- /// Contains animation curves for translation/rotation/scale of scene objects/skeleton bones, as well as curves for
- /// generic property animation.
- /// </summary>
- public partial class AnimationClip : Resource
- {
- private AnimationClip(bool __dummy0, bool __dummy1) { }
- protected AnimationClip() { }
- /// <summary>
- /// Creates an animation clip with no curves. After creation make sure to register some animation curves before using it.
- /// </summary>
- public AnimationClip(bool isAdditive = false)
- {
- Internal_create(this, isAdditive);
- }
- /// <summary>Creates an animation clip with specified curves.</summary>
- /// <param name="curves">Curves to initialize the animation with.</param>
- /// <param name="isAdditive">
- /// Determines does the clip contain additive curve data. This will change the behaviour how is the clip blended with
- /// other animations.
- /// </param>
- /// <param name="sampleRate">
- /// If animation uses evenly spaced keyframes, number of samples per second. Not relevant if keyframes are unevenly
- /// spaced.
- /// </param>
- /// <param name="rootMotion">
- /// Optional set of curves that can be used for animating the root bone. Not used by the animation system directly but is
- /// instead provided to the user for manual evaluation.
- /// </param>
- public AnimationClip(AnimationCurves curves, bool isAdditive = false, uint sampleRate = 1, RootMotion rootMotion = null)
- {
- Internal_create0(this, curves, isAdditive, sampleRate, rootMotion);
- }
- /// <summary>
- /// A set of all curves stored in the animation. Returned value will not be updated if the animation clip curves are
- /// added or removed, as it is a copy of clip's internal values.
- /// </summary>
- public AnimationCurves Curves
- {
- get { return Internal_getCurves(mCachedPtr); }
- set { Internal_setCurves(mCachedPtr, value); }
- }
- /// <summary>A set of all events to be triggered as the animation is playing.</summary>
- public AnimationEvent[] Events
- {
- get { return Internal_getEvents(mCachedPtr); }
- set { Internal_setEvents(mCachedPtr, value); }
- }
- /// <summary>
- /// Returns a set of curves containing motion of the root bone. This allows the user to evaluate the root bone animation
- /// curves manually, instead of through the normal animation process. This property is only available if animation clip
- /// was imported with root motion import enabled.
- /// </summary>
- public RootMotion RootMotion
- {
- get { return Internal_getRootMotion(mCachedPtr); }
- }
- /// <summary>Checks if animation clip has root motion curves separate from the normal animation curves.</summary>
- public bool HasRootMotion
- {
- get { return Internal_hasRootMotion(mCachedPtr); }
- }
- /// <summary>
- /// Checks are the curves contained within the clip additive. Additive clips are intended to be added on top of other
- /// clips.
- /// </summary>
- public bool IsAddtive
- {
- get { return Internal_isAdditive(mCachedPtr); }
- }
- /// <summary>Returns the length of the animation clip, in seconds.</summary>
- public float Length
- {
- get { return Internal_getLength(mCachedPtr); }
- }
- /// <summary>
- /// Number of samples per second the animation clip curves were sampled at. This value is not used by the animation clip
- /// or curves directly since unevenly spaced keyframes are supported. But it can be of value when determining the
- /// original sample rate of an imported animation or similar.
- /// </summary>
- public uint SampleRate
- {
- get { return Internal_getSampleRate(mCachedPtr); }
- set { Internal_setSampleRate(mCachedPtr, value); }
- }
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern AnimationCurves Internal_getCurves(IntPtr thisPtr);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_setCurves(IntPtr thisPtr, AnimationCurves curves);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern AnimationEvent[] Internal_getEvents(IntPtr thisPtr);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_setEvents(IntPtr thisPtr, AnimationEvent[] events);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern RootMotion Internal_getRootMotion(IntPtr thisPtr);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern bool Internal_hasRootMotion(IntPtr thisPtr);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern bool Internal_isAdditive(IntPtr thisPtr);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern float Internal_getLength(IntPtr thisPtr);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern uint Internal_getSampleRate(IntPtr thisPtr);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_setSampleRate(IntPtr thisPtr, uint sampleRate);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_create(AnimationClip managedInstance, bool isAdditive);
- [MethodImpl(MethodImplOptions.InternalCall)]
- private static extern void Internal_create0(AnimationClip managedInstance, AnimationCurves curves, bool isAdditive, uint sampleRate, RootMotion rootMotion);
- }
- /** @} */
- }
|