diff --git a/Scripts/Dialogs/ImportSprites.gd b/Scripts/Dialogs/ImportSprites.gd index c0f2e48..9980209 100644 --- a/Scripts/Dialogs/ImportSprites.gd +++ b/Scripts/Dialogs/ImportSprites.gd @@ -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 diff --git a/Scripts/Main.gd b/Scripts/Main.gd index 2e860bd..f65a292 100644 --- a/Scripts/Main.gd +++ b/Scripts/Main.gd @@ -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()