AnimationController.cs 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // AnimationController.cs
  6. //
  7. // Copyright 2015 Xamarin Inc. All rights reserved.
  8. using System;
  9. using System.Runtime.InteropServices;
  10. using System.Collections.Generic;
  11. using Urho.Urho2D;
  12. using Urho.Gui;
  13. using Urho.Resources;
  14. using Urho.IO;
  15. using Urho.Navigation;
  16. using Urho.Network;
  17. namespace Urho
  18. {
  19. /// <summary>
  20. /// %Component that drives an AnimatedModel's animations.
  21. /// </summary>
  22. public unsafe partial class AnimationController : Component
  23. {
  24. unsafe partial void OnAnimationControllerCreated ();
  25. [Preserve]
  26. public AnimationController (IntPtr handle) : base (handle)
  27. {
  28. OnAnimationControllerCreated ();
  29. }
  30. [Preserve]
  31. protected AnimationController (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnAnimationControllerCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int AnimationController_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (AnimationController_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr AnimationController_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (AnimationController_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int AnimationController_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(AnimationController));
  54. return new StringHash (AnimationController_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr AnimationController_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(AnimationController));
  61. return Marshal.PtrToStringAnsi (AnimationController_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public AnimationController () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr AnimationController_AnimationController (IntPtr context);
  69. [Preserve]
  70. public AnimationController (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(AnimationController));
  73. handle = AnimationController_AnimationController ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnAnimationControllerCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void AnimationController_RegisterObject (IntPtr context);
  79. /// <summary>
  80. /// Register object factory.
  81. /// </summary>
  82. public new static void RegisterObject (Context context)
  83. {
  84. Runtime.Validate (typeof(AnimationController));
  85. AnimationController_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern void AnimationController_OnSetEnabled (IntPtr handle);
  89. /// <summary>
  90. /// Handle enabled/disabled state change.
  91. /// </summary>
  92. public override void OnSetEnabled ()
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. AnimationController_OnSetEnabled (handle);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern void AnimationController_Update (IntPtr handle, float timeStep);
  99. /// <summary>
  100. /// Update the animations. Is called from HandleScenePostUpdate().
  101. /// </summary>
  102. public void Update (float timeStep)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. AnimationController_Update (handle, timeStep);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern bool AnimationController_Play (IntPtr handle, string name, byte layer, bool looped, float fadeInTime);
  109. /// <summary>
  110. /// Play an animation and set full target weight. Name must be the full resource name. Return true on success.
  111. /// </summary>
  112. public bool Play (string name, byte layer, bool looped, float fadeInTime = 0f)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. return AnimationController_Play (handle, name, layer, looped, fadeInTime);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern bool AnimationController_PlayExclusive (IntPtr handle, string name, byte layer, bool looped, float fadeTime);
  119. /// <summary>
  120. /// Play an animation, set full target weight and fade out all other animations on the same layer. Name must be the full resource name. Return true on success.
  121. /// </summary>
  122. public bool PlayExclusive (string name, byte layer, bool looped, float fadeTime = 0f)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. return AnimationController_PlayExclusive (handle, name, layer, looped, fadeTime);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern bool AnimationController_Stop (IntPtr handle, string name, float fadeOutTime);
  129. /// <summary>
  130. /// Stop an animation. Zero fadetime is instant. Return true on success.
  131. /// </summary>
  132. public bool Stop (string name, float fadeOutTime = 0f)
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. return AnimationController_Stop (handle, name, fadeOutTime);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern void AnimationController_StopLayer (IntPtr handle, byte layer, float fadeOutTime);
  139. /// <summary>
  140. /// Stop all animations on a specific layer. Zero fadetime is instant.
  141. /// </summary>
  142. public void StopLayer (byte layer, float fadeOutTime = 0f)
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. AnimationController_StopLayer (handle, layer, fadeOutTime);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern void AnimationController_StopAll (IntPtr handle, float fadeTime);
  149. /// <summary>
  150. /// Stop all animations. Zero fadetime is instant.
  151. /// </summary>
  152. public void StopAll (float fadeTime = 0f)
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. AnimationController_StopAll (handle, fadeTime);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern bool AnimationController_Fade (IntPtr handle, string name, float targetWeight, float fadeTime);
  159. /// <summary>
  160. /// Fade animation to target weight. Return true on success.
  161. /// </summary>
  162. public bool Fade (string name, float targetWeight, float fadeTime)
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. return AnimationController_Fade (handle, name, targetWeight, fadeTime);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern bool AnimationController_FadeOthers (IntPtr handle, string name, float targetWeight, float fadeTime);
  169. /// <summary>
  170. /// Fade other animations on the same layer to target weight. Return true on success.
  171. /// </summary>
  172. public bool FadeOthers (string name, float targetWeight, float fadeTime)
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. return AnimationController_FadeOthers (handle, name, targetWeight, fadeTime);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern bool AnimationController_SetLayer (IntPtr handle, string name, byte layer);
  179. /// <summary>
  180. /// Set animation blending layer priority. Return true on success.
  181. /// </summary>
  182. public bool SetLayer (string name, byte layer)
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. return AnimationController_SetLayer (handle, name, layer);
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern bool AnimationController_SetStartBone (IntPtr handle, string name, string startBoneName);
  189. /// <summary>
  190. /// Set animation start bone. Return true on success.
  191. /// </summary>
  192. public bool SetStartBone (string name, string startBoneName)
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. return AnimationController_SetStartBone (handle, name, startBoneName);
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern bool AnimationController_SetTime (IntPtr handle, string name, float time);
  199. /// <summary>
  200. /// Set animation time position. Return true on success.
  201. /// </summary>
  202. public bool SetTime (string name, float time)
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. return AnimationController_SetTime (handle, name, time);
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern bool AnimationController_SetWeight (IntPtr handle, string name, float weight);
  209. /// <summary>
  210. /// Set animation weight. Return true on success.
  211. /// </summary>
  212. public bool SetWeight (string name, float weight)
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. return AnimationController_SetWeight (handle, name, weight);
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern bool AnimationController_SetLooped (IntPtr handle, string name, bool enable);
  219. /// <summary>
  220. /// Set animation looping. Return true on success.
  221. /// </summary>
  222. public bool SetLooped (string name, bool enable)
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. return AnimationController_SetLooped (handle, name, enable);
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern bool AnimationController_SetSpeed (IntPtr handle, string name, float speed);
  229. /// <summary>
  230. /// Set animation speed. Return true on success.
  231. /// </summary>
  232. public bool SetSpeed (string name, float speed)
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. return AnimationController_SetSpeed (handle, name, speed);
  236. }
  237. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  238. internal static extern bool AnimationController_SetAutoFade (IntPtr handle, string name, float fadeOutTime);
  239. /// <summary>
  240. /// Set animation autofade at end (non-looped animations only.) Zero time disables. Return true on success.
  241. /// </summary>
  242. public bool SetAutoFade (string name, float fadeOutTime)
  243. {
  244. Runtime.ValidateRefCounted (this);
  245. return AnimationController_SetAutoFade (handle, name, fadeOutTime);
  246. }
  247. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  248. internal static extern bool AnimationController_SetRemoveOnCompletion (IntPtr handle, string name, bool removeOnCompletion);
  249. /// <summary>
  250. /// Set whether an animation auto-removes on completion.
  251. /// </summary>
  252. public bool SetRemoveOnCompletion (string name, bool removeOnCompletion)
  253. {
  254. Runtime.ValidateRefCounted (this);
  255. return AnimationController_SetRemoveOnCompletion (handle, name, removeOnCompletion);
  256. }
  257. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  258. internal static extern bool AnimationController_SetBlendMode (IntPtr handle, string name, AnimationBlendMode mode);
  259. /// <summary>
  260. /// Set animation blending mode. Return true on success.
  261. /// </summary>
  262. public bool SetBlendMode (string name, AnimationBlendMode mode)
  263. {
  264. Runtime.ValidateRefCounted (this);
  265. return AnimationController_SetBlendMode (handle, name, mode);
  266. }
  267. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  268. internal static extern bool AnimationController_IsPlaying (IntPtr handle, string name);
  269. /// <summary>
  270. /// Return whether an animation is active. Note that non-looping animations that are being clamped at the end also return true.
  271. /// </summary>
  272. public bool IsPlaying (string name)
  273. {
  274. Runtime.ValidateRefCounted (this);
  275. return AnimationController_IsPlaying (handle, name);
  276. }
  277. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  278. internal static extern bool AnimationController_IsPlaying0 (IntPtr handle, byte layer);
  279. /// <summary>
  280. /// Return whether any animation is active on a specific layer.
  281. /// </summary>
  282. public bool IsPlaying (byte layer)
  283. {
  284. Runtime.ValidateRefCounted (this);
  285. return AnimationController_IsPlaying0 (handle, layer);
  286. }
  287. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  288. internal static extern bool AnimationController_IsFadingIn (IntPtr handle, string name);
  289. /// <summary>
  290. /// Return whether an animation is fading in.
  291. /// </summary>
  292. public bool IsFadingIn (string name)
  293. {
  294. Runtime.ValidateRefCounted (this);
  295. return AnimationController_IsFadingIn (handle, name);
  296. }
  297. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  298. internal static extern bool AnimationController_IsFadingOut (IntPtr handle, string name);
  299. /// <summary>
  300. /// Return whether an animation is fading out.
  301. /// </summary>
  302. public bool IsFadingOut (string name)
  303. {
  304. Runtime.ValidateRefCounted (this);
  305. return AnimationController_IsFadingOut (handle, name);
  306. }
  307. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  308. internal static extern bool AnimationController_IsAtEnd (IntPtr handle, string name);
  309. /// <summary>
  310. /// Return whether an animation is at its end. Will return false if the animation is not active at all.
  311. /// </summary>
  312. public bool IsAtEnd (string name)
  313. {
  314. Runtime.ValidateRefCounted (this);
  315. return AnimationController_IsAtEnd (handle, name);
  316. }
  317. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  318. internal static extern byte AnimationController_GetLayer (IntPtr handle, string name);
  319. /// <summary>
  320. /// Return animation blending layer.
  321. /// </summary>
  322. public byte GetLayer (string name)
  323. {
  324. Runtime.ValidateRefCounted (this);
  325. return AnimationController_GetLayer (handle, name);
  326. }
  327. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  328. internal static extern Bone* AnimationController_GetStartBone (IntPtr handle, string name);
  329. /// <summary>
  330. /// Return animation start bone, or null if no such animation.
  331. /// </summary>
  332. public Bone* GetStartBone (string name)
  333. {
  334. Runtime.ValidateRefCounted (this);
  335. return AnimationController_GetStartBone (handle, name);
  336. }
  337. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  338. internal static extern IntPtr AnimationController_GetStartBoneName (IntPtr handle, string name);
  339. /// <summary>
  340. /// Return animation start bone name, or empty string if no such animation.
  341. /// </summary>
  342. public string GetStartBoneName (string name)
  343. {
  344. Runtime.ValidateRefCounted (this);
  345. return Marshal.PtrToStringAnsi (AnimationController_GetStartBoneName (handle, name));
  346. }
  347. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  348. internal static extern float AnimationController_GetTime (IntPtr handle, string name);
  349. /// <summary>
  350. /// Return animation time position.
  351. /// </summary>
  352. public float GetTime (string name)
  353. {
  354. Runtime.ValidateRefCounted (this);
  355. return AnimationController_GetTime (handle, name);
  356. }
  357. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  358. internal static extern float AnimationController_GetWeight (IntPtr handle, string name);
  359. /// <summary>
  360. /// Return animation weight.
  361. /// </summary>
  362. public float GetWeight (string name)
  363. {
  364. Runtime.ValidateRefCounted (this);
  365. return AnimationController_GetWeight (handle, name);
  366. }
  367. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  368. internal static extern bool AnimationController_IsLooped (IntPtr handle, string name);
  369. /// <summary>
  370. /// Return animation looping.
  371. /// </summary>
  372. public bool IsLooped (string name)
  373. {
  374. Runtime.ValidateRefCounted (this);
  375. return AnimationController_IsLooped (handle, name);
  376. }
  377. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  378. internal static extern AnimationBlendMode AnimationController_GetBlendMode (IntPtr handle, string name);
  379. /// <summary>
  380. /// Return animation blending mode.
  381. /// </summary>
  382. public AnimationBlendMode GetBlendMode (string name)
  383. {
  384. Runtime.ValidateRefCounted (this);
  385. return AnimationController_GetBlendMode (handle, name);
  386. }
  387. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  388. internal static extern float AnimationController_GetLength (IntPtr handle, string name);
  389. /// <summary>
  390. /// Return animation length.
  391. /// </summary>
  392. public float GetLength (string name)
  393. {
  394. Runtime.ValidateRefCounted (this);
  395. return AnimationController_GetLength (handle, name);
  396. }
  397. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  398. internal static extern float AnimationController_GetSpeed (IntPtr handle, string name);
  399. /// <summary>
  400. /// Return animation speed.
  401. /// </summary>
  402. public float GetSpeed (string name)
  403. {
  404. Runtime.ValidateRefCounted (this);
  405. return AnimationController_GetSpeed (handle, name);
  406. }
  407. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  408. internal static extern float AnimationController_GetFadeTarget (IntPtr handle, string name);
  409. /// <summary>
  410. /// Return animation fade target weight.
  411. /// </summary>
  412. public float GetFadeTarget (string name)
  413. {
  414. Runtime.ValidateRefCounted (this);
  415. return AnimationController_GetFadeTarget (handle, name);
  416. }
  417. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  418. internal static extern float AnimationController_GetFadeTime (IntPtr handle, string name);
  419. /// <summary>
  420. /// Return animation fade time.
  421. /// </summary>
  422. public float GetFadeTime (string name)
  423. {
  424. Runtime.ValidateRefCounted (this);
  425. return AnimationController_GetFadeTime (handle, name);
  426. }
  427. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  428. internal static extern float AnimationController_GetAutoFade (IntPtr handle, string name);
  429. /// <summary>
  430. /// Return animation autofade time.
  431. /// </summary>
  432. public float GetAutoFade (string name)
  433. {
  434. Runtime.ValidateRefCounted (this);
  435. return AnimationController_GetAutoFade (handle, name);
  436. }
  437. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  438. internal static extern bool AnimationController_GetRemoveOnCompletion (IntPtr handle, string name);
  439. /// <summary>
  440. /// Return whether animation auto-removes on completion, or false if no such animation.
  441. /// </summary>
  442. public bool GetRemoveOnCompletion (string name)
  443. {
  444. Runtime.ValidateRefCounted (this);
  445. return AnimationController_GetRemoveOnCompletion (handle, name);
  446. }
  447. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  448. internal static extern IntPtr AnimationController_GetAnimationState (IntPtr handle, string name);
  449. /// <summary>
  450. /// Find an animation state by animation name.
  451. /// </summary>
  452. public AnimationState GetAnimationState (string name)
  453. {
  454. Runtime.ValidateRefCounted (this);
  455. return Runtime.LookupRefCounted<AnimationState> (AnimationController_GetAnimationState (handle, name));
  456. }
  457. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  458. internal static extern IntPtr AnimationController_GetAnimationState1 (IntPtr handle, int nameHash);
  459. /// <summary>
  460. /// Find an animation state by animation name hash.
  461. /// </summary>
  462. public AnimationState GetAnimationState (StringHash nameHash)
  463. {
  464. Runtime.ValidateRefCounted (this);
  465. return Runtime.LookupRefCounted<AnimationState> (AnimationController_GetAnimationState1 (handle, nameHash.Code));
  466. }
  467. public override StringHash Type {
  468. get {
  469. return UrhoGetType ();
  470. }
  471. }
  472. public override string TypeName {
  473. get {
  474. return GetTypeName ();
  475. }
  476. }
  477. [Preserve]
  478. public new static StringHash TypeStatic {
  479. get {
  480. return GetTypeStatic ();
  481. }
  482. }
  483. public new static string TypeNameStatic {
  484. get {
  485. return GetTypeNameStatic ();
  486. }
  487. }
  488. }
  489. }