lua_AnimationClip.cpp 33 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096
  1. #include "Base.h"
  2. #include "ScriptController.h"
  3. #include "lua_AnimationClip.h"
  4. #include "Animation.h"
  5. #include "AnimationClip.h"
  6. #include "AnimationTarget.h"
  7. #include "Base.h"
  8. #include "Game.h"
  9. #include "Quaternion.h"
  10. #include "Ref.h"
  11. #include "ScriptListener.h"
  12. #include "lua_AnimationClipListenerEventType.h"
  13. namespace gameplay
  14. {
  15. void luaRegister_AnimationClip()
  16. {
  17. ScriptController* sc = ScriptController::getInstance();
  18. const luaL_Reg lua_members[] =
  19. {
  20. {"addBeginListener", lua_AnimationClip_addBeginListener},
  21. {"addEndListener", lua_AnimationClip_addEndListener},
  22. {"addListener", lua_AnimationClip_addListener},
  23. {"addRef", lua_AnimationClip_addRef},
  24. {"crossFade", lua_AnimationClip_crossFade},
  25. {"getActiveDuration", lua_AnimationClip_getActiveDuration},
  26. {"getAnimation", lua_AnimationClip_getAnimation},
  27. {"getBlendWeight", lua_AnimationClip_getBlendWeight},
  28. {"getDuration", lua_AnimationClip_getDuration},
  29. {"getElaspedTime", lua_AnimationClip_getElaspedTime},
  30. {"getEndTime", lua_AnimationClip_getEndTime},
  31. {"getId", lua_AnimationClip_getId},
  32. {"getRefCount", lua_AnimationClip_getRefCount},
  33. {"getRepeatCount", lua_AnimationClip_getRepeatCount},
  34. {"getSpeed", lua_AnimationClip_getSpeed},
  35. {"getStartTime", lua_AnimationClip_getStartTime},
  36. {"isPlaying", lua_AnimationClip_isPlaying},
  37. {"pause", lua_AnimationClip_pause},
  38. {"play", lua_AnimationClip_play},
  39. {"release", lua_AnimationClip_release},
  40. {"setActiveDuration", lua_AnimationClip_setActiveDuration},
  41. {"setBlendWeight", lua_AnimationClip_setBlendWeight},
  42. {"setRepeatCount", lua_AnimationClip_setRepeatCount},
  43. {"setSpeed", lua_AnimationClip_setSpeed},
  44. {"stop", lua_AnimationClip_stop},
  45. {NULL, NULL}
  46. };
  47. const luaL_Reg lua_statics[] =
  48. {
  49. {"REPEAT_INDEFINITE", lua_AnimationClip_static_REPEAT_INDEFINITE},
  50. {NULL, NULL}
  51. };
  52. std::vector<std::string> scopePath;
  53. sc->registerClass("AnimationClip", lua_members, NULL, lua_AnimationClip__gc, lua_statics, scopePath);
  54. }
  55. static AnimationClip* getInstance(lua_State* state)
  56. {
  57. void* userdata = luaL_checkudata(state, 1, "AnimationClip");
  58. luaL_argcheck(state, userdata != NULL, 1, "'AnimationClip' expected.");
  59. return (AnimationClip*)((ScriptController::LuaObject*)userdata)->instance;
  60. }
  61. int lua_AnimationClip__gc(lua_State* state)
  62. {
  63. // Get the number of parameters.
  64. int paramCount = lua_gettop(state);
  65. // Attempt to match the parameters to a valid binding.
  66. switch (paramCount)
  67. {
  68. case 1:
  69. {
  70. if ((lua_type(state, 1) == LUA_TUSERDATA))
  71. {
  72. void* userdata = luaL_checkudata(state, 1, "AnimationClip");
  73. luaL_argcheck(state, userdata != NULL, 1, "'AnimationClip' expected.");
  74. ScriptController::LuaObject* object = (ScriptController::LuaObject*)userdata;
  75. if (object->owns)
  76. {
  77. AnimationClip* instance = (AnimationClip*)object->instance;
  78. SAFE_RELEASE(instance);
  79. }
  80. return 0;
  81. }
  82. else
  83. {
  84. lua_pushstring(state, "lua_AnimationClip__gc - Failed to match the given parameters to a valid function signature.");
  85. lua_error(state);
  86. }
  87. break;
  88. }
  89. default:
  90. {
  91. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  92. lua_error(state);
  93. break;
  94. }
  95. }
  96. return 0;
  97. }
  98. int lua_AnimationClip_addBeginListener(lua_State* state)
  99. {
  100. // Get the number of parameters.
  101. int paramCount = lua_gettop(state);
  102. // Attempt to match the parameters to a valid binding.
  103. switch (paramCount)
  104. {
  105. case 2:
  106. {
  107. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  108. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  109. {
  110. // Get parameter 1 off the stack.
  111. AnimationClip::Listener* param1 = ScriptController::getInstance()->getObjectPointer<AnimationClip::Listener>(2, "AnimationClipListener", false);
  112. AnimationClip* instance = getInstance(state);
  113. instance->addBeginListener(param1);
  114. return 0;
  115. }
  116. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  117. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  118. {
  119. // Get parameter 1 off the stack.
  120. const char* param1 = ScriptController::getInstance()->getString(2, false);
  121. AnimationClip* instance = getInstance(state);
  122. instance->addBeginListener(param1);
  123. return 0;
  124. }
  125. else
  126. {
  127. lua_pushstring(state, "lua_AnimationClip_addBeginListener - Failed to match the given parameters to a valid function signature.");
  128. lua_error(state);
  129. }
  130. break;
  131. }
  132. default:
  133. {
  134. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  135. lua_error(state);
  136. break;
  137. }
  138. }
  139. return 0;
  140. }
  141. int lua_AnimationClip_addEndListener(lua_State* state)
  142. {
  143. // Get the number of parameters.
  144. int paramCount = lua_gettop(state);
  145. // Attempt to match the parameters to a valid binding.
  146. switch (paramCount)
  147. {
  148. case 2:
  149. {
  150. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  151. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL))
  152. {
  153. // Get parameter 1 off the stack.
  154. AnimationClip::Listener* param1 = ScriptController::getInstance()->getObjectPointer<AnimationClip::Listener>(2, "AnimationClipListener", false);
  155. AnimationClip* instance = getInstance(state);
  156. instance->addEndListener(param1);
  157. return 0;
  158. }
  159. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  160. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL))
  161. {
  162. // Get parameter 1 off the stack.
  163. const char* param1 = ScriptController::getInstance()->getString(2, false);
  164. AnimationClip* instance = getInstance(state);
  165. instance->addEndListener(param1);
  166. return 0;
  167. }
  168. else
  169. {
  170. lua_pushstring(state, "lua_AnimationClip_addEndListener - Failed to match the given parameters to a valid function signature.");
  171. lua_error(state);
  172. }
  173. break;
  174. }
  175. default:
  176. {
  177. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  178. lua_error(state);
  179. break;
  180. }
  181. }
  182. return 0;
  183. }
  184. int lua_AnimationClip_addListener(lua_State* state)
  185. {
  186. // Get the number of parameters.
  187. int paramCount = lua_gettop(state);
  188. // Attempt to match the parameters to a valid binding.
  189. switch (paramCount)
  190. {
  191. case 3:
  192. {
  193. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  194. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  195. lua_type(state, 3) == LUA_TNUMBER)
  196. {
  197. // Get parameter 1 off the stack.
  198. AnimationClip::Listener* param1 = ScriptController::getInstance()->getObjectPointer<AnimationClip::Listener>(2, "AnimationClipListener", false);
  199. // Get parameter 2 off the stack.
  200. unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 3);
  201. AnimationClip* instance = getInstance(state);
  202. instance->addListener(param1, param2);
  203. return 0;
  204. }
  205. else if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  206. (lua_type(state, 2) == LUA_TSTRING || lua_type(state, 2) == LUA_TNIL) &&
  207. lua_type(state, 3) == LUA_TNUMBER)
  208. {
  209. // Get parameter 1 off the stack.
  210. const char* param1 = ScriptController::getInstance()->getString(2, false);
  211. // Get parameter 2 off the stack.
  212. unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 3);
  213. AnimationClip* instance = getInstance(state);
  214. instance->addListener(param1, param2);
  215. return 0;
  216. }
  217. else
  218. {
  219. lua_pushstring(state, "lua_AnimationClip_addListener - Failed to match the given parameters to a valid function signature.");
  220. lua_error(state);
  221. }
  222. break;
  223. }
  224. default:
  225. {
  226. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  227. lua_error(state);
  228. break;
  229. }
  230. }
  231. return 0;
  232. }
  233. int lua_AnimationClip_addRef(lua_State* state)
  234. {
  235. // Get the number of parameters.
  236. int paramCount = lua_gettop(state);
  237. // Attempt to match the parameters to a valid binding.
  238. switch (paramCount)
  239. {
  240. case 1:
  241. {
  242. if ((lua_type(state, 1) == LUA_TUSERDATA))
  243. {
  244. AnimationClip* instance = getInstance(state);
  245. instance->addRef();
  246. return 0;
  247. }
  248. else
  249. {
  250. lua_pushstring(state, "lua_AnimationClip_addRef - Failed to match the given parameters to a valid function signature.");
  251. lua_error(state);
  252. }
  253. break;
  254. }
  255. default:
  256. {
  257. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  258. lua_error(state);
  259. break;
  260. }
  261. }
  262. return 0;
  263. }
  264. int lua_AnimationClip_crossFade(lua_State* state)
  265. {
  266. // Get the number of parameters.
  267. int paramCount = lua_gettop(state);
  268. // Attempt to match the parameters to a valid binding.
  269. switch (paramCount)
  270. {
  271. case 3:
  272. {
  273. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  274. (lua_type(state, 2) == LUA_TUSERDATA || lua_type(state, 2) == LUA_TTABLE || lua_type(state, 2) == LUA_TNIL) &&
  275. lua_type(state, 3) == LUA_TNUMBER)
  276. {
  277. // Get parameter 1 off the stack.
  278. AnimationClip* param1 = ScriptController::getInstance()->getObjectPointer<AnimationClip>(2, "AnimationClip", false);
  279. // Get parameter 2 off the stack.
  280. unsigned long param2 = (unsigned long)luaL_checkunsigned(state, 3);
  281. AnimationClip* instance = getInstance(state);
  282. instance->crossFade(param1, param2);
  283. return 0;
  284. }
  285. else
  286. {
  287. lua_pushstring(state, "lua_AnimationClip_crossFade - Failed to match the given parameters to a valid function signature.");
  288. lua_error(state);
  289. }
  290. break;
  291. }
  292. default:
  293. {
  294. lua_pushstring(state, "Invalid number of parameters (expected 3).");
  295. lua_error(state);
  296. break;
  297. }
  298. }
  299. return 0;
  300. }
  301. int lua_AnimationClip_getActiveDuration(lua_State* state)
  302. {
  303. // Get the number of parameters.
  304. int paramCount = lua_gettop(state);
  305. // Attempt to match the parameters to a valid binding.
  306. switch (paramCount)
  307. {
  308. case 1:
  309. {
  310. if ((lua_type(state, 1) == LUA_TUSERDATA))
  311. {
  312. AnimationClip* instance = getInstance(state);
  313. unsigned long result = instance->getActiveDuration();
  314. // Push the return value onto the stack.
  315. lua_pushunsigned(state, result);
  316. return 1;
  317. }
  318. else
  319. {
  320. lua_pushstring(state, "lua_AnimationClip_getActiveDuration - Failed to match the given parameters to a valid function signature.");
  321. lua_error(state);
  322. }
  323. break;
  324. }
  325. default:
  326. {
  327. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  328. lua_error(state);
  329. break;
  330. }
  331. }
  332. return 0;
  333. }
  334. int lua_AnimationClip_getAnimation(lua_State* state)
  335. {
  336. // Get the number of parameters.
  337. int paramCount = lua_gettop(state);
  338. // Attempt to match the parameters to a valid binding.
  339. switch (paramCount)
  340. {
  341. case 1:
  342. {
  343. if ((lua_type(state, 1) == LUA_TUSERDATA))
  344. {
  345. AnimationClip* instance = getInstance(state);
  346. void* returnPtr = (void*)instance->getAnimation();
  347. if (returnPtr)
  348. {
  349. ScriptController::LuaObject* object = (ScriptController::LuaObject*)lua_newuserdata(state, sizeof(ScriptController::LuaObject));
  350. object->instance = returnPtr;
  351. object->owns = false;
  352. luaL_getmetatable(state, "Animation");
  353. lua_setmetatable(state, -2);
  354. }
  355. else
  356. {
  357. lua_pushnil(state);
  358. }
  359. return 1;
  360. }
  361. else
  362. {
  363. lua_pushstring(state, "lua_AnimationClip_getAnimation - Failed to match the given parameters to a valid function signature.");
  364. lua_error(state);
  365. }
  366. break;
  367. }
  368. default:
  369. {
  370. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  371. lua_error(state);
  372. break;
  373. }
  374. }
  375. return 0;
  376. }
  377. int lua_AnimationClip_getBlendWeight(lua_State* state)
  378. {
  379. // Get the number of parameters.
  380. int paramCount = lua_gettop(state);
  381. // Attempt to match the parameters to a valid binding.
  382. switch (paramCount)
  383. {
  384. case 1:
  385. {
  386. if ((lua_type(state, 1) == LUA_TUSERDATA))
  387. {
  388. AnimationClip* instance = getInstance(state);
  389. float result = instance->getBlendWeight();
  390. // Push the return value onto the stack.
  391. lua_pushnumber(state, result);
  392. return 1;
  393. }
  394. else
  395. {
  396. lua_pushstring(state, "lua_AnimationClip_getBlendWeight - Failed to match the given parameters to a valid function signature.");
  397. lua_error(state);
  398. }
  399. break;
  400. }
  401. default:
  402. {
  403. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  404. lua_error(state);
  405. break;
  406. }
  407. }
  408. return 0;
  409. }
  410. int lua_AnimationClip_getDuration(lua_State* state)
  411. {
  412. // Get the number of parameters.
  413. int paramCount = lua_gettop(state);
  414. // Attempt to match the parameters to a valid binding.
  415. switch (paramCount)
  416. {
  417. case 1:
  418. {
  419. if ((lua_type(state, 1) == LUA_TUSERDATA))
  420. {
  421. AnimationClip* instance = getInstance(state);
  422. unsigned long result = instance->getDuration();
  423. // Push the return value onto the stack.
  424. lua_pushunsigned(state, result);
  425. return 1;
  426. }
  427. else
  428. {
  429. lua_pushstring(state, "lua_AnimationClip_getDuration - Failed to match the given parameters to a valid function signature.");
  430. lua_error(state);
  431. }
  432. break;
  433. }
  434. default:
  435. {
  436. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  437. lua_error(state);
  438. break;
  439. }
  440. }
  441. return 0;
  442. }
  443. int lua_AnimationClip_getElaspedTime(lua_State* state)
  444. {
  445. // Get the number of parameters.
  446. int paramCount = lua_gettop(state);
  447. // Attempt to match the parameters to a valid binding.
  448. switch (paramCount)
  449. {
  450. case 1:
  451. {
  452. if ((lua_type(state, 1) == LUA_TUSERDATA))
  453. {
  454. AnimationClip* instance = getInstance(state);
  455. float result = instance->getElaspedTime();
  456. // Push the return value onto the stack.
  457. lua_pushnumber(state, result);
  458. return 1;
  459. }
  460. else
  461. {
  462. lua_pushstring(state, "lua_AnimationClip_getElaspedTime - Failed to match the given parameters to a valid function signature.");
  463. lua_error(state);
  464. }
  465. break;
  466. }
  467. default:
  468. {
  469. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  470. lua_error(state);
  471. break;
  472. }
  473. }
  474. return 0;
  475. }
  476. int lua_AnimationClip_getEndTime(lua_State* state)
  477. {
  478. // Get the number of parameters.
  479. int paramCount = lua_gettop(state);
  480. // Attempt to match the parameters to a valid binding.
  481. switch (paramCount)
  482. {
  483. case 1:
  484. {
  485. if ((lua_type(state, 1) == LUA_TUSERDATA))
  486. {
  487. AnimationClip* instance = getInstance(state);
  488. unsigned long result = instance->getEndTime();
  489. // Push the return value onto the stack.
  490. lua_pushunsigned(state, result);
  491. return 1;
  492. }
  493. else
  494. {
  495. lua_pushstring(state, "lua_AnimationClip_getEndTime - Failed to match the given parameters to a valid function signature.");
  496. lua_error(state);
  497. }
  498. break;
  499. }
  500. default:
  501. {
  502. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  503. lua_error(state);
  504. break;
  505. }
  506. }
  507. return 0;
  508. }
  509. int lua_AnimationClip_getId(lua_State* state)
  510. {
  511. // Get the number of parameters.
  512. int paramCount = lua_gettop(state);
  513. // Attempt to match the parameters to a valid binding.
  514. switch (paramCount)
  515. {
  516. case 1:
  517. {
  518. if ((lua_type(state, 1) == LUA_TUSERDATA))
  519. {
  520. AnimationClip* instance = getInstance(state);
  521. const char* result = instance->getId();
  522. // Push the return value onto the stack.
  523. lua_pushstring(state, result);
  524. return 1;
  525. }
  526. else
  527. {
  528. lua_pushstring(state, "lua_AnimationClip_getId - Failed to match the given parameters to a valid function signature.");
  529. lua_error(state);
  530. }
  531. break;
  532. }
  533. default:
  534. {
  535. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  536. lua_error(state);
  537. break;
  538. }
  539. }
  540. return 0;
  541. }
  542. int lua_AnimationClip_getRefCount(lua_State* state)
  543. {
  544. // Get the number of parameters.
  545. int paramCount = lua_gettop(state);
  546. // Attempt to match the parameters to a valid binding.
  547. switch (paramCount)
  548. {
  549. case 1:
  550. {
  551. if ((lua_type(state, 1) == LUA_TUSERDATA))
  552. {
  553. AnimationClip* instance = getInstance(state);
  554. unsigned int result = instance->getRefCount();
  555. // Push the return value onto the stack.
  556. lua_pushunsigned(state, result);
  557. return 1;
  558. }
  559. else
  560. {
  561. lua_pushstring(state, "lua_AnimationClip_getRefCount - Failed to match the given parameters to a valid function signature.");
  562. lua_error(state);
  563. }
  564. break;
  565. }
  566. default:
  567. {
  568. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  569. lua_error(state);
  570. break;
  571. }
  572. }
  573. return 0;
  574. }
  575. int lua_AnimationClip_getRepeatCount(lua_State* state)
  576. {
  577. // Get the number of parameters.
  578. int paramCount = lua_gettop(state);
  579. // Attempt to match the parameters to a valid binding.
  580. switch (paramCount)
  581. {
  582. case 1:
  583. {
  584. if ((lua_type(state, 1) == LUA_TUSERDATA))
  585. {
  586. AnimationClip* instance = getInstance(state);
  587. float result = instance->getRepeatCount();
  588. // Push the return value onto the stack.
  589. lua_pushnumber(state, result);
  590. return 1;
  591. }
  592. else
  593. {
  594. lua_pushstring(state, "lua_AnimationClip_getRepeatCount - Failed to match the given parameters to a valid function signature.");
  595. lua_error(state);
  596. }
  597. break;
  598. }
  599. default:
  600. {
  601. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  602. lua_error(state);
  603. break;
  604. }
  605. }
  606. return 0;
  607. }
  608. int lua_AnimationClip_getSpeed(lua_State* state)
  609. {
  610. // Get the number of parameters.
  611. int paramCount = lua_gettop(state);
  612. // Attempt to match the parameters to a valid binding.
  613. switch (paramCount)
  614. {
  615. case 1:
  616. {
  617. if ((lua_type(state, 1) == LUA_TUSERDATA))
  618. {
  619. AnimationClip* instance = getInstance(state);
  620. float result = instance->getSpeed();
  621. // Push the return value onto the stack.
  622. lua_pushnumber(state, result);
  623. return 1;
  624. }
  625. else
  626. {
  627. lua_pushstring(state, "lua_AnimationClip_getSpeed - Failed to match the given parameters to a valid function signature.");
  628. lua_error(state);
  629. }
  630. break;
  631. }
  632. default:
  633. {
  634. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  635. lua_error(state);
  636. break;
  637. }
  638. }
  639. return 0;
  640. }
  641. int lua_AnimationClip_getStartTime(lua_State* state)
  642. {
  643. // Get the number of parameters.
  644. int paramCount = lua_gettop(state);
  645. // Attempt to match the parameters to a valid binding.
  646. switch (paramCount)
  647. {
  648. case 1:
  649. {
  650. if ((lua_type(state, 1) == LUA_TUSERDATA))
  651. {
  652. AnimationClip* instance = getInstance(state);
  653. unsigned long result = instance->getStartTime();
  654. // Push the return value onto the stack.
  655. lua_pushunsigned(state, result);
  656. return 1;
  657. }
  658. else
  659. {
  660. lua_pushstring(state, "lua_AnimationClip_getStartTime - Failed to match the given parameters to a valid function signature.");
  661. lua_error(state);
  662. }
  663. break;
  664. }
  665. default:
  666. {
  667. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  668. lua_error(state);
  669. break;
  670. }
  671. }
  672. return 0;
  673. }
  674. int lua_AnimationClip_isPlaying(lua_State* state)
  675. {
  676. // Get the number of parameters.
  677. int paramCount = lua_gettop(state);
  678. // Attempt to match the parameters to a valid binding.
  679. switch (paramCount)
  680. {
  681. case 1:
  682. {
  683. if ((lua_type(state, 1) == LUA_TUSERDATA))
  684. {
  685. AnimationClip* instance = getInstance(state);
  686. bool result = instance->isPlaying();
  687. // Push the return value onto the stack.
  688. lua_pushboolean(state, result);
  689. return 1;
  690. }
  691. else
  692. {
  693. lua_pushstring(state, "lua_AnimationClip_isPlaying - Failed to match the given parameters to a valid function signature.");
  694. lua_error(state);
  695. }
  696. break;
  697. }
  698. default:
  699. {
  700. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  701. lua_error(state);
  702. break;
  703. }
  704. }
  705. return 0;
  706. }
  707. int lua_AnimationClip_pause(lua_State* state)
  708. {
  709. // Get the number of parameters.
  710. int paramCount = lua_gettop(state);
  711. // Attempt to match the parameters to a valid binding.
  712. switch (paramCount)
  713. {
  714. case 1:
  715. {
  716. if ((lua_type(state, 1) == LUA_TUSERDATA))
  717. {
  718. AnimationClip* instance = getInstance(state);
  719. instance->pause();
  720. return 0;
  721. }
  722. else
  723. {
  724. lua_pushstring(state, "lua_AnimationClip_pause - Failed to match the given parameters to a valid function signature.");
  725. lua_error(state);
  726. }
  727. break;
  728. }
  729. default:
  730. {
  731. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  732. lua_error(state);
  733. break;
  734. }
  735. }
  736. return 0;
  737. }
  738. int lua_AnimationClip_play(lua_State* state)
  739. {
  740. // Get the number of parameters.
  741. int paramCount = lua_gettop(state);
  742. // Attempt to match the parameters to a valid binding.
  743. switch (paramCount)
  744. {
  745. case 1:
  746. {
  747. if ((lua_type(state, 1) == LUA_TUSERDATA))
  748. {
  749. AnimationClip* instance = getInstance(state);
  750. instance->play();
  751. return 0;
  752. }
  753. else
  754. {
  755. lua_pushstring(state, "lua_AnimationClip_play - Failed to match the given parameters to a valid function signature.");
  756. lua_error(state);
  757. }
  758. break;
  759. }
  760. default:
  761. {
  762. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  763. lua_error(state);
  764. break;
  765. }
  766. }
  767. return 0;
  768. }
  769. int lua_AnimationClip_release(lua_State* state)
  770. {
  771. // Get the number of parameters.
  772. int paramCount = lua_gettop(state);
  773. // Attempt to match the parameters to a valid binding.
  774. switch (paramCount)
  775. {
  776. case 1:
  777. {
  778. if ((lua_type(state, 1) == LUA_TUSERDATA))
  779. {
  780. AnimationClip* instance = getInstance(state);
  781. instance->release();
  782. return 0;
  783. }
  784. else
  785. {
  786. lua_pushstring(state, "lua_AnimationClip_release - Failed to match the given parameters to a valid function signature.");
  787. lua_error(state);
  788. }
  789. break;
  790. }
  791. default:
  792. {
  793. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  794. lua_error(state);
  795. break;
  796. }
  797. }
  798. return 0;
  799. }
  800. int lua_AnimationClip_setActiveDuration(lua_State* state)
  801. {
  802. // Get the number of parameters.
  803. int paramCount = lua_gettop(state);
  804. // Attempt to match the parameters to a valid binding.
  805. switch (paramCount)
  806. {
  807. case 2:
  808. {
  809. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  810. lua_type(state, 2) == LUA_TNUMBER)
  811. {
  812. // Get parameter 1 off the stack.
  813. unsigned long param1 = (unsigned long)luaL_checkunsigned(state, 2);
  814. AnimationClip* instance = getInstance(state);
  815. instance->setActiveDuration(param1);
  816. return 0;
  817. }
  818. else
  819. {
  820. lua_pushstring(state, "lua_AnimationClip_setActiveDuration - Failed to match the given parameters to a valid function signature.");
  821. lua_error(state);
  822. }
  823. break;
  824. }
  825. default:
  826. {
  827. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  828. lua_error(state);
  829. break;
  830. }
  831. }
  832. return 0;
  833. }
  834. int lua_AnimationClip_setBlendWeight(lua_State* state)
  835. {
  836. // Get the number of parameters.
  837. int paramCount = lua_gettop(state);
  838. // Attempt to match the parameters to a valid binding.
  839. switch (paramCount)
  840. {
  841. case 2:
  842. {
  843. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  844. lua_type(state, 2) == LUA_TNUMBER)
  845. {
  846. // Get parameter 1 off the stack.
  847. float param1 = (float)luaL_checknumber(state, 2);
  848. AnimationClip* instance = getInstance(state);
  849. instance->setBlendWeight(param1);
  850. return 0;
  851. }
  852. else
  853. {
  854. lua_pushstring(state, "lua_AnimationClip_setBlendWeight - Failed to match the given parameters to a valid function signature.");
  855. lua_error(state);
  856. }
  857. break;
  858. }
  859. default:
  860. {
  861. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  862. lua_error(state);
  863. break;
  864. }
  865. }
  866. return 0;
  867. }
  868. int lua_AnimationClip_setRepeatCount(lua_State* state)
  869. {
  870. // Get the number of parameters.
  871. int paramCount = lua_gettop(state);
  872. // Attempt to match the parameters to a valid binding.
  873. switch (paramCount)
  874. {
  875. case 2:
  876. {
  877. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  878. lua_type(state, 2) == LUA_TNUMBER)
  879. {
  880. // Get parameter 1 off the stack.
  881. float param1 = (float)luaL_checknumber(state, 2);
  882. AnimationClip* instance = getInstance(state);
  883. instance->setRepeatCount(param1);
  884. return 0;
  885. }
  886. else
  887. {
  888. lua_pushstring(state, "lua_AnimationClip_setRepeatCount - Failed to match the given parameters to a valid function signature.");
  889. lua_error(state);
  890. }
  891. break;
  892. }
  893. default:
  894. {
  895. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  896. lua_error(state);
  897. break;
  898. }
  899. }
  900. return 0;
  901. }
  902. int lua_AnimationClip_setSpeed(lua_State* state)
  903. {
  904. // Get the number of parameters.
  905. int paramCount = lua_gettop(state);
  906. // Attempt to match the parameters to a valid binding.
  907. switch (paramCount)
  908. {
  909. case 2:
  910. {
  911. if ((lua_type(state, 1) == LUA_TUSERDATA) &&
  912. lua_type(state, 2) == LUA_TNUMBER)
  913. {
  914. // Get parameter 1 off the stack.
  915. float param1 = (float)luaL_checknumber(state, 2);
  916. AnimationClip* instance = getInstance(state);
  917. instance->setSpeed(param1);
  918. return 0;
  919. }
  920. else
  921. {
  922. lua_pushstring(state, "lua_AnimationClip_setSpeed - Failed to match the given parameters to a valid function signature.");
  923. lua_error(state);
  924. }
  925. break;
  926. }
  927. default:
  928. {
  929. lua_pushstring(state, "Invalid number of parameters (expected 2).");
  930. lua_error(state);
  931. break;
  932. }
  933. }
  934. return 0;
  935. }
  936. int lua_AnimationClip_static_REPEAT_INDEFINITE(lua_State* state)
  937. {
  938. // Validate the number of parameters.
  939. if (lua_gettop(state) > 0)
  940. {
  941. lua_pushstring(state, "Invalid number of parameters (expected 0).");
  942. lua_error(state);
  943. }
  944. unsigned int result = AnimationClip::REPEAT_INDEFINITE;
  945. // Push the return value onto the stack.
  946. lua_pushunsigned(state, result);
  947. return 1;
  948. }
  949. int lua_AnimationClip_stop(lua_State* state)
  950. {
  951. // Get the number of parameters.
  952. int paramCount = lua_gettop(state);
  953. // Attempt to match the parameters to a valid binding.
  954. switch (paramCount)
  955. {
  956. case 1:
  957. {
  958. if ((lua_type(state, 1) == LUA_TUSERDATA))
  959. {
  960. AnimationClip* instance = getInstance(state);
  961. instance->stop();
  962. return 0;
  963. }
  964. else
  965. {
  966. lua_pushstring(state, "lua_AnimationClip_stop - Failed to match the given parameters to a valid function signature.");
  967. lua_error(state);
  968. }
  969. break;
  970. }
  971. default:
  972. {
  973. lua_pushstring(state, "Invalid number of parameters (expected 1).");
  974. lua_error(state);
  975. break;
  976. }
  977. }
  978. return 0;
  979. }
  980. }