amethyst / sheep

Modular and lightweight spritesheet packer 🐑
Other
89 stars 12 forks source link

failed `expect` when finding finding anchor id, and bad packing results #1

Closed covercash2 closed 5 years ago

covercash2 commented 5 years ago

using the default CLI packer, i couldn't pack all my assets (just as a test). turns out it was failing a binary search because the Sprite Anchors weren't sorted. however, fixing that bug revealed another bug where the sprites were packed on top of another. example

torkleyy commented 5 years ago

Hey, thanks for the report! Would you like to submit your fix for the panic, so we can fix one after another?

covercash2 commented 5 years ago

I've got a fork with the fix, I'll submit it when I get home. it basically just turns the binary search into a dumb iterative search, but I thought that would be fine for a default packer.

covercash2 commented 5 years ago

the issue with the pictures overlapping is with the binning algorithm. i'm trying to figure out which one we're trying to implement here. if you could let me know it would be easier for me to spot.

my assumption right now is that this algorithm doesn't work for non-squares or possibly non-uniform sizes. for now, i'm going to try a different algorithm, just to see if i can get my own assets to work. down the road, it could be sheep could support a few different algorithms ¯\(ツ)

covercash2 commented 5 years ago

i found if i reverse the compare_area function so that it sorts from largest to smallest i can get a good result. i did remove one of the images, the font image, that was problematic, and now i don't have a copy of it, so there may still be a bug. i'm pretty sure, though, that we want to sort the sprites from largest to smallest.