mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Resize image effect preview images to (1, 1) when the dialogs are being hidden
So that they do not waste RAM for no reason anymore
This commit is contained in:
parent
7235617db7
commit
fc33ee1da7
|
@ -23,12 +23,8 @@ func _ready() -> void:
|
|||
set_nodes()
|
||||
get_ok().size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
get_cancel().size_flags_horizontal = Control.SIZE_EXPAND_FILL
|
||||
current_frame.create(
|
||||
Global.current_project.size.x, Global.current_project.size.y, false, Image.FORMAT_RGBA8
|
||||
)
|
||||
selected_cels.create(
|
||||
Global.current_project.size.x, Global.current_project.size.y, false, Image.FORMAT_RGBA8
|
||||
)
|
||||
current_frame.create(1, 1, false, Image.FORMAT_RGBA8)
|
||||
selected_cels.create(1, 1, false, Image.FORMAT_RGBA8)
|
||||
connect("about_to_show", self, "_about_to_show")
|
||||
connect("popup_hide", self, "_popup_hide")
|
||||
connect("confirmed", self, "_confirmed")
|
||||
|
@ -244,6 +240,10 @@ func update_transparent_background_size() -> void:
|
|||
|
||||
func _popup_hide() -> void:
|
||||
Global.dialog_open(false)
|
||||
# Resize the images to (1, 1) so they do not waste unneeded RAM
|
||||
selected_cels.resize(1, 1)
|
||||
current_frame.resize(1, 1)
|
||||
preview_image = Image.new()
|
||||
|
||||
|
||||
func _is_webgl1() -> bool:
|
||||
|
|
|
@ -4,7 +4,7 @@ var width := 64
|
|||
var height := 64
|
||||
var offset_x := 0
|
||||
var offset_y := 0
|
||||
var image: Image
|
||||
var image := Image.new()
|
||||
|
||||
onready var width_spinbox: SpinBox = $VBoxContainer/OptionsContainer/WidthValue
|
||||
onready var height_spinbox: SpinBox = $VBoxContainer/OptionsContainer/HeightValue
|
||||
|
@ -13,13 +13,13 @@ onready var y_spinbox: SpinBox = $VBoxContainer/OptionsContainer/YSpinBox
|
|||
onready var preview_rect: TextureRect = $VBoxContainer/AspectRatioContainer/Preview
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
image.create(1, 1, false, Image.FORMAT_RGBA8)
|
||||
|
||||
|
||||
func _on_ResizeCanvas_about_to_show() -> void:
|
||||
Global.canvas.selection.transform_content_confirm()
|
||||
image = Image.new()
|
||||
image.create(
|
||||
Global.current_project.size.x, Global.current_project.size.y, false, Image.FORMAT_RGBA8
|
||||
)
|
||||
|
||||
image.resize(Global.current_project.size.x, Global.current_project.size.y)
|
||||
var layer_i := 0
|
||||
for cel in Global.current_project.frames[Global.current_project.current_frame].cels:
|
||||
if cel is PixelCel and Global.current_project.layers[layer_i].is_visible_in_hierarchy():
|
||||
|
@ -109,3 +109,5 @@ func update_transparent_background_size(preview_image: Image) -> void:
|
|||
|
||||
func _on_ResizeCanvas_popup_hide() -> void:
|
||||
Global.dialog_open(false)
|
||||
# Resize the image to (1, 1) so it does not waste unneeded RAM
|
||||
image.resize(1, 1)
|
||||
|
|
Loading…
Reference in a new issue