AnimationController.cs 20 KB

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