chrishayesmu / Blender-Spritesheet-Renderer

MIT License
16 stars 4 forks source link

Export single frame PNGs #4

Closed adamscoble closed 3 years ago

adamscoble commented 3 years ago

Hi again Chris!

Not sure if this completely defeats the purpose of the plugin, but I'm wondering how difficult it would be to enable not atlassing the final output, and instead creating sequentially numbered sprites?

chrishayesmu commented 3 years ago

Hey Adam, sorry I didn't get to this earlier. The answer is this would actually be pretty easy, because the individual frames are already stored this way prior to being composed into a spritesheet. They're kept in a temporary folder that is deleted afterwards. I probably wouldn't output a JSON file in that case because it would be hard to make sense of though.

I've been pretty busy with baby stuff so I'm not sure when I might get a chance to do this, but if you're inclined to try, I'd be happy to give you a few pointers in the code.

adamscoble commented 3 years ago

Thanks for the reply Chris! Good to hear it's fairly simple. While I don't know Python, I'll have a dig around and see how far I can get! Haha.

adamscoble commented 3 years ago

Hey Chris, hope you're well! So I did have a go at this myself with no luck, and it turns out my friends who I thought were Python devs were actually Ruby devs! Haha. Is adding/opening up this functionality something you'd be interesting in doing as a short contract? (Depending on your interest, rates and availability of course! Zero pressure!)

chrishayesmu commented 3 years ago

Hey Adam! I appreciate the thought, but unfortunately, as I'm taking care of my daughter full time right now, I don't have room to take on any contract work currently.

I did think of a semi-hacky solution that might work for you though. Since Blender Spritesheet Renderer requires you to have ImageMagick installed, you can use ImageMagick to split up the spritesheet into its constituent images. Here's an example command I used for splitting up a spritesheet I have where the individual sprites are 128px by 270px:

magick.exe convert ./spritesheet.png -crop 128x270 sprite-%d.png

That'll give you image files sprite-0.png through sprite-n.png. (But note that you may need to make sure magick.exe is on your PATH first, or else provide the absolute path to it in the command.)

It feels a little silly to stitch all the frames together into a spritesheet, just to cut them apart again after, but hopefully this works for your scenario?

adamscoble commented 3 years ago

Sorry about the delayed response Chris. That's a good suggestion actually, thanks for that! I'll give it a try!