sanity check for cell size update of tilemap that has no tiles to infer texture size from

This commit is contained in:
veclav talica 2023-11-26 04:21:49 +05:00
parent 6d920e47e7
commit 184e24365f

View File

@ -32,6 +32,8 @@ func _enter_tree() -> void:
func _update_cell_size(_p_old_cell_size: Vector2, p_new_cell_size: Vector2) -> void:
# We're assuming that all tile textures are of same dimensions.
# todo: Diagnose mismatch by walking over all textures?
if tile_set.get_tiles_ids().size() == 0:
return
var tileset_texture_size := tile_set.tile_get_texture(0).get_size()
scale = p_new_cell_size / tileset_texture_size
cell_size = p_new_cell_size / scale