ParticlePlayer_ScriptBinding.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) 2013 GarageGames, LLC
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to
  6. // deal in the Software without restriction, including without limitation the
  7. // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
  8. // sell copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  19. // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  20. // IN THE SOFTWARE.
  21. //-----------------------------------------------------------------------------
  22. ConsoleMethodGroupBeginWithDocs(ParticlePlayer, SceneObject)
  23. /*! Sets the particle asset Id to play.
  24. @param particleAssetId The particle asset Id to play.
  25. @return No return value.
  26. */
  27. ConsoleMethodWithDocs(ParticlePlayer, setParticleAsset, ConsoleVoid, 3, 3, (particleAssetId?))
  28. {
  29. object->setParticle( argv[2] );
  30. }
  31. //-----------------------------------------------------------------------------
  32. /*! Gets the particle asset Id.
  33. @return The particle asset Id.
  34. */
  35. ConsoleMethodWithDocs(ParticlePlayer, getParticleAsset, ConsoleString, 2, 2, ())
  36. {
  37. return object->getParticle();
  38. }
  39. //-----------------------------------------------------------------------------
  40. /*! Sets the distance from any camera when the particle player will become idle i.e. stop integrating and rendering.
  41. @param pauseDistance The distance from any camera when the particle player will become idle i.e. stop integrating and rendering.
  42. @return No return value.
  43. */
  44. ConsoleMethodWithDocs(ParticlePlayer, setCameraIdleDistance, ConsoleVoid, 3, 3, (idleDistance))
  45. {
  46. object->setCameraIdleDistance( dAtof(argv[2]) );
  47. }
  48. //-----------------------------------------------------------------------------
  49. /*! Gets the distance from any camera when the particle player will become idle i.e. stop integrating and rendering.
  50. @return The distance from any camera when the particle player will become idle i.e. stop integrating and rendering.
  51. */
  52. ConsoleMethodWithDocs(ParticlePlayer, getCameraIdleDistance, ConsoleFloat, 2, 2, ())
  53. {
  54. return object->getCameraIdleDistance();
  55. }
  56. //-----------------------------------------------------------------------------
  57. /*! Sets whether the intermediate world position, rotation, and size data points of particles between ticks are calculated.
  58. @return No return value.
  59. */
  60. ConsoleMethodWithDocs(ParticlePlayer, setParticleInterpolation, ConsoleVoid, 3, 3, (bool status))
  61. {
  62. object->setParticleInterpolation( dAtof(argv[2]) );
  63. }
  64. //-----------------------------------------------------------------------------
  65. /*! Gets whether the intermediate world position, rotation, and size data points of particles between ticks are calculated.
  66. @return (bool status) Whether interpolation is calculated or not.
  67. */
  68. ConsoleMethodWithDocs(ParticlePlayer, getParticleInterpolation, ConsoleFloat, 2, 2, ())
  69. {
  70. return object->getParticleInterpolation();
  71. }
  72. //-----------------------------------------------------------------------------
  73. /*! Sets the scale for the particle player emission rate.
  74. @param scale The scale for the particle player emission rate.
  75. @return No return value.
  76. */
  77. ConsoleMethodWithDocs(ParticlePlayer, setEmissionRateScale, ConsoleVoid, 3, 3, (scale))
  78. {
  79. object->setEmissionRateScale( dAtof(argv[2]) );
  80. }
  81. //-----------------------------------------------------------------------------
  82. /*! Gets the scale for the particle player emission rate.
  83. @return The scale for the particle player emission rate.
  84. */
  85. ConsoleMethodWithDocs(ParticlePlayer, getEmissionRateScale, ConsoleFloat, 2, 2, ())
  86. {
  87. return object->getEmissionRateScale();
  88. }
  89. //-----------------------------------------------------------------------------
  90. /*! Sets the scale for the particle player particle sizes.
  91. @param scale The scale for the particle player particle sizes.
  92. @return No return value.
  93. */
  94. ConsoleMethodWithDocs(ParticlePlayer, setSizeScale, ConsoleVoid, 3, 3, (scale))
  95. {
  96. object->setSizeScale( dAtof(argv[2]) );
  97. }
  98. //-----------------------------------------------------------------------------
  99. /*! Gets the scale for the particle player particle sizes.
  100. @return The scale for the particle player particle sizes.
  101. */
  102. ConsoleMethodWithDocs(ParticlePlayer, getSizeScale, ConsoleFloat, 2, 2, ())
  103. {
  104. return object->getSizeScale();
  105. }
  106. //-----------------------------------------------------------------------------
  107. /*! Sets the scale for the particle player forces.
  108. @param scale The scale for the particle player forces.
  109. @return No return value.
  110. */
  111. ConsoleMethodWithDocs(ParticlePlayer, setForceScale, ConsoleVoid, 3, 3, (scale))
  112. {
  113. object->setForceScale( dAtof(argv[2]) );
  114. }
  115. //-----------------------------------------------------------------------------
  116. /*! Gets the scale for the particle player forces.
  117. @return The scale for the particle player forces.
  118. */
  119. ConsoleMethodWithDocs(ParticlePlayer, getForceScale, ConsoleFloat, 2, 2, ())
  120. {
  121. return object->getForceScale();
  122. }
  123. //-----------------------------------------------------------------------------
  124. /*! Sets the scale for the particle player lifetimes.
  125. @param scale The scale for the particle player lifetimes.
  126. @return No return value.
  127. */
  128. ConsoleMethodWithDocs(ParticlePlayer, setTimeScale, void, 3, 3, (scale))
  129. {
  130. object->setTimeScale( dAtof(argv[2]) );
  131. }
  132. //-----------------------------------------------------------------------------
  133. /*! Gets the scale for the particle player particle lifetimes.
  134. @return The scale for the particle player lifetimes.
  135. */
  136. ConsoleMethodWithDocs(ParticlePlayer, getTimeScale, ConsoleFloat, 2, 2, ())
  137. {
  138. return object->getTimeScale();
  139. }
  140. //-----------------------------------------------------------------------------
  141. /*! Starts the particle player playing.
  142. @param resetParticles Whether to reset any existing particles before starting to play. Default is true.
  143. @return Returns true on success and false otherwise.
  144. */
  145. ConsoleMethodWithDocs(ParticlePlayer, play, ConsoleBool, 2, 3, ([resetParticles]))
  146. {
  147. // Fetch the reset-particle flag.
  148. const bool resetParticles = argc >= 3 ? dAtob(argv[2]) : true;
  149. return object->play( resetParticles );
  150. }
  151. //-----------------------------------------------------------------------------
  152. /*! Stops the Particle Effect.
  153. @param waitForParticles Whether or not the effect should wait until all of its particles have run their course, or just stop immediately and delete the particles (default true).
  154. @param killEffect Whether or not the effect should be deleted after it has stopped (default false).
  155. @return No return value.
  156. */
  157. ConsoleMethodWithDocs(ParticlePlayer, stop, ConsoleVoid, 2, 4, ([waitForParticles?, killEffect?]))
  158. {
  159. // Fetch the wait-for-particles flag.
  160. const bool waitForParticles = argc >= 3 ? dAtob(argv[2]) : true;
  161. // Fetch the kill-effect flag.
  162. const bool killEffect = argc >= 4 ? dAtob(argv[3]) : false;
  163. // Stop playing.
  164. object->stop( waitForParticles, killEffect );
  165. }
  166. //-----------------------------------------------------------------------------
  167. /*! Gets whether the particle player is playing or not.
  168. @return Whether the particle player is playing or not.
  169. */
  170. ConsoleMethodWithDocs(ParticlePlayer, getIsPlaying, ConsoleBool, 2, 2, ())
  171. {
  172. return object->getIsPlaying();
  173. }
  174. //-----------------------------------------------------------------------------
  175. /*! Sets whether the particle player is paused or not.
  176. @param paused Whether the particle player is paused or not.
  177. @return No return value.
  178. */
  179. ConsoleMethodWithDocs(ParticlePlayer, setPaused, ConsoleVoid, 3, 3, (paused?))
  180. {
  181. object->setPaused( dAtob(argv[2]) );
  182. }
  183. //-----------------------------------------------------------------------------
  184. /*! Gets whether the particle player is paused or not.
  185. @return Whether the particle player is paused or not.
  186. */
  187. ConsoleMethodWithDocs(ParticlePlayer, getPaused, ConsoleBool, 2, 2, ())
  188. {
  189. return object->getPaused();
  190. }
  191. //-----------------------------------------------------------------------------
  192. /*! Sets whether the specified particle emitter is paused or not.
  193. @param paused Whether the specified particle emitter is paused or not.
  194. @param emitterIndex The index of the emitter to modify.
  195. @return No return value.
  196. */
  197. ConsoleMethodWithDocs(ParticlePlayer, setEmitterPaused, ConsoleVoid, 4, 4, (paused, emitterIndex))
  198. {
  199. object->setEmitterPaused( dAtob(argv[2]), dAtoi(argv[3]) );
  200. }
  201. //-----------------------------------------------------------------------------
  202. /*! Gets whether the specified particle emitter is paused or not.
  203. @param emitterIndex The index of the emitter to modify.
  204. @return Whether the specified particle emitter is paused or not.
  205. */
  206. ConsoleMethodWithDocs(ParticlePlayer, getEmitterPaused, ConsoleBool, 3, 3, (emitterIndex))
  207. {
  208. return object->getEmitterPaused( dAtoi(argv[2]) );
  209. }
  210. //-----------------------------------------------------------------------------
  211. /*! Sets whether the specified particle emitter is visible or not.
  212. @param paused Whether the specified particle emitter is visible or not.
  213. @param emitterIndex The index of the emitter to modify.
  214. @return No return value.
  215. */
  216. ConsoleMethodWithDocs(ParticlePlayer, setEmitterVisible, ConsoleVoid, 4, 4, (visible, emitterIndex))
  217. {
  218. object->setEmitterVisible( dAtob(argv[2]), dAtoi(argv[3]) );
  219. }
  220. //-----------------------------------------------------------------------------
  221. /*! Gets whether the specified particle emitter is visible or not.
  222. @param emitterIndex The index of the emitter to modify.
  223. @return Whether the specified particle emitter is visible or not.
  224. */
  225. ConsoleMethodWithDocs(ParticlePlayer, getEmitterVisible, ConsoleBool, 3, 3, (emitterIndex))
  226. {
  227. return object->getEmitterVisible( dAtoi(argv[2]) );
  228. }
  229. ConsoleMethodGroupEndWithDocs(ParticlePlayer)