Animation.cs 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // Animation.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. /// Skeletal animation resource.
  21. /// </summary>
  22. public unsafe partial class Animation : ResourceWithMetadata
  23. {
  24. unsafe partial void OnAnimationCreated ();
  25. [Preserve]
  26. public Animation (IntPtr handle) : base (handle)
  27. {
  28. OnAnimationCreated ();
  29. }
  30. [Preserve]
  31. protected Animation (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  32. {
  33. OnAnimationCreated ();
  34. }
  35. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  36. internal static extern int Animation_GetType (IntPtr handle);
  37. private StringHash UrhoGetType ()
  38. {
  39. Runtime.ValidateRefCounted (this);
  40. return new StringHash (Animation_GetType (handle));
  41. }
  42. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  43. internal static extern IntPtr Animation_GetTypeName (IntPtr handle);
  44. private string GetTypeName ()
  45. {
  46. Runtime.ValidateRefCounted (this);
  47. return Marshal.PtrToStringAnsi (Animation_GetTypeName (handle));
  48. }
  49. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  50. internal static extern int Animation_GetTypeStatic ();
  51. private static StringHash GetTypeStatic ()
  52. {
  53. Runtime.Validate (typeof(Animation));
  54. return new StringHash (Animation_GetTypeStatic ());
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern IntPtr Animation_GetTypeNameStatic ();
  58. private static string GetTypeNameStatic ()
  59. {
  60. Runtime.Validate (typeof(Animation));
  61. return Marshal.PtrToStringAnsi (Animation_GetTypeNameStatic ());
  62. }
  63. [Preserve]
  64. public Animation () : this (Application.CurrentContext)
  65. {
  66. }
  67. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  68. internal static extern IntPtr Animation_Animation (IntPtr context);
  69. [Preserve]
  70. public Animation (Context context) : base (UrhoObjectFlag.Empty)
  71. {
  72. Runtime.Validate (typeof(Animation));
  73. handle = Animation_Animation ((object)context == null ? IntPtr.Zero : context.Handle);
  74. Runtime.RegisterObject (this);
  75. OnAnimationCreated ();
  76. }
  77. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  78. internal static extern void Animation_RegisterObject (IntPtr context);
  79. /// <summary>
  80. /// Register object factory.
  81. /// </summary>
  82. public static void RegisterObject (Context context)
  83. {
  84. Runtime.Validate (typeof(Animation));
  85. Animation_RegisterObject ((object)context == null ? IntPtr.Zero : context.Handle);
  86. }
  87. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  88. internal static extern bool Animation_BeginLoad_File (IntPtr handle, IntPtr source);
  89. /// <summary>
  90. /// Load resource from stream. May be called from a worker thread. Return true if successful.
  91. /// </summary>
  92. public override bool BeginLoad (File source)
  93. {
  94. Runtime.ValidateRefCounted (this);
  95. return Animation_BeginLoad_File (handle, (object)source == null ? IntPtr.Zero : source.Handle);
  96. }
  97. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  98. internal static extern bool Animation_BeginLoad_MemoryBuffer (IntPtr handle, IntPtr source);
  99. /// <summary>
  100. /// Load resource from stream. May be called from a worker thread. Return true if successful.
  101. /// </summary>
  102. public override bool BeginLoad (MemoryBuffer source)
  103. {
  104. Runtime.ValidateRefCounted (this);
  105. return Animation_BeginLoad_MemoryBuffer (handle, (object)source == null ? IntPtr.Zero : source.Handle);
  106. }
  107. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  108. internal static extern bool Animation_Save_File (IntPtr handle, IntPtr dest);
  109. /// <summary>
  110. /// Save resource. Return true if successful.
  111. /// </summary>
  112. public override bool Save (File dest)
  113. {
  114. Runtime.ValidateRefCounted (this);
  115. return Animation_Save_File (handle, (object)dest == null ? IntPtr.Zero : dest.Handle);
  116. }
  117. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  118. internal static extern bool Animation_Save_MemoryBuffer (IntPtr handle, IntPtr dest);
  119. /// <summary>
  120. /// Save resource. Return true if successful.
  121. /// </summary>
  122. public override bool Save (MemoryBuffer dest)
  123. {
  124. Runtime.ValidateRefCounted (this);
  125. return Animation_Save_MemoryBuffer (handle, (object)dest == null ? IntPtr.Zero : dest.Handle);
  126. }
  127. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  128. internal static extern void Animation_SetAnimationName (IntPtr handle, string name);
  129. /// <summary>
  130. /// Set animation name.
  131. /// </summary>
  132. private void SetAnimationName (string name)
  133. {
  134. Runtime.ValidateRefCounted (this);
  135. Animation_SetAnimationName (handle, name);
  136. }
  137. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  138. internal static extern void Animation_SetLength (IntPtr handle, float length);
  139. /// <summary>
  140. /// Set animation length.
  141. /// </summary>
  142. private void SetLength (float length)
  143. {
  144. Runtime.ValidateRefCounted (this);
  145. Animation_SetLength (handle, length);
  146. }
  147. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  148. internal static extern AnimationTrack* Animation_CreateTrack (IntPtr handle, string name);
  149. /// <summary>
  150. /// Create and return a track by name. If track by same name already exists, returns the existing.
  151. /// </summary>
  152. public AnimationTrack* CreateTrack (string name)
  153. {
  154. Runtime.ValidateRefCounted (this);
  155. return Animation_CreateTrack (handle, name);
  156. }
  157. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  158. internal static extern bool Animation_RemoveTrack (IntPtr handle, string name);
  159. /// <summary>
  160. /// Remove a track by name. Return true if was found and removed successfully. This is unsafe if the animation is currently used in playback.
  161. /// </summary>
  162. public bool RemoveTrack (string name)
  163. {
  164. Runtime.ValidateRefCounted (this);
  165. return Animation_RemoveTrack (handle, name);
  166. }
  167. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  168. internal static extern void Animation_RemoveAllTracks (IntPtr handle);
  169. /// <summary>
  170. /// Remove all tracks. This is unsafe if the animation is currently used in playback.
  171. /// </summary>
  172. public void RemoveAllTracks ()
  173. {
  174. Runtime.ValidateRefCounted (this);
  175. Animation_RemoveAllTracks (handle);
  176. }
  177. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  178. internal static extern void Animation_AddTrigger_0 (IntPtr handle, float time, bool timeIsNormalized, ref Vector3 data);
  179. /// <summary>
  180. /// Add a trigger point.
  181. /// </summary>
  182. public void AddTrigger (float time, bool timeIsNormalized, Vector3 data)
  183. {
  184. Runtime.ValidateRefCounted (this);
  185. Animation_AddTrigger_0 (handle, time, timeIsNormalized, ref data);
  186. }
  187. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  188. internal static extern void Animation_AddTrigger_1 (IntPtr handle, float time, bool timeIsNormalized, ref IntRect data);
  189. /// <summary>
  190. /// Add a trigger point.
  191. /// </summary>
  192. public void AddTrigger (float time, bool timeIsNormalized, IntRect data)
  193. {
  194. Runtime.ValidateRefCounted (this);
  195. Animation_AddTrigger_1 (handle, time, timeIsNormalized, ref data);
  196. }
  197. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  198. internal static extern void Animation_AddTrigger_2 (IntPtr handle, float time, bool timeIsNormalized, ref Color data);
  199. /// <summary>
  200. /// Add a trigger point.
  201. /// </summary>
  202. public void AddTrigger (float time, bool timeIsNormalized, Color data)
  203. {
  204. Runtime.ValidateRefCounted (this);
  205. Animation_AddTrigger_2 (handle, time, timeIsNormalized, ref data);
  206. }
  207. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  208. internal static extern void Animation_AddTrigger_3 (IntPtr handle, float time, bool timeIsNormalized, ref Vector2 data);
  209. /// <summary>
  210. /// Add a trigger point.
  211. /// </summary>
  212. public void AddTrigger (float time, bool timeIsNormalized, Vector2 data)
  213. {
  214. Runtime.ValidateRefCounted (this);
  215. Animation_AddTrigger_3 (handle, time, timeIsNormalized, ref data);
  216. }
  217. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  218. internal static extern void Animation_AddTrigger_4 (IntPtr handle, float time, bool timeIsNormalized, ref Vector4 data);
  219. /// <summary>
  220. /// Add a trigger point.
  221. /// </summary>
  222. public void AddTrigger (float time, bool timeIsNormalized, Vector4 data)
  223. {
  224. Runtime.ValidateRefCounted (this);
  225. Animation_AddTrigger_4 (handle, time, timeIsNormalized, ref data);
  226. }
  227. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  228. internal static extern void Animation_AddTrigger_5 (IntPtr handle, float time, bool timeIsNormalized, ref IntVector2 data);
  229. /// <summary>
  230. /// Add a trigger point.
  231. /// </summary>
  232. public void AddTrigger (float time, bool timeIsNormalized, IntVector2 data)
  233. {
  234. Runtime.ValidateRefCounted (this);
  235. Animation_AddTrigger_5 (handle, time, timeIsNormalized, ref data);
  236. }
  237. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  238. internal static extern void Animation_AddTrigger_6 (IntPtr handle, float time, bool timeIsNormalized, ref Quaternion data);
  239. /// <summary>
  240. /// Add a trigger point.
  241. /// </summary>
  242. public void AddTrigger (float time, bool timeIsNormalized, Quaternion data)
  243. {
  244. Runtime.ValidateRefCounted (this);
  245. Animation_AddTrigger_6 (handle, time, timeIsNormalized, ref data);
  246. }
  247. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  248. internal static extern void Animation_AddTrigger_7 (IntPtr handle, float time, bool timeIsNormalized, ref Matrix4 data);
  249. /// <summary>
  250. /// Add a trigger point.
  251. /// </summary>
  252. public void AddTrigger (float time, bool timeIsNormalized, Matrix4 data)
  253. {
  254. Runtime.ValidateRefCounted (this);
  255. Animation_AddTrigger_7 (handle, time, timeIsNormalized, ref data);
  256. }
  257. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  258. internal static extern void Animation_AddTrigger_8 (IntPtr handle, float time, bool timeIsNormalized, ref Matrix3x4 data);
  259. /// <summary>
  260. /// Add a trigger point.
  261. /// </summary>
  262. public void AddTrigger (float time, bool timeIsNormalized, Matrix3x4 data)
  263. {
  264. Runtime.ValidateRefCounted (this);
  265. Animation_AddTrigger_8 (handle, time, timeIsNormalized, ref data);
  266. }
  267. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  268. internal static extern void Animation_AddTrigger_9 (IntPtr handle, float time, bool timeIsNormalized, int data);
  269. /// <summary>
  270. /// Add a trigger point.
  271. /// </summary>
  272. public void AddTrigger (float time, bool timeIsNormalized, int data)
  273. {
  274. Runtime.ValidateRefCounted (this);
  275. Animation_AddTrigger_9 (handle, time, timeIsNormalized, data);
  276. }
  277. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  278. internal static extern void Animation_AddTrigger_10 (IntPtr handle, float time, bool timeIsNormalized, float data);
  279. /// <summary>
  280. /// Add a trigger point.
  281. /// </summary>
  282. public void AddTrigger (float time, bool timeIsNormalized, float data)
  283. {
  284. Runtime.ValidateRefCounted (this);
  285. Animation_AddTrigger_10 (handle, time, timeIsNormalized, data);
  286. }
  287. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  288. internal static extern void Animation_AddTrigger_11 (IntPtr handle, float time, bool timeIsNormalized, string data);
  289. /// <summary>
  290. /// Add a trigger point.
  291. /// </summary>
  292. public void AddTrigger (float time, bool timeIsNormalized, string data)
  293. {
  294. Runtime.ValidateRefCounted (this);
  295. Animation_AddTrigger_11 (handle, time, timeIsNormalized, data);
  296. }
  297. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  298. internal static extern void Animation_AddTrigger_12 (IntPtr handle, float time, bool timeIsNormalized, bool data);
  299. /// <summary>
  300. /// Add a trigger point.
  301. /// </summary>
  302. public void AddTrigger (float time, bool timeIsNormalized, bool data)
  303. {
  304. Runtime.ValidateRefCounted (this);
  305. Animation_AddTrigger_12 (handle, time, timeIsNormalized, data);
  306. }
  307. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  308. internal static extern void Animation_RemoveTrigger (IntPtr handle, uint index);
  309. /// <summary>
  310. /// Remove a trigger point by index.
  311. /// </summary>
  312. public void RemoveTrigger (uint index)
  313. {
  314. Runtime.ValidateRefCounted (this);
  315. Animation_RemoveTrigger (handle, index);
  316. }
  317. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  318. internal static extern void Animation_RemoveAllTriggers (IntPtr handle);
  319. /// <summary>
  320. /// Remove all trigger points.
  321. /// </summary>
  322. public void RemoveAllTriggers ()
  323. {
  324. Runtime.ValidateRefCounted (this);
  325. Animation_RemoveAllTriggers (handle);
  326. }
  327. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  328. internal static extern void Animation_SetNumTriggers (IntPtr handle, uint num);
  329. /// <summary>
  330. /// Resize trigger point vector.
  331. /// </summary>
  332. private void SetNumTriggers (uint num)
  333. {
  334. Runtime.ValidateRefCounted (this);
  335. Animation_SetNumTriggers (handle, num);
  336. }
  337. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  338. internal static extern IntPtr Animation_Clone (IntPtr handle, string cloneName);
  339. /// <summary>
  340. /// Clone the animation.
  341. /// </summary>
  342. public Animation Clone (string cloneName = "")
  343. {
  344. Runtime.ValidateRefCounted (this);
  345. return Runtime.LookupRefCounted<Animation> (Animation_Clone (handle, cloneName));
  346. }
  347. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  348. internal static extern IntPtr Animation_GetAnimationName (IntPtr handle);
  349. /// <summary>
  350. /// Return animation name.
  351. /// </summary>
  352. private string GetAnimationName ()
  353. {
  354. Runtime.ValidateRefCounted (this);
  355. return Marshal.PtrToStringAnsi (Animation_GetAnimationName (handle));
  356. }
  357. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  358. internal static extern int Animation_GetAnimationNameHash (IntPtr handle);
  359. /// <summary>
  360. /// Return animation name hash.
  361. /// </summary>
  362. private StringHash GetAnimationNameHash ()
  363. {
  364. Runtime.ValidateRefCounted (this);
  365. return new StringHash (Animation_GetAnimationNameHash (handle));
  366. }
  367. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  368. internal static extern float Animation_GetLength (IntPtr handle);
  369. /// <summary>
  370. /// Return animation length.
  371. /// </summary>
  372. private float GetLength ()
  373. {
  374. Runtime.ValidateRefCounted (this);
  375. return Animation_GetLength (handle);
  376. }
  377. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  378. internal static extern uint Animation_GetNumTracks (IntPtr handle);
  379. /// <summary>
  380. /// Return number of animation tracks.
  381. /// </summary>
  382. private uint GetNumTracks ()
  383. {
  384. Runtime.ValidateRefCounted (this);
  385. return Animation_GetNumTracks (handle);
  386. }
  387. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  388. internal static extern AnimationTrack* Animation_GetTrack (IntPtr handle, uint index);
  389. /// <summary>
  390. /// Return animation track by index.
  391. /// </summary>
  392. public AnimationTrack* GetTrack (uint index)
  393. {
  394. Runtime.ValidateRefCounted (this);
  395. return Animation_GetTrack (handle, index);
  396. }
  397. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  398. internal static extern AnimationTrack* Animation_GetTrack0 (IntPtr handle, string name);
  399. /// <summary>
  400. /// Return animation track by name.
  401. /// </summary>
  402. public AnimationTrack* GetTrack (string name)
  403. {
  404. Runtime.ValidateRefCounted (this);
  405. return Animation_GetTrack0 (handle, name);
  406. }
  407. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  408. internal static extern AnimationTrack* Animation_GetTrack1 (IntPtr handle, int nameHash);
  409. /// <summary>
  410. /// Return animation track by name hash.
  411. /// </summary>
  412. public AnimationTrack* GetTrack (StringHash nameHash)
  413. {
  414. Runtime.ValidateRefCounted (this);
  415. return Animation_GetTrack1 (handle, nameHash.Code);
  416. }
  417. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  418. internal static extern uint Animation_GetNumTriggers (IntPtr handle);
  419. /// <summary>
  420. /// Return number of animation trigger points.
  421. /// </summary>
  422. private uint GetNumTriggers ()
  423. {
  424. Runtime.ValidateRefCounted (this);
  425. return Animation_GetNumTriggers (handle);
  426. }
  427. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  428. internal static extern AnimationTriggerPoint* Animation_GetTrigger (IntPtr handle, uint index);
  429. /// <summary>
  430. /// Return a trigger point by index.
  431. /// </summary>
  432. public AnimationTriggerPoint* GetTrigger (uint index)
  433. {
  434. Runtime.ValidateRefCounted (this);
  435. return Animation_GetTrigger (handle, index);
  436. }
  437. public override StringHash Type {
  438. get {
  439. return UrhoGetType ();
  440. }
  441. }
  442. public override string TypeName {
  443. get {
  444. return GetTypeName ();
  445. }
  446. }
  447. [Preserve]
  448. public new static StringHash TypeStatic {
  449. get {
  450. return GetTypeStatic ();
  451. }
  452. }
  453. public new static string TypeNameStatic {
  454. get {
  455. return GetTypeNameStatic ();
  456. }
  457. }
  458. /// <summary>
  459. /// Return animation name.
  460. /// Or
  461. /// Set animation name.
  462. /// </summary>
  463. public string AnimationName {
  464. get {
  465. return GetAnimationName ();
  466. }
  467. set {
  468. SetAnimationName (value);
  469. }
  470. }
  471. /// <summary>
  472. /// Return animation length.
  473. /// Or
  474. /// Set animation length.
  475. /// </summary>
  476. public float Length {
  477. get {
  478. return GetLength ();
  479. }
  480. set {
  481. SetLength (value);
  482. }
  483. }
  484. /// <summary>
  485. /// Return number of animation trigger points.
  486. /// Or
  487. /// Resize trigger point vector.
  488. /// </summary>
  489. public uint NumTriggers {
  490. get {
  491. return GetNumTriggers ();
  492. }
  493. set {
  494. SetNumTriggers (value);
  495. }
  496. }
  497. /// <summary>
  498. /// Return animation name hash.
  499. /// </summary>
  500. public StringHash AnimationNameHash {
  501. get {
  502. return GetAnimationNameHash ();
  503. }
  504. }
  505. /// <summary>
  506. /// Return number of animation tracks.
  507. /// </summary>
  508. public uint NumTracks {
  509. get {
  510. return GetNumTracks ();
  511. }
  512. }
  513. }
  514. }