From 09c3ea1c2ac770179a302bd26620be86a688db9c Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas Date: Fri, 5 May 2023 15:15:02 +0300 Subject: [PATCH] Fix 3D layer current_object_id being sometimes wrong when loading pxo files Previously, it was set to the size of the object_properties dictionary, but if the user has deleted objects, the object id would be higher than the size of the dictionary, since current_object_id never decreases. --- src/Classes/Cel3D.gd | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Classes/Cel3D.gd b/src/Classes/Cel3D.gd index a6cf54391..991688146 100644 --- a/src/Classes/Cel3D.gd +++ b/src/Classes/Cel3D.gd @@ -186,8 +186,11 @@ func deserialize(dict: Dictionary) -> void: if typeof(object) != TYPE_STRING: return Global.convert_dictionary_values(objects_copy[object]) - object_properties[int(object)] = objects_copy[object] - current_object_id = object_properties.size() + var id := int(object) + if current_object_id < id: + current_object_id = id + object_properties[id] = objects_copy[object] + current_object_id += 1 Global.convert_dictionary_values(scene_properties) deserialize_scene_properties() for object in object_properties: