mirror of
https://github.com/aseprite/aseprite.git
synced 2024-12-27 21:19:18 +00:00
[lua] Sprite:newTileset() uses sprite grid size by default (fix #4116)
This commit is contained in:
parent
bb60da8c60
commit
557b22a719
@ -625,7 +625,7 @@ int Sprite_newTileset(lua_State* L)
|
||||
tileset = Tileset::MakeCopyCopyingImages(reference);
|
||||
}
|
||||
else {
|
||||
Grid grid;
|
||||
Grid grid(sprite->gridBounds().size()); // Use sprite grid bounds by default
|
||||
int ntiles = 1;
|
||||
if (!lua_isnone(L, 2)) {
|
||||
if (auto g = may_get_obj<Grid>(L, 2)) {
|
||||
|
@ -310,3 +310,14 @@ do
|
||||
0, 0 })
|
||||
|
||||
end
|
||||
|
||||
-- Test that we use the sprite grid size by default to create new tilesets
|
||||
do
|
||||
local spr = Sprite(32, 32, ColorMode.INDEXED)
|
||||
local ts = spr:newTileset()
|
||||
assert(ts.grid.tileSize == Size(16, 16))
|
||||
|
||||
spr.gridBounds = Rectangle(1, 2, 3, 4)
|
||||
ts = spr:newTileset()
|
||||
assert(ts.grid.tileSize == Size(3, 4))
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user