Redistribution and use in source and binary forms, with or withoutmodification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the <organization> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

------------------------------------------------------/* OTHER INFO------------------------------------------------------

It would be appreciate if the author could be informed to the use of the plugin/tool/code as to promote the usage of the plugin/tool/code. Any modifications done to the plugin/tool/code for improved functionality or stability would be welcome as keep building off a single plugin/tool/code allowing for more people to benefit, although this is not mandatory.

Bugs and feature requests to: Support@GeoffSamuel.com

------------------------------------------------------/* BUILD AND VERSION INFO------------------------------------------------------

Build date: 19/6/2010

Further features to be implemented: (build version 1.6)* remove deadzones and creation of xml sprite information sheet

Version History: (build version 1.2.4)* Added automaticly saving of images * Added saveing formulars* Added ablity to render out mulipul cameras onto a single sheet or seprately* Sped up with thanks to Jameson Thatcher

Version History: (build version 1.2)* User interface added* Code cleaned up, made more dynamic with frame skip* fixed bug causing frames to be out by 1 pixel* fixed bug causing frames to be rendered with a black border* Sped up with thanks to Jameson Thatcher

Version History: (build version 1.0)* was used in 2009 game High School Bruisical* hard coded skip frame function implemented* Basic render and placement* Project Started.

*/

--Function to parse the saving formular, takes the formular and the camera namefnFormular_TranslateformularcameraObj=(-- sets ups the tag namec="<Camera_Name>"

--look for the tag, if its not found, return the orginal text, otherwise replace the tag with the name of the camera objectp=findStringformularcif(p!=undefined)do(formular=replaceformularpc.countcameraObj)--return resultreturnformular)

--Main render sprite function. made into function so can be used with maxscriptfnRender_Sprite_sheetstartstopjumpcamera_arraymethodtobeoutputedoutpathoutname=(--new array to hold all the sprite sheets so to compile them all at the end.Sprite_Sheet= #()foroincamera_arraydo(--set up camera to render fromcaseoof("Top View":viewport.setType#view_top"Bottom View":viewport.setType#view_bottom"Right View":viewport.setType#view_right"Left View":viewport.setType#view_left"Front View":viewport.setType#view_front"Back View":viewport.setType#view_back"Perspective View":viewport.setType#view_persp_user"Orthographic View":viewport.setType#view_iso_userdefault:viewport.setCamera(execute("$'"+o+"'")))

--render off test image for hight and width infocomplete_sprite=rendervfb:falseheight=((temp=getBitmapInfocomplete_sprite)[4])width=((temp=getBitmapInfocomplete_sprite)[3])--calculate width of final imagecomplete_width=width*((stop-start)/jump+1)--new image with width and hight of final imagebittemp=bitmapcomplete_widthheight

--for loop to go through all the frames neededforq=1to(stop-start)/jump+1do(--sets the frame timesliderTime=(start+((q-1)*jump))--renderers frame and adds to arrayimg=rendervfb:false--put the complete_sprite in the top left hand cornorfory=0toheightdo(--temp_pixels = getPixels img [0,y] width setPixelsbittemp[(q-1)*width,y](getPixelsimg[0,y]width)))--add to sprite sheet array for use later in complieing them allappendSprite_Sheetbittemp

)--if wanting the sheet to be contain multpiul sheets or bothif(method>=2)do(--get height and widthheight=((temp=getBitmapInfoSprite_Sheet[1])[4])width=((temp=getBitmapInfoSprite_Sheet[1])[3])--calculate height of final imagecomplete_height=height*Sprite_Sheet.count--new image with width and hight of final imagebittemp=bitmapwidthcomplete_height--put the each of the sprites in the right hight placeforq=0toSprite_Sheet.count-1do(fory=0toheightdo(setPixelsbittemp[0,y+(height*q)](getPixelsSprite_Sheet[q+1][0,y]width)))--if the image isnt being saved automaticly, display it otherwise work out file name and save itif(tobeoutputed==true)then(bittemp.filename=outpath+"//"+(Formular_Translateoutname"Multiple_Camera")savebittemp)else(displaybittemp))-- if wanting to have sprite sheet sepreatly or bothif(method==1)or(method==3)do(fori=1toSprite_Sheet.countdo(--go though and work with each image in the sprite sheet arraybittemp=Sprite_Sheet[i]--if the image isnt being saved automaticly, display it otherwise work out file name and save itif(tobeoutputed==true)then(bittemp.filename=outpath+"//"+(Formular_Translateoutnamecamera_array[i])savebittemp)else(displaybittemp))))