mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 09:09:47 +00:00
Fixes critical bug with saving projects that contained linked cels
It used to save the linked cel array which contained the canvas nodes into the .pxo. This, however, does not make sense, because the canvas nodes are being recreated when a .pxo is loaded. Therefore, they are different nodes than they used to be. Now, an array containing the frame numbers which have cels linked for each frame is being saved and loaded into the pxo.
This commit is contained in:
parent
adc109ed18
commit
0cd8fa7ddf
|
@ -8,7 +8,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||
This update has been brought to you by the contributions of:
|
||||
|
||||
Martin Novák (novhack), Darshan Phaldesai (luiq54), Schweini07, Marco Galli (Gaarco), Matheus Pesegoginski (MatheusPese),
|
||||
sapient-cogbag, Kinwailo, Igor Santarek (jegor377), Dávid Gábor BODOR (dragonfi)
|
||||
sapient-cogbag, Kinwailo, Igor Santarek (jegor377), Dávid Gábor BODOR (dragonfi), John Jerome Romero (Wishdream)
|
||||
|
||||
### Added
|
||||
- Cels are now in the timeline. Each cel refers to a specific layer AND a frame. Frames are a collection of cels for every layer.
|
||||
|
|
|
@ -402,7 +402,7 @@ func _ready() -> void:
|
|||
error_dialog = find_node_by_name(root, "ErrorDialog")
|
||||
|
||||
# Store [Layer name (0), Layer visibility boolean (1), Layer lock boolean (2), Frame container (3),
|
||||
# will new frames be linked boolean (4), Array of linked frames (5)]
|
||||
# will new cels be linked boolean (4), Array of linked cels (5)]
|
||||
layers.append([tr("Layer") + " 0", true, false, HBoxContainer.new(), false, []])
|
||||
|
||||
|
||||
|
|
|
@ -38,18 +38,19 @@ func open_pxo_file(path : String, untitled_backup : bool = false) -> void:
|
|||
|
||||
var frame := 0
|
||||
Global.layers.clear()
|
||||
var linked_cels := []
|
||||
if file_major_version >= 0 and file_minor_version > 6:
|
||||
var global_layer_line := file.get_line()
|
||||
while global_layer_line == ".":
|
||||
var layer_name := file.get_line()
|
||||
var layer_visibility := file.get_8()
|
||||
var layer_lock := file.get_8()
|
||||
var layer_new_frames_linked := file.get_8()
|
||||
var linked_frames = file.get_var()
|
||||
var layer_new_cels_linked := file.get_8()
|
||||
linked_cels.append(file.get_var())
|
||||
|
||||
# Store [Layer name (0), Layer visibility boolean (1), Layer lock boolean (2), Frame container (3),
|
||||
# will new frames be linked boolean (4), Array of linked frames (5)]
|
||||
Global.layers.append([layer_name, layer_visibility, layer_lock, HBoxContainer.new(), layer_new_frames_linked, linked_frames])
|
||||
# will new cels be linked boolean (4), Array of linked cels (5)]
|
||||
Global.layers.append([layer_name, layer_visibility, layer_lock, HBoxContainer.new(), layer_new_cels_linked, []])
|
||||
global_layer_line = file.get_line()
|
||||
|
||||
var frame_line := file.get_line()
|
||||
|
@ -60,6 +61,7 @@ func open_pxo_file(path : String, untitled_backup : bool = false) -> void:
|
|||
var width := file.get_16()
|
||||
var height := file.get_16()
|
||||
|
||||
var layer_i := 0
|
||||
var layer_line := file.get_line()
|
||||
while layer_line == "-": # Load layers
|
||||
var buffer := file.get_buffer(width * height * 4)
|
||||
|
@ -78,6 +80,10 @@ func open_pxo_file(path : String, untitled_backup : bool = false) -> void:
|
|||
var tex := ImageTexture.new()
|
||||
tex.create_from_image(image, 0)
|
||||
canvas.layers.append([image, tex, layer_transparency])
|
||||
if frame in linked_cels[layer_i]:
|
||||
Global.layers[layer_i][5].append(canvas)
|
||||
|
||||
layer_i += 1
|
||||
layer_line = file.get_line()
|
||||
|
||||
var guide_line := file.get_line() # "guideline" no pun intended
|
||||
|
@ -168,8 +174,12 @@ func save_pxo_file(path : String, autosave : bool) -> void:
|
|||
file.store_line(layer[0]) # Layer name
|
||||
file.store_8(layer[1]) # Layer visibility
|
||||
file.store_8(layer[2]) # Layer lock
|
||||
file.store_8(layer[4]) # Future frames linked
|
||||
file.store_var(layer[5]) # Linked frames
|
||||
file.store_8(layer[4]) # Future cels linked
|
||||
var linked_cels := []
|
||||
for canvas in layer[5]:
|
||||
linked_cels.append(canvas.frame)
|
||||
file.store_var(linked_cels) # Linked cels as cel numbers
|
||||
|
||||
file.store_line("END_GLOBAL_LAYERS")
|
||||
|
||||
# Store frames
|
||||
|
|
|
@ -42,6 +42,7 @@ var simple_drawer := SimpleDrawer.new()
|
|||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var fill_layers := layers.empty()
|
||||
var layer_i := 0
|
||||
for l in Global.layers:
|
||||
if fill_layers:
|
||||
# The sprite itself
|
||||
|
@ -68,9 +69,10 @@ func _ready() -> void:
|
|||
if self in l[5]:
|
||||
# If the linked button is pressed, set as the Image & ImageTexture
|
||||
# to be the same as the first linked cel
|
||||
var current_layer := layers.size() - 1
|
||||
layers[current_layer][0] = l[5][0].layers[current_layer][0]
|
||||
layers[current_layer][1] = l[5][0].layers[current_layer][1]
|
||||
layers[layer_i][0] = l[5][0].layers[layer_i][0]
|
||||
layers[layer_i][1] = l[5][0].layers[layer_i][1]
|
||||
|
||||
layer_i += 1
|
||||
|
||||
# Only handle camera zoom settings & offset on the first frame
|
||||
if Global.canvases[0] == self:
|
||||
|
|
|
@ -33,6 +33,7 @@ func _ready() -> void:
|
|||
contributors.create_item(contributor_root).set_text(0, " Kinwailo")
|
||||
contributors.create_item(contributor_root).set_text(0, " Igor Santarek (jegor377)")
|
||||
contributors.create_item(contributor_root).set_text(0, " Dávid Gábor BODOR (dragonfi)")
|
||||
contributors.create_item(contributor_root).set_text(0, " John Jerome Romero (Wishdream)")
|
||||
|
||||
var donors_root := donors.create_item()
|
||||
donors.create_item(donors_root).set_text(0, " pcmxms - https://www.nonamefornowsoft.com.br/")
|
||||
|
|
Loading…
Reference in a new issue