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

In ResizeCanvas, always set the spinbox values to the current project size

This commit is contained in:
Manolis Papadeas 2022-03-18 00:07:40 +02:00
parent 790cd8533a
commit 4059cb018b

View file

@ -5,7 +5,6 @@ var height := 64
var offset_x := 0 var offset_x := 0
var offset_y := 0 var offset_y := 0
var image: Image var image: Image
var first_time := true
onready var width_spinbox: SpinBox = $VBoxContainer/OptionsContainer/WidthValue onready var width_spinbox: SpinBox = $VBoxContainer/OptionsContainer/WidthValue
onready var height_spinbox: SpinBox = $VBoxContainer/OptionsContainer/HeightValue onready var height_spinbox: SpinBox = $VBoxContainer/OptionsContainer/HeightValue
@ -20,7 +19,7 @@ func _on_ResizeCanvas_about_to_show() -> void:
image.create( image.create(
Global.current_project.size.x, Global.current_project.size.y, false, Image.FORMAT_RGBA8 Global.current_project.size.x, Global.current_project.size.y, false, Image.FORMAT_RGBA8
) )
image.lock()
var layer_i := 0 var layer_i := 0
for cel in Global.current_project.frames[Global.current_project.current_frame].cels: for cel in Global.current_project.frames[Global.current_project.current_frame].cels:
if Global.current_project.layers[layer_i].visible: if Global.current_project.layers[layer_i].visible:
@ -40,9 +39,7 @@ func _on_ResizeCanvas_about_to_show() -> void:
cel_image, Rect2(Vector2.ZERO, Global.current_project.size), Vector2.ZERO cel_image, Rect2(Vector2.ZERO, Global.current_project.size), Vector2.ZERO
) )
layer_i += 1 layer_i += 1
image.unlock()
if first_time:
width_spinbox.value = Global.current_project.size.x width_spinbox.value = Global.current_project.size.x
height_spinbox.value = Global.current_project.size.y height_spinbox.value = Global.current_project.size.y
update_preview() update_preview()
@ -50,7 +47,6 @@ func _on_ResizeCanvas_about_to_show() -> void:
func _on_ResizeCanvas_confirmed() -> void: func _on_ResizeCanvas_confirmed() -> void:
DrawingAlgos.resize_canvas(width, height, offset_x, offset_y) DrawingAlgos.resize_canvas(width, height, offset_x, offset_y)
first_time = false
func _on_WidthValue_value_changed(value: int) -> void: func _on_WidthValue_value_changed(value: int) -> void: