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:
OverloadedOrama 2020-05-09 03:51:23 +03:00
parent adc109ed18
commit 0cd8fa7ddf
5 changed files with 24 additions and 11 deletions

View file

@ -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: