AnimationClip.generated.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  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. [NativeWrapper]
  54. public AnimationCurves Curves
  55. {
  56. get { return Internal_getCurves(mCachedPtr); }
  57. set { Internal_setCurves(mCachedPtr, value); }
  58. }
  59. /// <summary>A set of all events to be triggered as the animation is playing.</summary>
  60. [ShowInInspector]
  61. [NativeWrapper]
  62. public AnimationEvent[] Events
  63. {
  64. get { return Internal_getEvents(mCachedPtr); }
  65. set { Internal_setEvents(mCachedPtr, value); }
  66. }
  67. /// <summary>
  68. /// Returns a set of curves containing motion of the root bone. This allows the user to evaluate the root bone animation
  69. /// curves manually, instead of through the normal animation process. This property is only available if animation clip
  70. /// was imported with root motion import enabled.
  71. /// </summary>
  72. [ShowInInspector]
  73. [NativeWrapper]
  74. public RootMotion RootMotion
  75. {
  76. get { return Internal_getRootMotion(mCachedPtr); }
  77. }
  78. /// <summary>Checks if animation clip has root motion curves separate from the normal animation curves.</summary>
  79. [ShowInInspector]
  80. [NativeWrapper]
  81. public bool HasRootMotion
  82. {
  83. get { return Internal_hasRootMotion(mCachedPtr); }
  84. }
  85. /// <summary>
  86. /// Checks are the curves contained within the clip additive. Additive clips are intended to be added on top of other
  87. /// clips.
  88. /// </summary>
  89. [ShowInInspector]
  90. [NativeWrapper]
  91. public bool IsAddtive
  92. {
  93. get { return Internal_isAdditive(mCachedPtr); }
  94. }
  95. /// <summary>Returns the length of the animation clip, in seconds.</summary>
  96. [ShowInInspector]
  97. [NativeWrapper]
  98. public float Length
  99. {
  100. get { return Internal_getLength(mCachedPtr); }
  101. }
  102. /// <summary>
  103. /// Number of samples per second the animation clip curves were sampled at. This value is not used by the animation clip
  104. /// or curves directly since unevenly spaced keyframes are supported. But it can be of value when determining the
  105. /// original sample rate of an imported animation or similar.
  106. /// </summary>
  107. [ShowInInspector]
  108. [NativeWrapper]
  109. public uint SampleRate
  110. {
  111. get { return Internal_getSampleRate(mCachedPtr); }
  112. set { Internal_setSampleRate(mCachedPtr, value); }
  113. }
  114. /// <summary>Returns a reference wrapper for this resource.</summary>
  115. public static implicit operator RRef<AnimationClip>(AnimationClip x)
  116. { return Internal_GetRef(x.mCachedPtr); }
  117. [MethodImpl(MethodImplOptions.InternalCall)]
  118. private static extern RRef<AnimationClip> Internal_GetRef(IntPtr thisPtr);
  119. [MethodImpl(MethodImplOptions.InternalCall)]
  120. private static extern AnimationCurves Internal_getCurves(IntPtr thisPtr);
  121. [MethodImpl(MethodImplOptions.InternalCall)]
  122. private static extern void Internal_setCurves(IntPtr thisPtr, AnimationCurves curves);
  123. [MethodImpl(MethodImplOptions.InternalCall)]
  124. private static extern AnimationEvent[] Internal_getEvents(IntPtr thisPtr);
  125. [MethodImpl(MethodImplOptions.InternalCall)]
  126. private static extern void Internal_setEvents(IntPtr thisPtr, AnimationEvent[] events);
  127. [MethodImpl(MethodImplOptions.InternalCall)]
  128. private static extern RootMotion Internal_getRootMotion(IntPtr thisPtr);
  129. [MethodImpl(MethodImplOptions.InternalCall)]
  130. private static extern bool Internal_hasRootMotion(IntPtr thisPtr);
  131. [MethodImpl(MethodImplOptions.InternalCall)]
  132. private static extern bool Internal_isAdditive(IntPtr thisPtr);
  133. [MethodImpl(MethodImplOptions.InternalCall)]
  134. private static extern float Internal_getLength(IntPtr thisPtr);
  135. [MethodImpl(MethodImplOptions.InternalCall)]
  136. private static extern uint Internal_getSampleRate(IntPtr thisPtr);
  137. [MethodImpl(MethodImplOptions.InternalCall)]
  138. private static extern void Internal_setSampleRate(IntPtr thisPtr, uint sampleRate);
  139. [MethodImpl(MethodImplOptions.InternalCall)]
  140. private static extern void Internal_create(AnimationClip managedInstance, bool isAdditive);
  141. [MethodImpl(MethodImplOptions.InternalCall)]
  142. private static extern void Internal_create0(AnimationClip managedInstance, AnimationCurves curves, bool isAdditive, uint sampleRate, RootMotion rootMotion);
  143. }
  144. /** @} */
  145. }