From 724f09d6f9ec93a0bdb574ba82e4fe249043515a Mon Sep 17 00:00:00 2001 From: bitbrain Date: Fri, 22 Sep 2023 18:58:34 +0100 Subject: [PATCH] :bug: ensure saving scenes with instantiated entities works --- addons/pandora/model/entity.gd | 2 ++ test/model/property_test.gd | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/pandora/model/entity.gd b/addons/pandora/model/entity.gd index fded1fb7..6037eb00 100644 --- a/addons/pandora/model/entity.gd +++ b/addons/pandora/model/entity.gd @@ -167,6 +167,8 @@ func init_entity(id:String, name:String, icon_path:String, category_id:String) - func instantiate() -> PandoraEntity: var entity = ScriptUtil.create_entity_from_script(get_script_path(), "", "", "", "") if entity != null: + # ensure to store the id on instances too, so scene saving does not break. + entity._id = get_entity_id() entity._instanced_from_id = get_entity_id() return entity diff --git a/test/model/property_test.gd b/test/model/property_test.gd index 0cc269b0..385c4660 100644 --- a/test/model/property_test.gd +++ b/test/model/property_test.gd @@ -144,4 +144,4 @@ func test_array_property_wrong_type() -> void: property.set_default_value([1, 2, 3]) var new_property = PandoraProperty.new("", "", "") new_property.load_data(property.save_data()) - assert_that(new_property.get_default_value()).is_equal("") \ No newline at end of file + assert_that(new_property.get_default_value()).is_equal("")