mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Importing PNGs should now work
This commit is contained in:
parent
4969978f46
commit
2f07259389
|
@ -57,6 +57,19 @@ func _on_ImportSprites_files_selected(paths : PoolStringArray) -> void:
|
|||
tex.create_from_image(image, 0)
|
||||
# Store [Image, ImageTexture, Opacity]
|
||||
canvas.layers.append([image, tex, 1])
|
||||
|
||||
for _i in range(1, Global.layers.size()):
|
||||
var empty_sprite := Image.new()
|
||||
empty_sprite.create(canvas.size.x, canvas.size.y, false, Image.FORMAT_RGBA8)
|
||||
empty_sprite.fill(Color(0, 0, 0, 0))
|
||||
empty_sprite.lock()
|
||||
|
||||
var empty_tex := ImageTexture.new()
|
||||
empty_tex.create_from_image(empty_sprite, 0)
|
||||
|
||||
# Store [Image, ImageTexture, Opacity]
|
||||
canvas.layers.append([empty_sprite, empty_tex, 1])
|
||||
|
||||
canvas.frame = i
|
||||
Global.canvases.append(canvas)
|
||||
Global.canvas_parent.add_child(canvas)
|
||||
|
@ -107,6 +120,7 @@ func _on_ImportSprites_files_selected(paths : PoolStringArray) -> void:
|
|||
|
||||
Global.canvases[Global.canvases.size() - 1].camera_zoom()
|
||||
|
||||
Global.canvases = Global.canvases # Just to call Global.canvases_changed
|
||||
Global.current_frame = i - 1
|
||||
Global.canvas = Global.canvases[Global.canvases.size() - 1]
|
||||
Global.canvas.visible = true
|
||||
|
|
|
@ -553,11 +553,6 @@ func _on_SaveSprite_file_selected(path : String) -> void:
|
|||
_on_QuitDialog_confirmed()
|
||||
|
||||
func clear_canvases() -> void:
|
||||
for child in Global.vbox_layer_container.get_children():
|
||||
if child is PanelContainer:
|
||||
child.queue_free()
|
||||
for child in Global.frame_containers.get_children():
|
||||
child.queue_free()
|
||||
for child in Global.canvas_parent.get_children():
|
||||
if child is Canvas:
|
||||
child.queue_free()
|
||||
|
|
Loading…
Reference in a new issue