01-26-2018, 11:17 PM
(01-26-2018, 09:14 PM)mich_lloid Wrote: Now I have a strange bug, the script only works on somewhat square images. For example 640 x 320 image objects on right side won't be picked and on 640 x 320 objects on the bottom won't be picked. If I resize the images to 640 x 640 and "Layer to image size" all objects get picked. What am I doing wrong?
I don't know if this is the problem, but this specifically makes you script very hard to read (professionally, I would require you to fix this even if there were no bugs):
Code:
tile_rows = int(layer.width / tile_width)
tile_cols = int(layer.height / tile_height)
In other words, you are naming "rows" what is really "columns" and vice-versa. I assume this confuses you later in the code. Of course, on a square image you have the same number of either so the problem doesn't affect you.