AnimationClip.generated.cs 5.9 KB

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