Skip to content

Commit

Permalink
🐛 ensure saving scenes with instantiated entities works
Browse files Browse the repository at this point in the history
  • Loading branch information
bitbrain committed Sep 22, 2023
1 parent c8f7ab9 commit 724f09d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions addons/pandora/model/entity.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion test/model/property_test.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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("")
assert_that(new_property.get_default_value()).is_equal("")

0 comments on commit 724f09d

Please sign in to comment.