1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +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"): if dict.has("tilesets"):
for saved_tileset in dict["tilesets"]: for saved_tileset in dict["tilesets"]:
var tile_size = str_to_var("Vector2i" + saved_tileset.get("tile_size")) 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) tileset.deserialize(saved_tileset)
tilesets.append(tileset) tilesets.append(tileset)
if dict.has("frames") and dict.has("layers"): if dict.has("frames") and dict.has("layers"):

View file

@ -39,9 +39,10 @@ class Tile:
return times_used <= 0 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 tile_size = _tile_size
name = _name name = _name
if add_empty_tile:
var empty_image := Image.create_empty(tile_size.x, tile_size.y, false, Image.FORMAT_RGBA8) var empty_image := Image.create_empty(tile_size.x, tile_size.y, false, Image.FORMAT_RGBA8)
tiles.append(Tile.new(empty_image)) tiles.append(Tile.new(empty_image))