CAnimation.generated.cs 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  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. /// Handles animation playback. Takes one or multiple animation clips as input and evaluates them every animation update
  11. /// tick depending on set properties. The evaluated data is used by the core thread for skeletal animation, by the sim
  12. /// thread for updating attached scene objects and bones (if skeleton is attached), or the data is made available for
  13. /// manual queries in the case of generic animation.
  14. /// </summary>
  15. public partial class Animation : Component
  16. {
  17. private Animation(bool __dummy0) { }
  18. protected Animation() { }
  19. /// <summary>
  20. /// Determines the default clip to play as soon as the component is enabled. If more control over playing clips is needed
  21. /// use the play(), blend() and crossFade() methods to queue clips for playback manually, and setState() method for
  22. /// modify their states individually.
  23. /// </summary>
  24. [ShowInInspector]
  25. public AnimationClip DefaultClip
  26. {
  27. get { return Internal_getDefaultClip(mCachedPtr); }
  28. set { Internal_setDefaultClip(mCachedPtr, value); }
  29. }
  30. /// <summary>
  31. /// Determines the wrap mode for all active animations. Wrap mode determines what happens when animation reaches the
  32. /// first or last frame.
  33. /// </summary>
  34. [ShowInInspector]
  35. public AnimWrapMode WrapMode
  36. {
  37. get { return Internal_getWrapMode(mCachedPtr); }
  38. set { Internal_setWrapMode(mCachedPtr, value); }
  39. }
  40. /// <summary>
  41. /// Determines the speed for all animations. The default value is 1.0f. Use negative values to play-back in reverse.
  42. /// </summary>
  43. [ShowInInspector]
  44. public float Speed
  45. {
  46. get { return Internal_getSpeed(mCachedPtr); }
  47. set { Internal_setSpeed(mCachedPtr, value); }
  48. }
  49. /// <summary>Checks if any animation clips are currently playing.</summary>
  50. [ShowInInspector]
  51. public bool IsPlaying
  52. {
  53. get { return Internal_isPlaying(mCachedPtr); }
  54. }
  55. /// <summary>
  56. /// Determines bounds that will be used for animation and mesh culling. Only relevant if setUseBounds() is set to true.
  57. /// </summary>
  58. [ShowInInspector]
  59. public AABox Bounds
  60. {
  61. get
  62. {
  63. AABox temp;
  64. Internal_getBounds(mCachedPtr, out temp);
  65. return temp;
  66. }
  67. set { Internal_setBounds(mCachedPtr, ref value); }
  68. }
  69. /// <summary>
  70. /// Determines should animation bounds be used for visibility determination (culling). If false the bounds of the mesh
  71. /// attached to the relevant CRenderable component will be used instead.
  72. /// </summary>
  73. [ShowInInspector]
  74. public bool UseBounds
  75. {
  76. get { return Internal_getUseBounds(mCachedPtr); }
  77. set { Internal_setUseBounds(mCachedPtr, value); }
  78. }
  79. /// <summary>
  80. /// Enables or disables culling of the animation when out of view. Culled animation will not be evaluated.
  81. /// </summary>
  82. [ShowInInspector]
  83. public bool Cull
  84. {
  85. get { return Internal_getEnableCull(mCachedPtr); }
  86. set { Internal_setEnableCull(mCachedPtr, value); }
  87. }
  88. /// <summary>
  89. /// Triggered when the list of properties animated via generic animation curves needs to be recreated (script only).
  90. /// </summary>
  91. partial void RebuildFloatProperties(AnimationClip p0);
  92. /// <summary>
  93. /// Triggered when generic animation curves values need be applied to the properties they effect (script only).
  94. /// </summary>
  95. partial void _UpdateFloatProperties();
  96. /// <summary>Triggers a callback in script code when animation event is triggered (script only).</summary>
  97. partial void EventTriggered(AnimationClip p0, string p1);
  98. /// <summary>Plays the specified animation clip.</summary>
  99. /// <param name="clip">Clip to play.</param>
  100. public void Play(AnimationClip clip)
  101. {
  102. Internal_play(mCachedPtr, clip);
  103. }
  104. /// <summary>
  105. /// Plays the specified animation clip on top of the animation currently playing in the main layer. Multiple such clips
  106. /// can be playing at once, as long as you ensure each is given its own layer. Each animation can also have a weight that
  107. /// determines how much it influences the main animation.
  108. /// </summary>
  109. /// <param name="clip">Clip to additively blend. Must contain additive animation curves.</param>
  110. /// <param name="weight">
  111. /// Determines how much of an effect will the blended animation have on the final output. In range [0, 1].
  112. /// </param>
  113. /// <param name="fadeLength">
  114. /// Applies the blend over a specified time period, increasing the weight as the time passes. Set to zero to blend
  115. /// immediately. In seconds.
  116. /// </param>
  117. /// <param name="layer">
  118. /// Layer to play the clip in. Multiple additive clips can be playing at once in separate layers and each layer has its
  119. /// own weight.
  120. /// </param>
  121. public void BlendAdditive(AnimationClip clip, float weight, float fadeLength = 0f, uint layer = 0)
  122. {
  123. Internal_blendAdditive(mCachedPtr, clip, weight, fadeLength, layer);
  124. }
  125. /// <summary>
  126. /// Blend multiple animation clips between each other using linear interpolation. Unlike normal animations these
  127. /// animations are not advanced with the progress of time, and is instead expected the user manually changes the
  128. /// <paramref name="t"/> parameter.
  129. /// </summary>
  130. /// <param name="info">
  131. /// Information about the clips to blend. Clip positions must be sorted from lowest to highest.
  132. /// </param>
  133. /// <param name="t">
  134. /// Parameter that controls the blending. Range depends on the positions of the provided animation clips.
  135. /// </param>
  136. public void Blend1D(Blend1DInfo info, float t)
  137. {
  138. Internal_blend1D(mCachedPtr, ref info, t);
  139. }
  140. /// <summary>
  141. /// Blend four animation clips between each other using bilinear interpolation. Unlike normal animations these animations
  142. /// are not advanced with the progress of time, and is instead expected the user manually changes the <paramref
  143. /// name="t"/> parameter.
  144. /// </summary>
  145. /// <param name="info">Information about the clips to blend.</param>
  146. /// <param name="t">
  147. /// Parameter that controls the blending, in range [(0, 0), (1, 1)]. t = (0, 0) means top left animation has full
  148. /// influence, t = (1, 0) means top right animation has full influence, t = (0, 1) means bottom left animation has full
  149. /// influence, t = (1, 1) means bottom right animation has full influence.
  150. /// </param>
  151. public void Blend2D(Blend2DInfo info, Vector2 t)
  152. {
  153. Internal_blend2D(mCachedPtr, ref info, ref t);
  154. }
  155. /// <summary>
  156. /// Fades the specified animation clip in, while fading other playing animation out, over the specified time period.
  157. /// </summary>
  158. /// <param name="clip">Clip to fade in.</param>
  159. /// <param name="fadeLength">Determines the time period over which the fade occurs. In seconds.</param>
  160. public void CrossFade(AnimationClip clip, float fadeLength)
  161. {
  162. Internal_crossFade(mCachedPtr, clip, fadeLength);
  163. }
  164. /// <summary>
  165. /// Samples an animation clip at the specified time, displaying only that particular frame without further playback.
  166. /// </summary>
  167. /// <param name="clip">Animation clip to sample.</param>
  168. /// <param name="time">Time to sample the clip at.</param>
  169. public void Sample(AnimationClip clip, float time)
  170. {
  171. Internal_sample(mCachedPtr, clip, time);
  172. }
  173. /// <summary>
  174. /// Stops playing all animations on the provided layer. Specify -1 to stop animation on the main layer (non-additive
  175. /// animations).
  176. /// </summary>
  177. public void Stop(uint layer)
  178. {
  179. Internal_stop(mCachedPtr, layer);
  180. }
  181. /// <summary>Stops playing all animations.</summary>
  182. public void StopAll()
  183. {
  184. Internal_stopAll(mCachedPtr);
  185. }
  186. /// <summary>Retrieves detailed information about a currently playing animation clip.</summary>
  187. /// <param name="clip">Clip to retrieve the information for.</param>
  188. /// <param name="state">
  189. /// Animation clip state containing the requested information. Only valid if the method returns true.
  190. /// </param>
  191. /// <returns>True if the state was found (animation clip is playing), false otherwise.</returns>
  192. public bool GetState(AnimationClip clip, out AnimationClipState state)
  193. {
  194. return Internal_getState(mCachedPtr, clip, out state);
  195. }
  196. /// <summary>
  197. /// Changes the state of a playing animation clip. If animation clip is not currently playing the playback is started for
  198. /// the clip.
  199. /// </summary>
  200. /// <param name="clip">Clip to change the state for.</param>
  201. /// <param name="state">New state of the animation (e.g. changing the time for seeking).</param>
  202. public void SetState(AnimationClip clip, AnimationClipState state)
  203. {
  204. Internal_setState(mCachedPtr, clip, ref state);
  205. }
  206. /// <summary>
  207. /// Changes a weight of a single morph channel, determining how much of it to apply on top of the base mesh.
  208. /// </summary>
  209. /// <param name="name">
  210. /// Name of the morph channel to modify. This depends on the mesh the animation is currently animating.
  211. /// </param>
  212. /// <param name="weight">Weight that determines how much of the channel to apply to the mesh, in range [0, 1].</param>
  213. public void SetMorphChannelWeight(string name, float weight)
  214. {
  215. Internal_setMorphChannelWeight(mCachedPtr, name, weight);
  216. }
  217. [MethodImpl(MethodImplOptions.InternalCall)]
  218. private static extern void Internal_setDefaultClip(IntPtr thisPtr, AnimationClip clip);
  219. [MethodImpl(MethodImplOptions.InternalCall)]
  220. private static extern AnimationClip Internal_getDefaultClip(IntPtr thisPtr);
  221. [MethodImpl(MethodImplOptions.InternalCall)]
  222. private static extern void Internal_setWrapMode(IntPtr thisPtr, AnimWrapMode wrapMode);
  223. [MethodImpl(MethodImplOptions.InternalCall)]
  224. private static extern AnimWrapMode Internal_getWrapMode(IntPtr thisPtr);
  225. [MethodImpl(MethodImplOptions.InternalCall)]
  226. private static extern void Internal_setSpeed(IntPtr thisPtr, float speed);
  227. [MethodImpl(MethodImplOptions.InternalCall)]
  228. private static extern float Internal_getSpeed(IntPtr thisPtr);
  229. [MethodImpl(MethodImplOptions.InternalCall)]
  230. private static extern void Internal_play(IntPtr thisPtr, AnimationClip clip);
  231. [MethodImpl(MethodImplOptions.InternalCall)]
  232. private static extern void Internal_blendAdditive(IntPtr thisPtr, AnimationClip clip, float weight, float fadeLength, uint layer);
  233. [MethodImpl(MethodImplOptions.InternalCall)]
  234. private static extern void Internal_blend1D(IntPtr thisPtr, ref Blend1DInfo info, float t);
  235. [MethodImpl(MethodImplOptions.InternalCall)]
  236. private static extern void Internal_blend2D(IntPtr thisPtr, ref Blend2DInfo info, ref Vector2 t);
  237. [MethodImpl(MethodImplOptions.InternalCall)]
  238. private static extern void Internal_crossFade(IntPtr thisPtr, AnimationClip clip, float fadeLength);
  239. [MethodImpl(MethodImplOptions.InternalCall)]
  240. private static extern void Internal_sample(IntPtr thisPtr, AnimationClip clip, float time);
  241. [MethodImpl(MethodImplOptions.InternalCall)]
  242. private static extern void Internal_stop(IntPtr thisPtr, uint layer);
  243. [MethodImpl(MethodImplOptions.InternalCall)]
  244. private static extern void Internal_stopAll(IntPtr thisPtr);
  245. [MethodImpl(MethodImplOptions.InternalCall)]
  246. private static extern bool Internal_isPlaying(IntPtr thisPtr);
  247. [MethodImpl(MethodImplOptions.InternalCall)]
  248. private static extern bool Internal_getState(IntPtr thisPtr, AnimationClip clip, out AnimationClipState state);
  249. [MethodImpl(MethodImplOptions.InternalCall)]
  250. private static extern void Internal_setState(IntPtr thisPtr, AnimationClip clip, ref AnimationClipState state);
  251. [MethodImpl(MethodImplOptions.InternalCall)]
  252. private static extern void Internal_setMorphChannelWeight(IntPtr thisPtr, string name, float weight);
  253. [MethodImpl(MethodImplOptions.InternalCall)]
  254. private static extern void Internal_setBounds(IntPtr thisPtr, ref AABox bounds);
  255. [MethodImpl(MethodImplOptions.InternalCall)]
  256. private static extern void Internal_getBounds(IntPtr thisPtr, out AABox __output);
  257. [MethodImpl(MethodImplOptions.InternalCall)]
  258. private static extern void Internal_setUseBounds(IntPtr thisPtr, bool enable);
  259. [MethodImpl(MethodImplOptions.InternalCall)]
  260. private static extern bool Internal_getUseBounds(IntPtr thisPtr);
  261. [MethodImpl(MethodImplOptions.InternalCall)]
  262. private static extern void Internal_setEnableCull(IntPtr thisPtr, bool enable);
  263. [MethodImpl(MethodImplOptions.InternalCall)]
  264. private static extern bool Internal_getEnableCull(IntPtr thisPtr);
  265. [MethodImpl(MethodImplOptions.InternalCall)]
  266. private static extern uint Internal_getNumClips(IntPtr thisPtr);
  267. [MethodImpl(MethodImplOptions.InternalCall)]
  268. private static extern AnimationClip Internal_getClip(IntPtr thisPtr, uint idx);
  269. [MethodImpl(MethodImplOptions.InternalCall)]
  270. private static extern void Internal__refreshClipMappings(IntPtr thisPtr);
  271. [MethodImpl(MethodImplOptions.InternalCall)]
  272. private static extern bool Internal__getGenericCurveValue(IntPtr thisPtr, uint curveIdx, out float value);
  273. [MethodImpl(MethodImplOptions.InternalCall)]
  274. private static extern bool Internal__togglePreviewMode(IntPtr thisPtr, bool enabled);
  275. private void Internal__scriptRebuildFloatProperties(AnimationClip p0)
  276. {
  277. RebuildFloatProperties(p0);
  278. }
  279. private void Internal__scriptUpdateFloatProperties()
  280. {
  281. _UpdateFloatProperties();
  282. }
  283. private void Internal__scriptOnEventTriggered(AnimationClip p0, string p1)
  284. {
  285. EventTriggered(p0, p1);
  286. }
  287. }
  288. /** @} */
  289. }