AnimationState.cs 15 KB

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