From 79ceced4835cca31d8cf16bfabb27bea7404557d Mon Sep 17 00:00:00 2001 From: OverloadedOrama <35376950+OverloadedOrama@users.noreply.github.com> Date: Wed, 6 Nov 2019 00:08:57 +0200 Subject: [PATCH] WILL BREAK BACKWARDS COMPATIBILITY WITH .pxo FILES - Layer names get saved in .pxo files now --- Scripts/Main.gd | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Scripts/Main.gd b/Scripts/Main.gd index 3a5ce884c..c7d8da5b6 100644 --- a/Scripts/Main.gd +++ b/Scripts/Main.gd @@ -258,20 +258,18 @@ func _on_OpenSprite_file_selected(path) -> void: Global.canvas = canvas var width := file.get_16() var height := file.get_16() - - var layer := 0 var layer_line := file.get_line() while layer_line == "-": var buffer := file.get_buffer(width * height * 4) + var layer_name := file.get_line() var image := Image.new() image.create_from_data(width, height, false, Image.FORMAT_RGBA8, buffer) image.lock() var tex := ImageTexture.new() tex.create_from_image(image, 0) - canvas.layers.append([image, tex, "Layer %s" % layer, true]) + canvas.layers.append([image, tex, layer_name, true]) layer_line = file.get_line() - layer += 1 canvas.size = Vector2(width, height) Global.canvases.append(canvas) @@ -327,6 +325,7 @@ func _on_SaveSprite_file_selected(path) -> void: for layer in canvas.layers: file.store_line("-") file.store_buffer(layer[0].get_data()) + file.store_line(layer[2]) file.store_line("END_LAYERS") file.store_line("END_FRAMES")