tool extends Sprite class_name TK_FittingSprite ## A Sprite that is resized to absolute pixel size, no matter the texture. const NO_SIZE_SENTINEL = Vector2(-1, -1) export var target_size: Vector2 = NO_SIZE_SENTINEL setget _set_target_size # todo: Ask context about preferred sizing if there's any. func _enter_tree() -> void: if target_size == NO_SIZE_SENTINEL: self.target_size = texture.get_size() func _set_target_size(p_size: Vector2) -> void: target_size = p_size _update_scale() func _update_scale() -> void: scale = target_size / texture.get_size()