1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 09:09:47 +00:00

Do not add an empty tile in the tilesets when loading a pxo file

This commit is contained in:
Emmanouil Papadeas 2024-12-06 15:19:19 +02:00
parent e5c7d46997
commit 65e907e1d2
2 changed files with 5 additions and 4 deletions

View file

@ -352,7 +352,7 @@ func deserialize(dict: Dictionary, zip_reader: ZIPReader = null, file: FileAcces
if dict.has("tilesets"):
for saved_tileset in dict["tilesets"]:
var tile_size = str_to_var("Vector2i" + saved_tileset.get("tile_size"))
var tileset := TileSetCustom.new(tile_size)
var tileset := TileSetCustom.new(tile_size, "", false)
tileset.deserialize(saved_tileset)
tilesets.append(tileset)
if dict.has("frames") and dict.has("layers"):

View file

@ -39,11 +39,12 @@ class Tile:
return times_used <= 0
func _init(_tile_size: Vector2i, _name := "") -> void:
func _init(_tile_size: Vector2i, _name := "", add_empty_tile := true) -> void:
tile_size = _tile_size
name = _name
var empty_image := Image.create_empty(tile_size.x, tile_size.y, false, Image.FORMAT_RGBA8)
tiles.append(Tile.new(empty_image))
if add_empty_tile:
var empty_image := Image.create_empty(tile_size.x, tile_size.y, false, Image.FORMAT_RGBA8)
tiles.append(Tile.new(empty_image))
## Adds a new [param image] as a tile to the tileset.