AnimationClip.generated.cs 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. using System;
  2. using System.Runtime.CompilerServices;
  3. using System.Runtime.InteropServices;
  4. namespace BansheeEngine
  5. {
  6. /** @addtogroup Animation
  7. * @{
  8. */
  9. /// <summary>
  10. /// Contains animation curves for translation/rotation/scale of scene objects/skeleton bones, as well as curves for
  11. /// generic property animation.
  12. /// </summary>
  13. public partial class AnimationClip : Resource
  14. {
  15. private AnimationClip(bool __dummy0, bool __dummy1) { }
  16. protected AnimationClip() { }
  17. /// <summary>
  18. /// Creates an animation clip with no curves. After creation make sure to register some animation curves before using it.
  19. /// </summary>
  20. public AnimationClip(bool isAdditive = false)
  21. {
  22. Internal_create(this, isAdditive);
  23. }
  24. /// <summary>Creates an animation clip with specified curves.</summary>
  25. /// <param name="curves">Curves to initialize the animation with.</param>
  26. /// <param name="isAdditive">
  27. /// Determines does the clip contain additive curve data. This will change the behaviour how is the clip blended with
  28. /// other animations.
  29. /// </param>
  30. /// <param name="sampleRate">
  31. /// If animation uses evenly spaced keyframes, number of samples per second. Not relevant if keyframes are unevenly
  32. /// spaced.
  33. /// </param>
  34. /// <param name="rootMotion">
  35. /// Optional set of curves that can be used for animating the root bone. Not used by the animation system directly but is
  36. /// instead provided to the user for manual evaluation.
  37. /// </param>
  38. public AnimationClip(AnimationCurves curves, bool isAdditive = false, uint sampleRate = 1, RootMotion rootMotion = null)
  39. {
  40. Internal_create0(this, curves, isAdditive, sampleRate, rootMotion);
  41. }
  42. /// <summary>
  43. /// A set of all curves stored in the animation. Returned value will not be updated if the animation clip curves are
  44. /// added or removed, as it is a copy of clip's internal values.
  45. /// </summary>
  46. public AnimationCurves Curves
  47. {
  48. get { return Internal_getCurves(mCachedPtr); }
  49. set { Internal_setCurves(mCachedPtr, value); }
  50. }
  51. /// <summary>A set of all events to be triggered as the animation is playing.</summary>
  52. public AnimationEvent[] Events
  53. {
  54. get { return Internal_getEvents(mCachedPtr); }
  55. set { Internal_setEvents(mCachedPtr, value); }
  56. }
  57. /// <summary>
  58. /// Returns a set of curves containing motion of the root bone. This allows the user to evaluate the root bone animation
  59. /// curves manually, instead of through the normal animation process. This property is only available if animation clip
  60. /// was imported with root motion import enabled.
  61. /// </summary>
  62. public RootMotion RootMotion
  63. {
  64. get { return Internal_getRootMotion(mCachedPtr); }
  65. }
  66. /// <summary>Checks if animation clip has root motion curves separate from the normal animation curves.</summary>
  67. public bool HasRootMotion
  68. {
  69. get { return Internal_hasRootMotion(mCachedPtr); }
  70. }
  71. /// <summary>
  72. /// Checks are the curves contained within the clip additive. Additive clips are intended to be added on top of other
  73. /// clips.
  74. /// </summary>
  75. public bool IsAddtive
  76. {
  77. get { return Internal_isAdditive(mCachedPtr); }
  78. }
  79. /// <summary>Returns the length of the animation clip, in seconds.</summary>
  80. public float Length
  81. {
  82. get { return Internal_getLength(mCachedPtr); }
  83. }
  84. /// <summary>
  85. /// Number of samples per second the animation clip curves were sampled at. This value is not used by the animation clip
  86. /// or curves directly since unevenly spaced keyframes are supported. But it can be of value when determining the
  87. /// original sample rate of an imported animation or similar.
  88. /// </summary>
  89. public uint SampleRate
  90. {
  91. get { return Internal_getSampleRate(mCachedPtr); }
  92. set { Internal_setSampleRate(mCachedPtr, value); }
  93. }
  94. [MethodImpl(MethodImplOptions.InternalCall)]
  95. private static extern AnimationCurves Internal_getCurves(IntPtr thisPtr);
  96. [MethodImpl(MethodImplOptions.InternalCall)]
  97. private static extern void Internal_setCurves(IntPtr thisPtr, AnimationCurves curves);
  98. [MethodImpl(MethodImplOptions.InternalCall)]
  99. private static extern AnimationEvent[] Internal_getEvents(IntPtr thisPtr);
  100. [MethodImpl(MethodImplOptions.InternalCall)]
  101. private static extern void Internal_setEvents(IntPtr thisPtr, AnimationEvent[] events);
  102. [MethodImpl(MethodImplOptions.InternalCall)]
  103. private static extern RootMotion Internal_getRootMotion(IntPtr thisPtr);
  104. [MethodImpl(MethodImplOptions.InternalCall)]
  105. private static extern bool Internal_hasRootMotion(IntPtr thisPtr);
  106. [MethodImpl(MethodImplOptions.InternalCall)]
  107. private static extern bool Internal_isAdditive(IntPtr thisPtr);
  108. [MethodImpl(MethodImplOptions.InternalCall)]
  109. private static extern float Internal_getLength(IntPtr thisPtr);
  110. [MethodImpl(MethodImplOptions.InternalCall)]
  111. private static extern uint Internal_getSampleRate(IntPtr thisPtr);
  112. [MethodImpl(MethodImplOptions.InternalCall)]
  113. private static extern void Internal_setSampleRate(IntPtr thisPtr, uint sampleRate);
  114. [MethodImpl(MethodImplOptions.InternalCall)]
  115. private static extern void Internal_create(AnimationClip managedInstance, bool isAdditive);
  116. [MethodImpl(MethodImplOptions.InternalCall)]
  117. private static extern void Internal_create0(AnimationClip managedInstance, AnimationCurves curves, bool isAdditive, uint sampleRate, RootMotion rootMotion);
  118. }
  119. /** @} */
  120. }