1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Fix "It's not a reference to a valid Image object" error when resizing canvas for the first time

This commit is contained in:
Manolis Papadeas 2020-11-26 01:22:11 +02:00
parent 4d85cf1a10
commit 512507e2c7

View file

@ -16,10 +16,6 @@ onready var preview_rect : TextureRect = $VBoxContainer/Preview
func _on_ResizeCanvas_about_to_show() -> void:
if first_time:
width_spinbox.value = Global.current_project.size.x
height_spinbox.value = Global.current_project.size.y
image = Image.new()
image.create(Global.current_project.size.x, Global.current_project.size.y, false, Image.FORMAT_RGBA8)
image.lock()
@ -39,6 +35,10 @@ func _on_ResizeCanvas_about_to_show() -> void:
layer_i += 1
image.unlock()
if first_time:
width_spinbox.value = Global.current_project.size.x
height_spinbox.value = Global.current_project.size.y
else:
update_preview()