Spritify

add-ons
free

(Jason van Gumster) #1

Wrote a quick little add-on for the Ancient Beast folks that takes a rendered animation and creates a sprite sheet and/or an animated GIF based on the rendered frames.

A couple caveats:

  • The add-on assumes you’ve rendered a sequence of still images. It will not work if you’re rendering straight to a video file
  • The add-on also assumes that only the frames of your animation are in your render path. If other files are there, chances are good that you’ll get a pretty jacked-up sprite sheet
  • The add-on assumes that you have ImageMagick installed… specifically the montage tool. If you do not have ImageMagick installed, the script will likely vomit on you.

By default, if you enable this add-on, a sprite sheet and/or an animated GIF will be created automatically once your animation render job completes. Of course, there’s a Spritify panel in Render Properties where you can enable/disable this automatic feature and adjust a few other configuration options for your sprite sheet.

Have fun!


(CAukamp) #2

Wow, thanks!
I have just testet it and it saves a lot of time. No more manual stitching just a littlebit of camera animation. This thing ist just great for everyone who makes games.


(Jason van Gumster) #3

I’m glad you find it useful. Let me know if there are any additions to it that you’d like (or if you run into any problems).


(Lumpycow) #4

the installation section on the wiki page needs some updating… :wink:


(Jason van Gumster) #5

Oops! Good catch! Got a little cut/paste happy there. :stuck_out_tongue:


(CAukamp) #6

So, i have worked with it a little more. For animated characters the row option seems to work fine. On the other hand i often deal with static sprites. These spritesheets grow over time. If i now add a frame to the “animation” the generated spritesheet gets reorganized and i have to edit the code to fix it in the game.

I have looked at the addon code and found a way to organize the spritesheet by columns. This way new sprites just get added at the bottom of the image and the order of the previous frames is still ok

Here is what i changed:


        if scene.spritesheet.rows < 0:
            tileSetting = str(abs(scene.spritesheet.rows)) + "x"
        else:
            tileSetting = "x" + str(scene.spritesheet.rows)

        subprocess.call([
            "montage",
            scene.render.filepath + "*", #XXX Assumes the files in the render path are only for the rendered animation
            "-tile", tileSetting,
            "-geometry", str(scene.render.resolution_x) + "x" + str(scene.render.resolution_y) + "+0+0"

This way it works for me (ImageMagick 6.6.0-4 on Kubuntu). It is not a nice solution, but i failed at the interfacecode. Now i am just using a negative rowcount as collumsetting. Hope this helps.


(Jason van Gumster) #7

Your rationale makes a lot of sense. And I think I have a slightly more elegant UI solution. I’ll make a boolean property to toggle between rows and columns. I’ll try to add that a little bit later today.


(Jason van Gumster) #8

Sweet… updated to v0.3.0. Now there’s a toggle for swapping between a rowed configuration and a columned one. Direct link has been updated in the OP.


(razvanab) #9

I get an error maybe you can help me

http://img29.imageshack.us/img29/8153/spritesz.jpg


(Jason van Gumster) #10

It’s a bit hard to read the text in your error message, so I’ll just ask here: Do you have ImageMagick installed? Are you rendering to a sequence of still images (not a video format)?


(razvanab) #11

“higher resolution”
http://img832.imageshack.us/img832/1122/spritel.jpg

yes and yes


(razvanab) #12

i manage to make it work by rendering the animation and not pushing the generate sprite sheet first


(Jason van Gumster) #13

Ah, yes… that would be it. Was that not in usage instructions on the wiki?


(razvanab) #14

Yes it was but i had read it after i tried the script sorry for that


(Jason van Gumster) #15

Ah. Understood. I should probably see if I can find a way to prevent sprites from being made if there’s no render. Unfortunately, Blender barely knows whether or not it’s rendered before. :S


(Dread Knight) #16

Great addon! :slight_smile:


(Jason van Gumster) #17

Little update to v0.4.0

  • Added the ability to set X and Y offsets for spacing between tiles.
  • Added the ability to generate an animated GIF with the same settings as the spritesheet.
  • UI enhancements in the Spritify panel

Parent post updated with new direct link


(Jason van Gumster) #18

Just a quick note. This script has been updated to work with API changes since 2.66. It should work now with 2.67b and the code that’s in trunk currently.


(dusty_p_42) #19

Apologies for such a basic question, but how do you get Blender and Imagemagick to talk to each other? I have IM installed (the Windows binary release), but Blender still won’t let me enable Spritify. I’m getting the “Requires Imagemagick” warning. Thanks.

Blender: 2.68a
Spritify: 0.5
IM: 6.8.6 Win


(Jason van Gumster) #20

ImageMagick binary needs to be in the executable path. I don’t have a readily-available Windows machine for testing (might need to fire up a VM, I guess :)), but it should be pretty easy to solve.