sanity check for cell size update of tilemap that has no tiles to infer texture size from
This commit is contained in:
parent
6d920e47e7
commit
184e24365f
@ -32,6 +32,8 @@ func _enter_tree() -> void:
|
|||||||
func _update_cell_size(_p_old_cell_size: Vector2, p_new_cell_size: Vector2) -> 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.
|
# We're assuming that all tile textures are of same dimensions.
|
||||||
# todo: Diagnose mismatch by walking over all textures?
|
# 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()
|
var tileset_texture_size := tile_set.tile_get_texture(0).get_size()
|
||||||
scale = p_new_cell_size / tileset_texture_size
|
scale = p_new_cell_size / tileset_texture_size
|
||||||
cell_size = p_new_cell_size / scale
|
cell_size = p_new_cell_size / scale
|
||||||
|
Loading…
Reference in New Issue
Block a user