Files
imagine-composer/run/main.gd

20 lines
528 B
GDScript

extends Control
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
%LoadImageButton.pressed.connect(show_image_load_dialog)
%LoadImageDialog.file_selected.connect(load_image)
func show_image_load_dialog():
%LoadImageDialog.visible = true
func load_image(path: String) -> bool:
var image = Image.load_from_file(path)
if image == null:
return false
var tex = ImageTexture.create_from_image(image)
%PreviewImage.texture = tex
%LoadImageButton.text = path.get_file()
return true