mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
WILL BREAK BACKWARDS COMPATIBILITY WITH .pxo FILES - Layer names get saved in .pxo files now
This commit is contained in:
parent
40e0978b3f
commit
79ceced483
|
@ -258,20 +258,18 @@ func _on_OpenSprite_file_selected(path) -> void:
|
||||||
Global.canvas = canvas
|
Global.canvas = canvas
|
||||||
var width := file.get_16()
|
var width := file.get_16()
|
||||||
var height := file.get_16()
|
var height := file.get_16()
|
||||||
|
|
||||||
var layer := 0
|
|
||||||
var layer_line := file.get_line()
|
var layer_line := file.get_line()
|
||||||
|
|
||||||
while layer_line == "-":
|
while layer_line == "-":
|
||||||
var buffer := file.get_buffer(width * height * 4)
|
var buffer := file.get_buffer(width * height * 4)
|
||||||
|
var layer_name := file.get_line()
|
||||||
var image := Image.new()
|
var image := Image.new()
|
||||||
image.create_from_data(width, height, false, Image.FORMAT_RGBA8, buffer)
|
image.create_from_data(width, height, false, Image.FORMAT_RGBA8, buffer)
|
||||||
image.lock()
|
image.lock()
|
||||||
var tex := ImageTexture.new()
|
var tex := ImageTexture.new()
|
||||||
tex.create_from_image(image, 0)
|
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_line = file.get_line()
|
||||||
layer += 1
|
|
||||||
|
|
||||||
canvas.size = Vector2(width, height)
|
canvas.size = Vector2(width, height)
|
||||||
Global.canvases.append(canvas)
|
Global.canvases.append(canvas)
|
||||||
|
@ -327,6 +325,7 @@ func _on_SaveSprite_file_selected(path) -> void:
|
||||||
for layer in canvas.layers:
|
for layer in canvas.layers:
|
||||||
file.store_line("-")
|
file.store_line("-")
|
||||||
file.store_buffer(layer[0].get_data())
|
file.store_buffer(layer[0].get_data())
|
||||||
|
file.store_line(layer[2])
|
||||||
file.store_line("END_LAYERS")
|
file.store_line("END_LAYERS")
|
||||||
file.store_line("END_FRAMES")
|
file.store_line("END_FRAMES")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue