CompositeSprite_ScriptBinding.h 49 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203
  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. ConsoleMethod(CompositeSprite, addSprite, S32, 2, 3, "( [a] [b] [c] [d] [e] [f] ) - Adds a sprite at the specified logical position.\n"
  23. "You must specify the correct number of arguments for the selected layout mode.\n"
  24. "The created sprite will be automatically selected.\n"
  25. "@param a b c d e f Logical positions #1 & #2 and four additional and optional arguments.\n"
  26. "@return The batch Id of the added sprite or zero if not successful." )
  27. {
  28. if ( argc == 2 )
  29. return object->addSprite( SpriteBatchItem::LogicalPosition() );
  30. else
  31. return object->addSprite( SpriteBatchItem::LogicalPosition(argv[2]) );
  32. }
  33. //-----------------------------------------------------------------------------
  34. ConsoleMethod(CompositeSprite, removeSprite, bool, 2, 2, "() - Removes the selected sprite.\n"
  35. "@return Whether the sprite was removed or not." )
  36. {
  37. return object->removeSprite();
  38. }
  39. //-----------------------------------------------------------------------------
  40. ConsoleMethod(CompositeSprite, clearSprites, void, 2, 2, "() - Removes all sprites.\n"
  41. "@return No return value." )
  42. {
  43. return object->clearSprites();
  44. }
  45. //-----------------------------------------------------------------------------
  46. ConsoleMethod(CompositeSprite, getSpriteCount, S32, 2, 2, "() - Gets a count of sprites in the composite.\n"
  47. "@return The count of sprites in the composite." )
  48. {
  49. return object->getSpriteCount();
  50. }
  51. //-----------------------------------------------------------------------------
  52. ConsoleMethod(CompositeSprite, setBatchLayout, void, 3, 3, "(batchLayoutType) - Sets the batch layout type.\n"
  53. "The render sort mode is used when isolated batch mode is on.\n"
  54. "@param batchLayoutType 'none', 'rect' or 'iso' layout types are valid.\n"
  55. "@return No return value." )
  56. {
  57. // Fetch the batch layout type/
  58. CompositeSprite::BatchLayoutType batchLayoutType = CompositeSprite::getBatchLayoutTypeEnum( argv[2] );
  59. // Sanity!
  60. if ( batchLayoutType == CompositeSprite::INVALID_LAYOUT )
  61. {
  62. // Warn.
  63. Con::warnf( "CompositeSprite::setBatchLayout() - Unknown batch layout type of '%s'.", argv[2] );
  64. return;
  65. }
  66. object->setBatchLayout( batchLayoutType );
  67. }
  68. //-----------------------------------------------------------------------------
  69. ConsoleMethod(CompositeSprite, getBatchLayout, const char*, 2, 2, "() - Gets the batch layout type.\n"
  70. "@return The batch layout type." )
  71. {
  72. return CompositeSprite::getBatchLayoutTypeDescription( object->getBatchLayout() );
  73. }
  74. //-----------------------------------------------------------------------------
  75. ConsoleMethod(CompositeSprite, setBatchIsolated, void, 3, 3, "(bool batchIsolated) - Sets whether the sprites are rendered, isolated from other renderings as one batch or not.\n"
  76. "When in batch isolated mode, the sprites can be optionally sorted.\n"
  77. "@return No return value." )
  78. {
  79. // Fetch batch isolated.
  80. const bool batchIsolated = dAtob(argv[2]);
  81. object->setBatchIsolated( batchIsolated );
  82. }
  83. //-----------------------------------------------------------------------------
  84. ConsoleMethod(CompositeSprite, getBatchIsolated, bool, 2, 2, "() - Gets whether the sprites are rendered, isolated from other renderings as one batch or not.\n"
  85. "@return Whether the sprites are rendered, isolated from other renderings as one batch or not." )
  86. {
  87. return object->getBatchIsolated();
  88. }
  89. //-----------------------------------------------------------------------------
  90. ConsoleMethod(CompositeSprite, setBatchCulling, void, 3, 3, "(bool batchCulling) - Sets whether the sprites are culled.\n"
  91. "For sprites that are off-screen this is considerably faster during render at the expense of memory.\n"
  92. "For small composites with a few sprites, the overhead is probably not worth it.\n"
  93. "@return No return value." )
  94. {
  95. // Fetch batch culling..
  96. const bool batchCulling = dAtob(argv[2]);
  97. STATIC_VOID_CAST_TO(CompositeSprite, SpriteBatch, object)->setBatchCulling( batchCulling );
  98. }
  99. //-----------------------------------------------------------------------------
  100. ConsoleMethod(CompositeSprite, getBatchCulling, bool, 2, 2, "() - Gets whether the sprites are render culled or not\n"
  101. "@return Whether the sprites are rendered culled or not." )
  102. {
  103. return object->getBatchCulling();
  104. }
  105. //-----------------------------------------------------------------------------
  106. ConsoleMethod(CompositeSprite, setBatchSortMode, void, 3, 3, "(renderSortMode) - Sets the batch render sort mode.\n"
  107. "The render sort mode is used when isolated batch mode is on.\n"
  108. "@return No return value." )
  109. {
  110. // Fetch render sort mode.
  111. SceneRenderQueue::RenderSort batchSortMode = SceneRenderQueue::getRenderSortEnum( argv[2] );
  112. // Sanity!
  113. if ( batchSortMode == SceneRenderQueue::RENDER_SORT_INVALID )
  114. {
  115. // Warn.
  116. Con::warnf( "CompositeSprite::setBatchSortMode() - Unknown batch sort mode of '%s'.", argv[2] );
  117. return;
  118. }
  119. object->setBatchSortMode( batchSortMode );
  120. }
  121. //-----------------------------------------------------------------------------
  122. ConsoleMethod(CompositeSprite, getBatchSortMode, const char*, 2, 2, "() - Gets the batch render sort mode.\n"
  123. "@return The render sort mode." )
  124. {
  125. return SceneRenderQueue::getRenderSortDescription( object->getBatchSortMode() );
  126. }
  127. //-----------------------------------------------------------------------------
  128. ConsoleMethod(CompositeSprite, setDefaultSpriteStride, void, 3, 4, "(float strideX, [float strideY]]) - Sets the stride which scales the position at which sprites are created.\n"
  129. "@param strideX The default stride of the local X axis.\n"
  130. "@param strideY The default stride of the local Y axis.\n"
  131. "@return No return value.")
  132. {
  133. Vector2 stride;
  134. // Fetch element count.
  135. const U32 elementCount = Utility::mGetStringElementCount(argv[2]);
  136. // ("strideX strideY")
  137. if ( (elementCount == 2) && (argc == 3) )
  138. {
  139. stride.x = dAtof(Utility::mGetStringElement(argv[2], 0));
  140. stride.y = dAtof(Utility::mGetStringElement(argv[2], 1));
  141. }
  142. // (strideX, [strideY])
  143. else if (elementCount == 1)
  144. {
  145. stride.x = dAtof(argv[2]);
  146. if (argc > 3)
  147. stride.y = dAtof(argv[3]);
  148. else
  149. stride.y = stride.x;
  150. }
  151. // Invalid
  152. else
  153. {
  154. Con::warnf("CompositeSprite::setDefaultSpriteStride() - Invalid number of parameters!");
  155. return;
  156. }
  157. object->setDefaultSpriteStride( stride );
  158. }
  159. //-----------------------------------------------------------------------------
  160. ConsoleMethod(CompositeSprite, getDefaultSpriteStride, const char*, 2, 2, "() - Gets the stride which scales the position at which sprites are created.\n"
  161. "@return (float strideX/float strideY) The stride which scales the position at which sprites are created.")
  162. {
  163. return object->getDefaultSpriteStride().scriptThis();
  164. }
  165. //-----------------------------------------------------------------------------
  166. ConsoleMethod(CompositeSprite, setDefaultSpriteSize, void, 3, 4, "(float width, [float height]) - Sets the size at which sprites are created.\n"
  167. "@param width The default width of sprites.\n"
  168. "@param height The default height of sprites\n"
  169. "@return No return value.")
  170. {
  171. Vector2 size;
  172. // Fetch element count.
  173. const U32 elementCount = Utility::mGetStringElementCount(argv[2]);
  174. // ("width height")
  175. if ( (elementCount == 2) && (argc == 3) )
  176. {
  177. size.x = dAtof(Utility::mGetStringElement(argv[2], 0));
  178. size.y = dAtof(Utility::mGetStringElement(argv[2], 1));
  179. }
  180. // (width, [height])
  181. else if (elementCount == 1)
  182. {
  183. size.x = dAtof(argv[2]);
  184. if (argc > 3)
  185. size.y = dAtof(argv[3]);
  186. else
  187. size.y = size.x;
  188. }
  189. // Invalid
  190. else
  191. {
  192. Con::warnf("CompositeSprite::setDefaultSpriteSize() - Invalid number of parameters!");
  193. return;
  194. }
  195. object->setDefaultSpriteSize( size );
  196. }
  197. //-----------------------------------------------------------------------------
  198. ConsoleMethod(CompositeSprite, getDefaultSpriteSize, const char*, 2, 2, "() - Gets the size at which sprites are created.\n"
  199. "@return (float width/float height) The size at which sprites are created.")
  200. {
  201. return object->getDefaultSpriteSize().scriptThis();
  202. }
  203. //-----------------------------------------------------------------------------
  204. ConsoleMethod(CompositeSprite, setDefaultSpriteAngle, void, 3, 3, "(float angle) - Sets the angle at which sprites are created.\n"
  205. "@param angle The angle at which sprites are created.\n"
  206. "@return No return value.")
  207. {
  208. // Fetch angle.
  209. const F32 angle = mDegToRad( dAtof(argv[2]) );
  210. static_cast<SpriteBatch*>(object)->setDefaultSpriteAngle( angle );
  211. }
  212. //-----------------------------------------------------------------------------
  213. ConsoleMethod(CompositeSprite, getDefaultSpriteAngle, F32, 3, 3, "() - Gets the angle at which sprites are created.\n"
  214. "@return (float angle) The angle at which sprites are created.")
  215. {
  216. return mRadToDeg( static_cast<SpriteBatch*>(object)->getDefaultSpriteAngle() );
  217. }
  218. //-----------------------------------------------------------------------------
  219. ConsoleMethod(CompositeSprite, selectSprite, bool, 3, 3, "( a b [c] [d] [e] [f] ) - Selects a sprite at the specified logical position.\n"
  220. "@param a b c d e f Logical positions #1 & #2 and four additional and optional arguments.\n"
  221. "@return Whether the sprite was selected or not." )
  222. {
  223. return object->selectSprite( SpriteBatchItem::LogicalPosition(argv[2]) );
  224. }
  225. //-----------------------------------------------------------------------------
  226. ConsoleMethod(CompositeSprite, selectSpriteId, bool, 3, 3, "( int batchId ) - Selects a sprite with the specified batch Id.\n"
  227. "@param batchId The batch Id of the sprite to select.\n"
  228. "@return Whether the sprite was selected or not." )
  229. {
  230. return object->selectSpriteId( dAtoi(argv[2]) );
  231. }
  232. //-----------------------------------------------------------------------------
  233. ConsoleMethod(CompositeSprite, selectSpriteName, bool, 3, 3, "( name ) - Selects a sprite with the specified name.\n"
  234. "@param name The name of the sprite.\n"
  235. "@return Whether the sprite was selected or not." )
  236. {
  237. return object->selectSpriteName( argv[2] );
  238. }
  239. //-----------------------------------------------------------------------------
  240. ConsoleMethod(CompositeSprite, deselectSprite, void, 2, 2, "() - Deselects any selected sprite.\n"
  241. "This is not required but can be used to stop accidental changes to sprites.\n"
  242. "@return No return value." )
  243. {
  244. return object->deselectSprite();
  245. }
  246. //-----------------------------------------------------------------------------
  247. ConsoleMethod(CompositeSprite, isSpriteSelected, bool, 2, 2, "() - Checks whether a sprite is selected or not.\n"
  248. "@return Whether a sprite is selected or not." )
  249. {
  250. return object->isSpriteSelected();
  251. }
  252. //-----------------------------------------------------------------------------
  253. ConsoleMethod(CompositeSprite, setSpriteImage, void, 3, 4, "(imageAssetId, [int imageFrame]) - Sets the sprite image and optional frame.\n"
  254. "@param imageAssetId The image to set the sprite to.\n"
  255. "@param imageFrame The image frame of the imageAssetId to set the sprite to.\n"
  256. "@return No return value." )
  257. {
  258. // Fetch frame.
  259. const U32 frame = argc >=4 ? dAtoi(argv[3]) : 0;
  260. object->setSpriteImage( argv[2], frame );
  261. }
  262. //-----------------------------------------------------------------------------
  263. ConsoleMethod(CompositeSprite, getSpriteImage, const char*, 2, 2, "() - Gets the sprite image.\n"
  264. "@return The sprite image." )
  265. {
  266. return object->getSpriteImage();
  267. }
  268. //-----------------------------------------------------------------------------
  269. ConsoleMethod(CompositeSprite, setSpriteImageFrame, void, 3, 3, "(int imageFrame) - Sets the sprite image frame.\n"
  270. "@param imageFrame The image frame to set the sprite to.\n"
  271. "@return No return value." )
  272. {
  273. // Fetch frame.
  274. const U32 frame = dAtoi(argv[2]);
  275. object->setSpriteImageFrame( frame );
  276. }
  277. //-----------------------------------------------------------------------------
  278. ConsoleMethod(CompositeSprite, getSpriteImageFrame, S32, 2, 2, "() - Gets the sprite image frame.\n"
  279. "@return The sprite image frame." )
  280. {
  281. return object->getSpriteImageFrame();
  282. }
  283. //-----------------------------------------------------------------------------
  284. ConsoleMethod(CompositeSprite, setSpriteAnimation, void, 3, 4, "(animationAssetId) - Sets the sprite animation.\n"
  285. "@param imageAssetId The animation to set the sprite to.\n"
  286. "@return No return value." )
  287. {
  288. object->setSpriteAnimation( argv[2] );
  289. }
  290. //-----------------------------------------------------------------------------
  291. ConsoleMethod(CompositeSprite, getSpriteAnimation, const char*, 2, 2, "() - Gets the sprite animation.\n"
  292. "@return The sprite animation." )
  293. {
  294. return object->getSpriteAnimation();
  295. }
  296. //-----------------------------------------------------------------------------
  297. ConsoleMethod(CompositeSprite, clearSpriteAsset, void, 2, 2, "() - Clears any image or animation asset from the sprite.\n"
  298. "@return No return value." )
  299. {
  300. return object->clearSpriteAsset();
  301. }
  302. //-----------------------------------------------------------------------------
  303. ConsoleMethod(CompositeSprite, setSpriteVisible, void, 3, 3, "(bool visible) - Sets whether the sprite is visible or not.\n"
  304. "@param visible Whether the sprite is visible or not.\n"
  305. "@return No return value." )
  306. {
  307. // Fetch visible.
  308. const bool visible = dAtob(argv[2]);
  309. object->setSpriteVisible( visible );
  310. }
  311. //-----------------------------------------------------------------------------
  312. ConsoleMethod(CompositeSprite, getSpriteVisible, bool, 2, 2, "() - Gets whether the sprite is visible or not.\n"
  313. "@return Whether the sprite is visible or not." )
  314. {
  315. return object->getSpriteVisible();
  316. }
  317. //-----------------------------------------------------------------------------
  318. ConsoleMethod(CompositeSprite, setSpriteLocalPosition, void, 3, 4, "(float localX, float localY) - Sets the sprites local position.\n"
  319. "@param localX The local position X.\n"
  320. "@param localY The local position Y.\n"
  321. "@return No return value." )
  322. {
  323. Vector2 localPosition;
  324. // Fetch element count.
  325. const U32 elementCount = Utility::mGetStringElementCount(argv[2]);
  326. // ("x y")
  327. if ( (elementCount == 2) && (argc == 3) )
  328. {
  329. localPosition.x = dAtof(Utility::mGetStringElement(argv[2], 0));
  330. localPosition.y = dAtof(Utility::mGetStringElement(argv[2], 1));
  331. }
  332. // (x, y)
  333. else if ( elementCount == 1 && (argc > 3) )
  334. {
  335. localPosition.x = dAtof(argv[2]);
  336. localPosition.y = dAtof(argv[3]);
  337. }
  338. // Invalid
  339. else
  340. {
  341. Con::warnf("CompositeSprite::setSpriteLocalPosition() - Invalid number of parameters!");
  342. return;
  343. }
  344. object->setSpriteLocalPosition( localPosition );
  345. }
  346. //-----------------------------------------------------------------------------
  347. ConsoleMethod(CompositeSprite, getSpriteLocalPosition, const char*, 2, 2, "() - Gets the sprite local position.\n"
  348. "@return The sprite local position." )
  349. {
  350. return object->getSpriteLocalPosition().scriptThis();
  351. }
  352. //-----------------------------------------------------------------------------
  353. ConsoleMethod(CompositeSprite, setSpriteAngle, void, 3, 3, "(float localAngle) - Sets the sprites local angle.\n"
  354. "@param localAngle The sprite local angle.\n"
  355. "@return No return value." )
  356. {
  357. // Fetch angle.
  358. const F32 angle = mDegToRad( dAtof(argv[2]) );
  359. object->setSpriteAngle( angle );
  360. }
  361. //-----------------------------------------------------------------------------
  362. ConsoleMethod(CompositeSprite, getSpriteAngle, F32, 2, 2, "() - Gets the sprite local angle.\n"
  363. "@return The sprite local angle." )
  364. {
  365. return mRadToDeg( object->getSpriteAngle() );
  366. }
  367. //-----------------------------------------------------------------------------
  368. ConsoleMethod(CompositeSprite, setSpriteDepth, void, 3, 3, "(float depth) - Sets the sprites depth.\n"
  369. "@param depth The sprite depth.\n"
  370. "@return No return value." )
  371. {
  372. // Fetch depth.
  373. const F32 depth = dAtof(argv[2]);
  374. object->setSpriteDepth( depth );
  375. }
  376. //-----------------------------------------------------------------------------
  377. ConsoleMethod(CompositeSprite, getSpriteDepth, F32, 2, 2, "() - Gets the sprite depth.\n"
  378. "@return The sprite depth." )
  379. {
  380. return object->getSpriteDepth();
  381. }
  382. //-----------------------------------------------------------------------------
  383. ConsoleMethod(CompositeSprite, setSpriteSize, void, 3, 4, "(float width, [float height]) - Sets the sprite size.\n"
  384. "@param width The sprite width.\n"
  385. "@param height The sprite height\n"
  386. "@return No return value.")
  387. {
  388. Vector2 size;
  389. // Fetch element count.
  390. const U32 elementCount = Utility::mGetStringElementCount(argv[2]);
  391. // ("width height")
  392. if ( (elementCount == 2) && (argc == 3) )
  393. {
  394. size.x = dAtof(Utility::mGetStringElement(argv[2], 0));
  395. size.y = dAtof(Utility::mGetStringElement(argv[2], 1));
  396. }
  397. // (width, [height])
  398. else if (elementCount == 1)
  399. {
  400. size.x = dAtof(argv[2]);
  401. if (argc > 3)
  402. size.y = dAtof(argv[3]);
  403. else
  404. size.y = size.x;
  405. }
  406. // Invalid
  407. else
  408. {
  409. Con::warnf("CompositeSprite::setSpriteSize() - Invalid number of parameters!");
  410. return;
  411. }
  412. object->setSpriteSize( size );
  413. }
  414. //-----------------------------------------------------------------------------
  415. ConsoleMethod(CompositeSprite, getSpriteSize, const char*, 2, 2, "() - Gets the sprite size.\n"
  416. "@return (float width/float height) The sprite size.")
  417. {
  418. return object->getSpriteSize().scriptThis();
  419. }
  420. //-----------------------------------------------------------------------------
  421. ConsoleMethod(CompositeSprite, setSpriteFlipX, void, 3, 3, "(bool flipX) - Sets whether the sprite is flipped along its local X axis or not.\n"
  422. "@param flipX Whether the sprite is flipped along its local X axis or not.\n"
  423. "@return No return value." )
  424. {
  425. // Fetch flipX.
  426. const bool flipX = dAtob(argv[2]);
  427. object->setSpriteFlipX( flipX );
  428. }
  429. //-----------------------------------------------------------------------------
  430. ConsoleMethod(CompositeSprite, getSpriteFlipX, bool, 2, 2, "() - Gets whether the sprite is flipped along its local X axis or not.\n"
  431. "@return Whether the sprite is flipped along its local X axis or not." )
  432. {
  433. return object->getSpriteFlipX();
  434. }
  435. //-----------------------------------------------------------------------------
  436. ConsoleMethod(CompositeSprite, setSpriteFlipY, void, 3, 3, "(bool flipY) - Sets whether the sprite is flipped along its local Y axis or not.\n"
  437. "@param flipY Whether the sprite is flipped along its local Y axis or not.\n"
  438. "@return No return value." )
  439. {
  440. const bool flipY = dAtob(argv[2]);
  441. object->setSpriteFlipY( flipY );
  442. }
  443. //-----------------------------------------------------------------------------
  444. ConsoleMethod(CompositeSprite, getSpriteFlipY, bool, 2, 2, "() - Gets whether the sprite is flipped along its local Y axis or not.\n"
  445. "@return Whether the sprite is flipped along its local Y axis or not." )
  446. {
  447. return object->getSpriteFlipY();
  448. }
  449. //-----------------------------------------------------------------------------
  450. ConsoleMethod(CompositeSprite, setSpriteSortPoint, void, 3, 4, "(float localX, float localY) - Sets the sprites sort point.\n"
  451. "@param localX The local sort point X.\n"
  452. "@param localY The local sort point Y.\n"
  453. "@return No return value." )
  454. {
  455. Vector2 sortPoint;
  456. // Fetch element count.
  457. const U32 elementCount = Utility::mGetStringElementCount(argv[2]);
  458. // ("x y")
  459. if ( (elementCount == 2) && (argc == 3) )
  460. {
  461. sortPoint.x = dAtof(Utility::mGetStringElement(argv[2], 0));
  462. sortPoint.y = dAtof(Utility::mGetStringElement(argv[2], 1));
  463. }
  464. // (x, y)
  465. else if ( elementCount == 1 && (argc > 3) )
  466. {
  467. sortPoint.x = dAtof(argv[2]);
  468. sortPoint.y = dAtof(argv[3]);
  469. }
  470. // Invalid
  471. else
  472. {
  473. Con::warnf("CompositeSprite::setSpriteSortPoint() - Invalid number of parameters!");
  474. return;
  475. }
  476. object->setSpriteSortPoint( sortPoint );
  477. }
  478. //-----------------------------------------------------------------------------
  479. ConsoleMethod(CompositeSprite, getSpriteSortPoint, const char*, 2, 2, "() - Gets the sprite local sort point.\n"
  480. "@return The sprite local sort point." )
  481. {
  482. return object->getSpriteSortPoint().scriptThis();
  483. }
  484. //-----------------------------------------------------------------------------
  485. ConsoleMethod(CompositeSprite, setSpriteRenderGroup, void, 3, 3, "(renderGroup) Sets the name of the render group used to sort the sprite during rendering.\n"
  486. "@param renderGroup The name of the render group to use. Defaults to nothing.\n"
  487. "@return No return value.")
  488. {
  489. object->setSpriteRenderGroup( argv[2] );
  490. }
  491. //-----------------------------------------------------------------------------
  492. ConsoleMethod(CompositeSprite, getSpriteRenderGroup, const char*, 2, 2, "() Gets the name of the render group used to sort the sprite during rendering.\n"
  493. "@return The render group used to sort the object during rendering.")
  494. {
  495. return object->getSpriteRenderGroup();
  496. }
  497. //-----------------------------------------------------------------------------
  498. ConsoleMethod(CompositeSprite, setSpriteBlendMode, void, 3, 3, "(bool blendMode) - Sets whether sprite blending is on or not.\n"
  499. "@blendMode Whether sprite blending is on or not.\n"
  500. "@return No return Value.")
  501. {
  502. // Fetch blend mode.
  503. const bool blendMode = dAtob(argv[2]);
  504. object->setSpriteBlendMode( blendMode );
  505. }
  506. //-----------------------------------------------------------------------------
  507. ConsoleMethod(CompositeSprite, getSpriteBlendMode, bool, 2, 2, "() - Gets whether sprite blending is on or not.\n"
  508. "@return (bool blendMode) Whether sprite blending is on or not.")
  509. {
  510. return object->getSpriteBlendMode();
  511. }
  512. //-----------------------------------------------------------------------------
  513. ConsoleMethod(CompositeSprite, setSpriteSrcBlendFactor, void, 3, 3, "(srcBlend) - Sets the sprite source blend factor.\n"
  514. "@param srcBlend The sprite source blend factor.\n"
  515. "@return No return Value.")
  516. {
  517. // Fetch source blend factor.
  518. GLenum blendFactor = SceneObject::getSrcBlendFactorEnum(argv[2]);
  519. object->setSpriteSrcBlendFactor( blendFactor );
  520. }
  521. //-----------------------------------------------------------------------------
  522. ConsoleMethod(CompositeSprite, getSpriteSrcBlendFactor, const char*, 2, 2, "() - Gets the sprite source blend factor.\n"
  523. "@return (srcBlend) The sprite source blend factor.")
  524. {
  525. return SceneObject::getSrcBlendFactorDescription( object->getSpriteSrcBlendFactor() );
  526. }
  527. //-----------------------------------------------------------------------------
  528. ConsoleMethod(CompositeSprite, setSpriteDstBlendFactor, void, 3, 3, "(dstBlend) - Sets the sprite destination blend factor.\n"
  529. "@param dstBlend The sprite destination blend factor.\n"
  530. "@return No return Value.")
  531. {
  532. // Fetch destination blend factor.
  533. GLenum blendFactor = SceneObject::getDstBlendFactorEnum(argv[2]);
  534. object->setSpriteDstBlendFactor( blendFactor );
  535. }
  536. //-----------------------------------------------------------------------------
  537. ConsoleMethod(CompositeSprite, getSpriteDstBlendFactor, const char*, 2, 2, "() - Gets the sprite destination blend factor.\n"
  538. "@return (dstBlend) The sprite destination blend factor.")
  539. {
  540. return SceneObject::getDstBlendFactorDescription( object->getSpriteDstBlendFactor() );
  541. }
  542. //-----------------------------------------------------------------------------
  543. ConsoleMethod(CompositeSprite, setSpriteBlendColor, void, 3, 6, "(float red, float green, float blue, [float alpha = 1.0]) or ( stockColorName ) - Sets the sprite blend color."
  544. "@param red The red value.\n"
  545. "@param green The green value.\n"
  546. "@param blue The blue value.\n"
  547. "@param alpha The alpha value.\n"
  548. "@return No return Value.")
  549. {
  550. // The colors.
  551. F32 red;
  552. F32 green;
  553. F32 blue;
  554. F32 alpha = 1.0f;
  555. // Space separated.
  556. if (argc == 3 )
  557. {
  558. // Grab the element count.
  559. const U32 elementCount = Utility::mGetStringElementCount(argv[2]);
  560. // Has a single argument been specified?
  561. if ( elementCount == 1 )
  562. {
  563. // Is a sprite selected?
  564. if ( !object->isSpriteSelected() )
  565. {
  566. // No, so warn.
  567. Con::warnf("CompositeSprite::setSpriteBlendColor() - Cannot set sprite blend color as no sprite is selected." );
  568. return;
  569. }
  570. Con::setData( TypeColorF, &const_cast<ColorF&>(object->getSpriteBlendColor()), 0, 1, &(argv[2]) );
  571. return;
  572. }
  573. // ("R G B [A]")
  574. if ((elementCount == 3) || (elementCount == 4))
  575. {
  576. // Extract the color.
  577. red = dAtof(Utility::mGetStringElement(argv[2], 0));
  578. green = dAtof(Utility::mGetStringElement(argv[2], 1));
  579. blue = dAtof(Utility::mGetStringElement(argv[2], 2));
  580. // Grab the alpha if it's there.
  581. if (elementCount > 3)
  582. alpha = dAtof(Utility::mGetStringElement(argv[2], 3));
  583. }
  584. // Invalid.
  585. else
  586. {
  587. Con::warnf("SceneObject::setBlendColor() - Invalid Number of parameters!");
  588. return;
  589. }
  590. }
  591. // (R, G, B)
  592. else if (argc >= 5)
  593. {
  594. red = dAtof(argv[2]);
  595. green = dAtof(argv[3]);
  596. blue = dAtof(argv[4]);
  597. // Grab the alpha if it's there.
  598. if (argc > 5)
  599. alpha = dAtof(argv[5]);
  600. }
  601. // Invalid.
  602. else
  603. {
  604. Con::warnf("SceneObject::setBlendColor() - Invalid Number of parameters!");
  605. return;
  606. }
  607. // Set blend color.
  608. object->setSpriteBlendColor(ColorF(red, green, blue, alpha));
  609. }
  610. //-----------------------------------------------------------------------------
  611. ConsoleMethod(CompositeSprite, getSpriteBlendColor, const char*, 2, 3, "(allowColorNames) Gets the sprite blend color\n"
  612. "@param allowColorNames Whether to allow stock color names to be returned or not. Optional: Defaults to false.\n"
  613. "@return (float red / float green / float blue / float alpha) The sprite blend color.")
  614. {
  615. // Get Blend color.
  616. ColorF blendColor = object->getSpriteBlendColor();
  617. // Fetch allow color names flag.
  618. const bool allowColorNames = (argc > 2) ? dAtob(argv[2] ) : false;
  619. // Are color names allowed?
  620. if ( allowColorNames )
  621. {
  622. // Yes, so fetch the field value.
  623. return Con::getData( TypeColorF, &blendColor, 0 );
  624. }
  625. // No, so fetch the raw color values.
  626. return blendColor.scriptThis();
  627. }
  628. //-----------------------------------------------------------------------------
  629. ConsoleMethod(CompositeSprite, setSpriteBlendAlpha, void, 3, 3, "(float alpha) - Sets the sprite color alpha (transparency).\n"
  630. "The alpha value specifies directly the transparency of the image. A value of 1.0 will not affect the object and a value of 0.0 will make the object completely transparent.\n"
  631. "@param alpha The alpha value.\n"
  632. "@return No return Value.")
  633. {
  634. object->setSpriteBlendAlpha( dAtof(argv[2]) );
  635. }
  636. //-----------------------------------------------------------------------------
  637. ConsoleMethod(CompositeSprite, getSpriteBlendAlpha, F32, 2, 2, "() - Gets the sprite color alpha (transparency).\n"
  638. "@return (float alpha) The alpha value, a range from 0.0 to 1.0. Less than zero if alpha testing is disabled.")
  639. {
  640. return object->getSpriteBlendAlpha();
  641. }
  642. //-----------------------------------------------------------------------------
  643. ConsoleMethod(CompositeSprite, setSpriteAlphaTest, void, 3, 3, "(float alpha) - Set the sprite alpha test.\n"
  644. "@param value Numeric value of 0.0 to 1.0 to turn on alpha testing. Less than zero to disable alpha testing."
  645. "@return No return Value.")
  646. {
  647. object->setSpriteAlphaTest(dAtof(argv[2]));
  648. }
  649. //-----------------------------------------------------------------------------
  650. ConsoleMethod(CompositeSprite, getSpriteAlphaTest, F32, 2, 2, "() - Gets the sprite alpha test.\n"
  651. "@return (S32) A value of 0 to 255 if alpha testing is enabled. <0 represents disabled alpha testing.")
  652. {
  653. return object->getSpriteAlphaTest();
  654. }
  655. //-----------------------------------------------------------------------------
  656. ConsoleMethod(CompositeSprite, setSpriteDataObject, void, 3, 3, "(object) - Set the sprite data object.\n"
  657. "NOTE: This object will be persisted alongside the composite sprite.\n"
  658. "To clear the object you can pass an empty string.\n"
  659. "@return No return Value.")
  660. {
  661. object->setSpriteDataObject( Sim::findObject( argv[2] ) );
  662. }
  663. //-----------------------------------------------------------------------------
  664. ConsoleMethod(CompositeSprite, getSpriteDataObject, const char*, 2, 2, "() - Gets the sprite data object.\n"
  665. "@return The sprite data object.")
  666. {
  667. return object->getSpriteDataObject()->getIdString();
  668. }
  669. //-----------------------------------------------------------------------------
  670. ConsoleMethod(CompositeSprite, setSpriteName, void, 3, 3, "(name) - Set the sprite name.\n"
  671. "This must be unique within this composite sprite instance. To clear the name you can pass an empty string.\n"
  672. "@return No return Value.")
  673. {
  674. object->setSpriteName( argv[2] );
  675. }
  676. //-----------------------------------------------------------------------------
  677. ConsoleMethod(CompositeSprite, getSpriteName, const char*, 2, 2, "() - Gets the sprite name.\n"
  678. "@return The sprite name.")
  679. {
  680. return object->getSpriteName();
  681. }
  682. //-----------------------------------------------------------------------------
  683. ConsoleMethod(CompositeSprite, pickPoint, const char*, 3, 4, "(x / y ) Picks sprites intersecting the specified point with optional group/layer masks.\n"
  684. "@param x/y The coordinate of the point as either (\"x y\") or (x,y)\n"
  685. "@return Returns list of sprite Ids.")
  686. {
  687. // Fetch sprite batch query and clear results.
  688. SpriteBatchQuery* pSpriteBatchQuery = object->getSpriteBatchQuery( true );
  689. // Is the sprite batch query available?
  690. if ( pSpriteBatchQuery == NULL )
  691. {
  692. // No, so warn.
  693. Con::warnf( "CompositeSprite::pickPoint() - Cannot pick sprites if clipping mode is off." );
  694. // Return nothing.
  695. return NULL;
  696. }
  697. // The point.
  698. Vector2 point;
  699. // The index of the first optional parameter.
  700. U32 firstArg;
  701. // Grab the number of elements in the first parameter.
  702. U32 elementCount = Utility::mGetStringElementCount(argv[2]);
  703. // ("x y")
  704. if ((elementCount == 2) && (argc < 8))
  705. {
  706. point = Utility::mGetStringElementVector(argv[2]);
  707. firstArg = 3;
  708. }
  709. // (x, y)
  710. else if ((elementCount == 1) && (argc > 3))
  711. {
  712. point = Vector2(dAtof(argv[2]), dAtof(argv[3]));
  713. firstArg = 4;
  714. }
  715. // Invalid
  716. else
  717. {
  718. Con::warnf("CompositeSprite::pickPoint() - Invalid number of parameters!");
  719. return NULL;
  720. }
  721. // Fetch the render transform.
  722. const b2Transform& renderTransform = object->getRenderTransform();
  723. // Transform into local space.
  724. point = b2MulT( renderTransform, point );
  725. // Perform query.
  726. pSpriteBatchQuery->queryPoint( point, true );
  727. // Fetch result count.
  728. const U32 resultCount = pSpriteBatchQuery->getQueryResultsCount();
  729. // Finish if no results.
  730. if (resultCount == 0 )
  731. return NULL;
  732. // Fetch results.
  733. typeSpriteBatchQueryResultVector& queryResults = pSpriteBatchQuery->getQueryResults();
  734. // Set Max Buffer Size.
  735. const U32 maxBufferSize = 4096;
  736. // Create Returnable Buffer.
  737. char* pBuffer = Con::getReturnBuffer(maxBufferSize);
  738. // Set Buffer Counter.
  739. U32 bufferCount = 0;
  740. // Add picked sprites.
  741. for ( U32 n = 0; n < resultCount; n++ )
  742. {
  743. // Output Object ID.
  744. bufferCount += dSprintf( pBuffer + bufferCount, maxBufferSize-bufferCount, "%d ", queryResults[n].mpSpriteBatchItem->getBatchId() );
  745. // Finish early if we run out of buffer space.
  746. if ( bufferCount >= maxBufferSize )
  747. {
  748. // Warn.
  749. Con::warnf("CompositeSprite::pickPoint() - Too many items picked to return to scripts!");
  750. break;
  751. }
  752. }
  753. // Clear sprite batch query.
  754. pSpriteBatchQuery->clearQuery();
  755. // Return buffer.
  756. return pBuffer;
  757. }
  758. //-----------------------------------------------------------------------------
  759. ConsoleMethod(CompositeSprite, pickArea, const char*, 4, 6, "(startx/y, endx/y ) Picks sprites intersecting the specified area with optional group/layer masks.\n"
  760. "@param startx/y The coordinates of the start point as either (\"x y\") or (x,y)\n"
  761. "@param endx/y The coordinates of the end point as either (\"x y\") or (x,y)\n"
  762. "@return Returns list of sprite Ids.")
  763. {
  764. // Fetch sprite batch query and clear results.
  765. SpriteBatchQuery* pSpriteBatchQuery = object->getSpriteBatchQuery( true );
  766. // Is the sprite batch query available?
  767. if ( pSpriteBatchQuery == NULL )
  768. {
  769. // No, so warn.
  770. Con::warnf( "CompositeSprite::pickArea() - Cannot pick sprites if clipping mode is off." );
  771. // Return nothing.
  772. return NULL;
  773. }
  774. // Upper left and lower right bound.
  775. Vector2 v1, v2;
  776. // The index of the first optional parameter.
  777. U32 firstArg;
  778. // Grab the number of elements in the first two parameters.
  779. U32 elementCount1 = Utility::mGetStringElementCount(argv[2]);
  780. U32 elementCount2 = 1;
  781. if (argc > 3)
  782. elementCount2 = Utility::mGetStringElementCount(argv[3]);
  783. // ("x1 y1 x2 y2")
  784. if ((elementCount1 == 4) && (argc < 9))
  785. {
  786. v1 = Utility::mGetStringElementVector(argv[2]);
  787. v2 = Utility::mGetStringElementVector(argv[2], 2);
  788. firstArg = 3;
  789. }
  790. // ("x1 y1", "x2 y2")
  791. else if ((elementCount1 == 2) && (elementCount2 == 2) && (argc > 3) && (argc < 10))
  792. {
  793. v1 = Utility::mGetStringElementVector(argv[2]);
  794. v2 = Utility::mGetStringElementVector(argv[3]);
  795. firstArg = 4;
  796. }
  797. // (x1, y1, x2, y2)
  798. else if (argc > 5)
  799. {
  800. v1 = Vector2(dAtof(argv[2]), dAtof(argv[3]));
  801. v2 = Vector2(dAtof(argv[4]), dAtof(argv[5]));
  802. firstArg = 6;
  803. }
  804. // Invalid
  805. else
  806. {
  807. Con::warnf("CompositeSprite::pickArea() - Invalid number of parameters!");
  808. return NULL;
  809. }
  810. // Fetch the render transform.
  811. const b2Transform& renderTransform = object->getRenderTransform();
  812. // Translate into local space.
  813. v1 -= renderTransform.p;
  814. v2 -= renderTransform.p;
  815. // Calculate normalized AABB.
  816. b2AABB aabb;
  817. aabb.lowerBound.x = getMin( v1.x, v2.x );
  818. aabb.lowerBound.y = getMin( v1.y, v2.y );
  819. aabb.upperBound.x = getMax( v1.x, v2.x );
  820. aabb.upperBound.y = getMax( v1.y, v2.y );
  821. // Rotate the AABB into local space.
  822. CoreMath::mRotateAABB( aabb, -renderTransform.q.GetAngle(), aabb );
  823. // Perform query.
  824. pSpriteBatchQuery->queryArea( aabb, true );
  825. // Fetch result count.
  826. const U32 resultCount = pSpriteBatchQuery->getQueryResultsCount();
  827. // Finish if no results.
  828. if (resultCount == 0 )
  829. return NULL;
  830. // Fetch results.
  831. typeSpriteBatchQueryResultVector& queryResults = pSpriteBatchQuery->getQueryResults();
  832. // Set Max Buffer Size.
  833. const U32 maxBufferSize = 4096;
  834. // Create Returnable Buffer.
  835. char* pBuffer = Con::getReturnBuffer(maxBufferSize);
  836. // Set Buffer Counter.
  837. U32 bufferCount = 0;
  838. // Add picked objects.
  839. for ( U32 n = 0; n < resultCount; n++ )
  840. {
  841. // Output Object ID.
  842. bufferCount += dSprintf( pBuffer + bufferCount, maxBufferSize-bufferCount, "%d ", queryResults[n].mpSpriteBatchItem->getBatchId() );
  843. // Finish early if we run out of buffer space.
  844. if ( bufferCount >= maxBufferSize )
  845. {
  846. // Warn.
  847. Con::warnf("CompositeSprite::pickArea() - Too many items picked to return to scripts!");
  848. break;
  849. }
  850. }
  851. // Clear sprite batch query.
  852. pSpriteBatchQuery->clearQuery();
  853. // Return buffer.
  854. return pBuffer;
  855. }
  856. //-----------------------------------------------------------------------------
  857. ConsoleMethod(CompositeSprite, pickRay, const char*, 4, 6, "(startx/y, endx/y) Picks sprites intersecting the specified ray with optional group/layer masks.\n"
  858. "@param startx/y The coordinates of the start point as either (\"x y\") or (x,y)\n"
  859. "@param endx/y The coordinates of the end point as either (\"x y\") or (x,y)\n"
  860. "@return Returns list of sprite Ids")
  861. {
  862. // Fetch sprite batch query and clear results.
  863. SpriteBatchQuery* pSpriteBatchQuery = object->getSpriteBatchQuery( true );
  864. // Is the sprite batch query available?
  865. if ( pSpriteBatchQuery == NULL )
  866. {
  867. // No, so warn.
  868. Con::warnf( "CompositeSprite::pickRay() - Cannot pick sprites if clipping mode is off." );
  869. // Return nothing.
  870. return NULL;
  871. }
  872. // Upper left and lower right bound.
  873. Vector2 v1, v2;
  874. // The index of the first optional parameter.
  875. U32 firstArg;
  876. // Grab the number of elements in the first two parameters.
  877. U32 elementCount1 = Utility::mGetStringElementCount(argv[2]);
  878. U32 elementCount2 = 1;
  879. if (argc > 3)
  880. elementCount2 = Utility::mGetStringElementCount(argv[3]);
  881. // ("x1 y1 x2 y2")
  882. if ((elementCount1 == 4) && (argc < 9))
  883. {
  884. v1 = Utility::mGetStringElementVector(argv[2]);
  885. v2 = Utility::mGetStringElementVector(argv[2], 2);
  886. firstArg = 3;
  887. }
  888. // ("x1 y1", "x2 y2")
  889. else if ((elementCount1 == 2) && (elementCount2 == 2) && (argc > 3) && (argc < 10))
  890. {
  891. v1 = Utility::mGetStringElementVector(argv[2]);
  892. v2 = Utility::mGetStringElementVector(argv[3]);
  893. firstArg = 4;
  894. }
  895. // (x1, y1, x2, y2)
  896. else if (argc > 5)
  897. {
  898. v1 = Vector2(dAtof(argv[2]), dAtof(argv[3]));
  899. v2 = Vector2(dAtof(argv[4]), dAtof(argv[5]));
  900. firstArg = 6;
  901. }
  902. // Invalid
  903. else
  904. {
  905. Con::warnf("CompositeSprite::pickRay() - Invalid number of parameters!");
  906. return NULL;
  907. }
  908. // Fetch the render transform.
  909. const b2Transform& renderTransform = object->getRenderTransform();
  910. // Transform into local space.
  911. v1 = b2MulT( renderTransform, v1 );
  912. v2 = b2MulT( renderTransform, v2 );
  913. // Perform query.
  914. pSpriteBatchQuery->queryRay( v1, v2, true );
  915. // Sanity!
  916. AssertFatal( pSpriteBatchQuery->getIsRaycastQueryResult(), "Invalid non-ray-cast query result returned." );
  917. // Fetch result count.
  918. const U32 resultCount = pSpriteBatchQuery->getQueryResultsCount();
  919. // Finish if no results.
  920. if (resultCount == 0 )
  921. return NULL;
  922. // Sort ray-cast result.
  923. pSpriteBatchQuery->sortRaycastQueryResult();
  924. // Fetch results.
  925. typeSpriteBatchQueryResultVector& queryResults = pSpriteBatchQuery->getQueryResults();
  926. // Set Max Buffer Size.
  927. const U32 maxBufferSize = 4096;
  928. // Create Returnable Buffer.
  929. char* pBuffer = Con::getReturnBuffer(maxBufferSize);
  930. // Set Buffer Counter.
  931. U32 bufferCount = 0;
  932. // Add Picked Objects to List.
  933. for ( U32 n = 0; n < resultCount; n++ )
  934. {
  935. // Output Object ID.
  936. bufferCount += dSprintf( pBuffer + bufferCount, maxBufferSize-bufferCount, "%d ", queryResults[n].mpSpriteBatchItem->getBatchId() );
  937. // Finish early if we run out of buffer space.
  938. if ( bufferCount >= maxBufferSize )
  939. {
  940. // Warn.
  941. Con::warnf("CompositeSprite::pickRay() - Too many items picked to return to scripts!");
  942. break;
  943. }
  944. }
  945. // Clear sprite batch query.
  946. pSpriteBatchQuery->clearQuery();
  947. // Return buffer.
  948. return pBuffer;
  949. }