2
0

AnimationState.cs 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531
  1. // WARNING - AUTOGENERATED - DO NOT EDIT
  2. //
  3. // Generated using `sharpie urho`
  4. //
  5. // AnimationState.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. /// %Animation instance.
  21. /// </summary>
  22. public unsafe partial class AnimationState : RefCounted
  23. {
  24. public AnimationState (IntPtr handle) : base (handle)
  25. {
  26. }
  27. protected AnimationState (UrhoObjectFlag emptyFlag) : base (emptyFlag)
  28. {
  29. }
  30. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  31. internal static extern IntPtr AnimationState_AnimationState (IntPtr model, IntPtr animation);
  32. public AnimationState (AnimatedModel model, Animation animation) : base (UrhoObjectFlag.Empty)
  33. {
  34. Runtime.Validate (typeof(AnimationState));
  35. handle = AnimationState_AnimationState ((object)model == null ? IntPtr.Zero : model.Handle, (object)animation == null ? IntPtr.Zero : animation.Handle);
  36. Runtime.RegisterObject (this);
  37. }
  38. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  39. internal static extern IntPtr AnimationState_AnimationState0 (IntPtr node, IntPtr animation);
  40. public AnimationState (Node node, Animation animation) : base (UrhoObjectFlag.Empty)
  41. {
  42. Runtime.Validate (typeof(AnimationState));
  43. handle = AnimationState_AnimationState0 ((object)node == null ? IntPtr.Zero : node.Handle, (object)animation == null ? IntPtr.Zero : animation.Handle);
  44. Runtime.RegisterObject (this);
  45. }
  46. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  47. internal static extern void AnimationState_SetStartBone (IntPtr handle, Bone* bone);
  48. /// <summary>
  49. /// Set start bone. Not supported in node animation mode. Resets any assigned per-bone weights.
  50. /// </summary>
  51. private void SetStartBone (Bone* bone)
  52. {
  53. Runtime.ValidateRefCounted (this);
  54. AnimationState_SetStartBone (handle, bone);
  55. }
  56. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  57. internal static extern void AnimationState_SetLooped (IntPtr handle, bool looped);
  58. /// <summary>
  59. /// Set looping enabled/disabled.
  60. /// </summary>
  61. private void SetLooped (bool looped)
  62. {
  63. Runtime.ValidateRefCounted (this);
  64. AnimationState_SetLooped (handle, looped);
  65. }
  66. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  67. internal static extern void AnimationState_SetWeight (IntPtr handle, float weight);
  68. /// <summary>
  69. /// Set blending weight.
  70. /// </summary>
  71. private void SetWeight (float weight)
  72. {
  73. Runtime.ValidateRefCounted (this);
  74. AnimationState_SetWeight (handle, weight);
  75. }
  76. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  77. internal static extern void AnimationState_SetBlendMode (IntPtr handle, AnimationBlendMode mode);
  78. /// <summary>
  79. /// Set blending mode.
  80. /// </summary>
  81. private void SetBlendMode (AnimationBlendMode mode)
  82. {
  83. Runtime.ValidateRefCounted (this);
  84. AnimationState_SetBlendMode (handle, mode);
  85. }
  86. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  87. internal static extern void AnimationState_SetTime (IntPtr handle, float time);
  88. /// <summary>
  89. /// Set time position. Does not fire animation triggers.
  90. /// </summary>
  91. private void SetTime (float time)
  92. {
  93. Runtime.ValidateRefCounted (this);
  94. AnimationState_SetTime (handle, time);
  95. }
  96. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  97. internal static extern void AnimationState_SetBoneWeight (IntPtr handle, uint index, float weight, bool recursive);
  98. /// <summary>
  99. /// Set per-bone blending weight by track index. Default is 1.0 (full), is multiplied with the state's blending weight when applying the animation. Optionally recurses to child bones.
  100. /// </summary>
  101. public void SetBoneWeight (uint index, float weight, bool recursive)
  102. {
  103. Runtime.ValidateRefCounted (this);
  104. AnimationState_SetBoneWeight (handle, index, weight, recursive);
  105. }
  106. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  107. internal static extern void AnimationState_SetBoneWeight1 (IntPtr handle, string name, float weight, bool recursive);
  108. /// <summary>
  109. /// Set per-bone blending weight by name.
  110. /// </summary>
  111. public void SetBoneWeight (string name, float weight, bool recursive)
  112. {
  113. Runtime.ValidateRefCounted (this);
  114. AnimationState_SetBoneWeight1 (handle, name, weight, recursive);
  115. }
  116. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  117. internal static extern void AnimationState_SetBoneWeight2 (IntPtr handle, int nameHash, float weight, bool recursive);
  118. /// <summary>
  119. /// Set per-bone blending weight by name hash.
  120. /// </summary>
  121. public void SetBoneWeight (StringHash nameHash, float weight, bool recursive)
  122. {
  123. Runtime.ValidateRefCounted (this);
  124. AnimationState_SetBoneWeight2 (handle, nameHash.Code, weight, recursive);
  125. }
  126. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  127. internal static extern void AnimationState_AddWeight (IntPtr handle, float delta);
  128. /// <summary>
  129. /// Modify blending weight.
  130. /// </summary>
  131. public void AddWeight (float delta)
  132. {
  133. Runtime.ValidateRefCounted (this);
  134. AnimationState_AddWeight (handle, delta);
  135. }
  136. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  137. internal static extern void AnimationState_AddTime (IntPtr handle, float delta);
  138. /// <summary>
  139. /// Modify time position. %Animation triggers will be fired.
  140. /// </summary>
  141. public void AddTime (float delta)
  142. {
  143. Runtime.ValidateRefCounted (this);
  144. AnimationState_AddTime (handle, delta);
  145. }
  146. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  147. internal static extern void AnimationState_SetLayer (IntPtr handle, byte layer);
  148. /// <summary>
  149. /// Set blending layer.
  150. /// </summary>
  151. private void SetLayer (byte layer)
  152. {
  153. Runtime.ValidateRefCounted (this);
  154. AnimationState_SetLayer (handle, layer);
  155. }
  156. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  157. internal static extern IntPtr AnimationState_GetAnimation (IntPtr handle);
  158. /// <summary>
  159. /// Return animation.
  160. /// </summary>
  161. private Animation GetAnimation ()
  162. {
  163. Runtime.ValidateRefCounted (this);
  164. return Runtime.LookupObject<Animation> (AnimationState_GetAnimation (handle));
  165. }
  166. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  167. internal static extern IntPtr AnimationState_GetModel (IntPtr handle);
  168. /// <summary>
  169. /// Return animated model this state belongs to (model mode.)
  170. /// </summary>
  171. private AnimatedModel GetModel ()
  172. {
  173. Runtime.ValidateRefCounted (this);
  174. return Runtime.LookupObject<AnimatedModel> (AnimationState_GetModel (handle));
  175. }
  176. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  177. internal static extern IntPtr AnimationState_GetNode (IntPtr handle);
  178. /// <summary>
  179. /// Return root scene node this state controls (node hierarchy mode.)
  180. /// </summary>
  181. private Node GetNode ()
  182. {
  183. Runtime.ValidateRefCounted (this);
  184. return Runtime.LookupObject<Node> (AnimationState_GetNode (handle));
  185. }
  186. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  187. internal static extern Bone* AnimationState_GetStartBone (IntPtr handle);
  188. /// <summary>
  189. /// Return start bone.
  190. /// </summary>
  191. private Bone* GetStartBone ()
  192. {
  193. Runtime.ValidateRefCounted (this);
  194. return AnimationState_GetStartBone (handle);
  195. }
  196. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  197. internal static extern float AnimationState_GetBoneWeight (IntPtr handle, uint index);
  198. /// <summary>
  199. /// Return per-bone blending weight by track index.
  200. /// </summary>
  201. public float GetBoneWeight (uint index)
  202. {
  203. Runtime.ValidateRefCounted (this);
  204. return AnimationState_GetBoneWeight (handle, index);
  205. }
  206. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  207. internal static extern float AnimationState_GetBoneWeight3 (IntPtr handle, string name);
  208. /// <summary>
  209. /// Return per-bone blending weight by name.
  210. /// </summary>
  211. public float GetBoneWeight (string name)
  212. {
  213. Runtime.ValidateRefCounted (this);
  214. return AnimationState_GetBoneWeight3 (handle, name);
  215. }
  216. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  217. internal static extern float AnimationState_GetBoneWeight4 (IntPtr handle, int nameHash);
  218. /// <summary>
  219. /// Return per-bone blending weight by name.
  220. /// </summary>
  221. public float GetBoneWeight (StringHash nameHash)
  222. {
  223. Runtime.ValidateRefCounted (this);
  224. return AnimationState_GetBoneWeight4 (handle, nameHash.Code);
  225. }
  226. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  227. internal static extern uint AnimationState_GetTrackIndex (IntPtr handle, IntPtr node);
  228. /// <summary>
  229. /// Return track index with matching bone node, or M_MAX_UNSIGNED if not found.
  230. /// </summary>
  231. public uint GetTrackIndex (Node node)
  232. {
  233. Runtime.ValidateRefCounted (this);
  234. return AnimationState_GetTrackIndex (handle, (object)node == null ? IntPtr.Zero : node.Handle);
  235. }
  236. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  237. internal static extern uint AnimationState_GetTrackIndex5 (IntPtr handle, string name);
  238. /// <summary>
  239. /// Return track index by bone name, or M_MAX_UNSIGNED if not found.
  240. /// </summary>
  241. public uint GetTrackIndex (string name)
  242. {
  243. Runtime.ValidateRefCounted (this);
  244. return AnimationState_GetTrackIndex5 (handle, name);
  245. }
  246. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  247. internal static extern uint AnimationState_GetTrackIndex6 (IntPtr handle, int nameHash);
  248. /// <summary>
  249. /// Return track index by bone name hash, or M_MAX_UNSIGNED if not found.
  250. /// </summary>
  251. public uint GetTrackIndex (StringHash nameHash)
  252. {
  253. Runtime.ValidateRefCounted (this);
  254. return AnimationState_GetTrackIndex6 (handle, nameHash.Code);
  255. }
  256. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  257. internal static extern bool AnimationState_IsEnabled (IntPtr handle);
  258. /// <summary>
  259. /// Return whether weight is nonzero.
  260. /// </summary>
  261. private bool IsEnabled ()
  262. {
  263. Runtime.ValidateRefCounted (this);
  264. return AnimationState_IsEnabled (handle);
  265. }
  266. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  267. internal static extern bool AnimationState_IsLooped (IntPtr handle);
  268. /// <summary>
  269. /// Return whether looped.
  270. /// </summary>
  271. private bool IsLooped ()
  272. {
  273. Runtime.ValidateRefCounted (this);
  274. return AnimationState_IsLooped (handle);
  275. }
  276. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  277. internal static extern float AnimationState_GetWeight (IntPtr handle);
  278. /// <summary>
  279. /// Return blending weight.
  280. /// </summary>
  281. private float GetWeight ()
  282. {
  283. Runtime.ValidateRefCounted (this);
  284. return AnimationState_GetWeight (handle);
  285. }
  286. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  287. internal static extern AnimationBlendMode AnimationState_GetBlendMode (IntPtr handle);
  288. /// <summary>
  289. /// Return blending mode.
  290. /// </summary>
  291. private AnimationBlendMode GetBlendMode ()
  292. {
  293. Runtime.ValidateRefCounted (this);
  294. return AnimationState_GetBlendMode (handle);
  295. }
  296. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  297. internal static extern float AnimationState_GetTime (IntPtr handle);
  298. /// <summary>
  299. /// Return time position.
  300. /// </summary>
  301. private float GetTime ()
  302. {
  303. Runtime.ValidateRefCounted (this);
  304. return AnimationState_GetTime (handle);
  305. }
  306. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  307. internal static extern float AnimationState_GetLength (IntPtr handle);
  308. /// <summary>
  309. /// Return animation length.
  310. /// </summary>
  311. private float GetLength ()
  312. {
  313. Runtime.ValidateRefCounted (this);
  314. return AnimationState_GetLength (handle);
  315. }
  316. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  317. internal static extern byte AnimationState_GetLayer (IntPtr handle);
  318. /// <summary>
  319. /// Return blending layer.
  320. /// </summary>
  321. private byte GetLayer ()
  322. {
  323. Runtime.ValidateRefCounted (this);
  324. return AnimationState_GetLayer (handle);
  325. }
  326. [DllImport (Consts.NativeImport, CallingConvention = CallingConvention.Cdecl)]
  327. internal static extern void AnimationState_Apply (IntPtr handle);
  328. /// <summary>
  329. /// Apply the animation at the current time position.
  330. /// </summary>
  331. public void Apply ()
  332. {
  333. Runtime.ValidateRefCounted (this);
  334. AnimationState_Apply (handle);
  335. }
  336. /// <summary>
  337. /// Return start bone.
  338. /// Or
  339. /// Set start bone. Not supported in node animation mode. Resets any assigned per-bone weights.
  340. /// </summary>
  341. public Bone* StartBone {
  342. get {
  343. return GetStartBone ();
  344. }
  345. set {
  346. SetStartBone (value);
  347. }
  348. }
  349. /// <summary>
  350. /// Return whether looped.
  351. /// Or
  352. /// Set looping enabled/disabled.
  353. /// </summary>
  354. public bool Looped {
  355. get {
  356. return IsLooped ();
  357. }
  358. set {
  359. SetLooped (value);
  360. }
  361. }
  362. /// <summary>
  363. /// Return blending weight.
  364. /// Or
  365. /// Set blending weight.
  366. /// </summary>
  367. public float Weight {
  368. get {
  369. return GetWeight ();
  370. }
  371. set {
  372. SetWeight (value);
  373. }
  374. }
  375. /// <summary>
  376. /// Return blending mode.
  377. /// Or
  378. /// Set blending mode.
  379. /// </summary>
  380. public AnimationBlendMode BlendMode {
  381. get {
  382. return GetBlendMode ();
  383. }
  384. set {
  385. SetBlendMode (value);
  386. }
  387. }
  388. /// <summary>
  389. /// Return time position.
  390. /// Or
  391. /// Set time position. Does not fire animation triggers.
  392. /// </summary>
  393. public float Time {
  394. get {
  395. return GetTime ();
  396. }
  397. set {
  398. SetTime (value);
  399. }
  400. }
  401. /// <summary>
  402. /// Return blending layer.
  403. /// Or
  404. /// Set blending layer.
  405. /// </summary>
  406. public byte Layer {
  407. get {
  408. return GetLayer ();
  409. }
  410. set {
  411. SetLayer (value);
  412. }
  413. }
  414. /// <summary>
  415. /// Return animation.
  416. /// </summary>
  417. public Animation Animation {
  418. get {
  419. return GetAnimation ();
  420. }
  421. }
  422. /// <summary>
  423. /// Return animated model this state belongs to (model mode.)
  424. /// </summary>
  425. public AnimatedModel Model {
  426. get {
  427. return GetModel ();
  428. }
  429. }
  430. /// <summary>
  431. /// Return root scene node this state controls (node hierarchy mode.)
  432. /// </summary>
  433. public Node Node {
  434. get {
  435. return GetNode ();
  436. }
  437. }
  438. /// <summary>
  439. /// Return whether weight is nonzero.
  440. /// </summary>
  441. public bool Enabled {
  442. get {
  443. return IsEnabled ();
  444. }
  445. }
  446. /// <summary>
  447. /// Return animation length.
  448. /// </summary>
  449. public float Length {
  450. get {
  451. return GetLength ();
  452. }
  453. }
  454. }
  455. }