ScriptSpot

Script

Sprite Render Script

By Slather · 2009-08-28

Version
0.7
Version requirement
Max 8+
Date updated
2010-08-08
Votes
22
Download
Download
Description

This script will render animations and pack them into a sprite sheet. It exports the image file, the animation frame data as an XML file, and optionally a heightmap.

Improvements and Bug Fixes (v0.7)

+ Render Lists use XML. (they work now)
+ Included an option to turn cropping off.
+ Config settings are now written and read in a consistent way. (now it works)
+ Border padding has been fixed.
+ Added an option in the viewer to toggle the frame borders


* See the readme for features and instructions. (its included with the script, too)

You can create "Data Points" (point helpers with custom attributes) and link them to your scene objects. These points' positions are raycast into frame coordinates and stored with the animation data in the exported file. This technique can be used to make complex, dynamically-assembled sprites in a game.

Additional Info

The zip contains a folder with 2 files: "SpriteRender.ms" and "Custom.ms". Just copy the folder into your "userscripts" directory and run from there. The script will create a config file (.txt) and a readme (.hmtl) in the "Sprite Render vX.X" folder. You may need to log-on as an administrator to run the script. In theory, because it's in the "userscripts" directory, you shouldn't need to.

Tags: sprite, sprites, sprite render

Comments (13)

Download links are gone

mabulsoud · 2020-07-10

Is there any way to get this script now that the links are broken? Anyone who has it mind sharing it?

Thank you

Great Tool

lightcube · 2011-12-21

You've got a great tool here. I just pulled it back out to share with a friend and noticed that there are still some errors:

The first time I run it I always get this error:

-- Error occurred in btn_save.pressed(); filename: C:\Program Files\Autodesk\3ds Max 2012\Scripts\Sprite Render v0.7\Sprite Render.ms; position: 34495; line: 1135
-- Frame:
-- depthmap: undefined
-- canvasbitmap: undefined
-- f: "C:\Users\Shawn\Documents\Vault\Demonstration\sceneassets\images\sprites\tp_melt.png"
-- roll_SpriteSheetViewer: undefined
>> MAXScript Rollout Handler Exception:
-- Unknown property: "canvasbitmap" in undefined <<

Also.. even though the docs mention installing it into userscripts, I still get an error when loading it from userscripts on a machine that hadn't previously run the script as admin. It appears that the docs file is hard-coded to come from the 3ds max root help.

lightcube · 2013-02-18

I returned to this script today using 3ds Max 2013... and I've got the same problems I posted last year. I did find a solution, though. Add this code to line 1134:

global roll_SpriteSheetViewer

Runtime Error

Slather · 2011-09-28

Ok, I've changed the script to use the "userscripts" directory and to not write the readme right away, only when accessed. If the readme can't write, the script won't break anymore. You can use the link on this page, or go to the website anyway.
- Matt

getting a wired error when running your script

ladman · 2011-09-26

I am new to 3ds max.i have the 2011 version. i opened your script and ran it. It cant create the readme file it needs so it wont run? do you know a solution to this problem.

I also sent you and email on this yesterday with the exact error message im geting. Here is the messae

--Runtime error: FileStream cannot create: C:\Program Files\Autodesk|3ds max 2011\scripts\Spriterenderv0.7readme.html

It also highlights this part of your code:

fn writeStringToFile str filename =
(
local f = openFile filename mode:"wt"
format "%" str to:f
close f
)

tortenazor · 2010-05-17

Hello,

I'm using an older encrypted version of this script which has several bugs, including the "render from file" option not working. It seems that the download domain has expired. Is there anyone kind enough to post the original unencrypted script ? I'd like to try to fix those bugs myself.

Thanks !

Waxmodeler · 2010-03-04

Excellent Script, it works with Max 8 and also the output is great for Unity3D. Coooool.

Michele71 · 2010-02-01

Good Script very, very useful :)

Slather · 2009-11-06

Version 0.6 is out, with many bug fixes! I've written a readme that has features, instructions, and tips for use.

fajar · 2009-08-30

Good script !! thank!!

SpookyCat · 2009-08-28

Very nice and handy script which works very well. Do have a small bug, if you delete the pivot object and then render the sheet it does the rendering and then errors with pivot deleted message, perhaps it should just not start, also the button label should change to show the object has been deleted.

Slather · 2009-08-28

Thank you SpookyCat :) I didn't test the encrypted version much before posting, and apparently a few things are broken. The bug you mentioned will be an easy fix (I just need to check to see if the object is deleted, and add a callback for the button label).

I'm going to rename the button 'pivot object' to 'origin object' because its really supposed to be the origin position of each frame. Also, an extra rollout is supposed to be added when you select a pivot, and allow you to change some export values.

I plan to write instructions, explain the render list and what it can store, and explain the available output values for export. Anyway, I should have an update soon.