From 063ea04b4c451a91528ad5b8401f9fea637fe305 Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Wed, 17 Jun 2020 03:34:24 +0300 Subject: [PATCH] If imported image size is less than 100px, limit the max value of the spritesheet frames --- src/UI/Dialogs/PreviewDialog.gd | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/UI/Dialogs/PreviewDialog.gd b/src/UI/Dialogs/PreviewDialog.gd index bbb6043d5..1c92eec3f 100644 --- a/src/UI/Dialogs/PreviewDialog.gd +++ b/src/UI/Dialogs/PreviewDialog.gd @@ -13,6 +13,11 @@ onready var texture_rect : TextureRect = $VBoxContainer/CenterContainer/TextureR onready var spritesheet_options = $VBoxContainer/HBoxContainer/SpritesheetOptions +func _ready() -> void: + spritesheet_options.get_node("HorizontalFrames").max_value = min(spritesheet_options.get_node("HorizontalFrames").max_value, image.get_size().x) + spritesheet_options.get_node("VerticalFrames").max_value = min(spritesheet_options.get_node("VerticalFrames").max_value, image.get_size().y) + + func _on_PreviewDialog_about_to_show() -> void: var img_texture := ImageTexture.new() img_texture.create_from_image(image)