CAnimation.generated.cs 13 KB

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