godot icon indicating copy to clipboard operation
godot copied to clipboard

Fix duplicating/copying `TileMap`

Open AThousandShips opened this issue 1 year ago • 6 comments

Using force_parent_owned to prevent issues duplicating

Think this covers all cases

  • Fixes: https://github.com/godotengine/godot/issues/88104

AThousandShips avatar Feb 08 '24 14:02 AThousandShips

Something with the test project needs tweaking or some exception case needs managing, will look in a bit

AThousandShips avatar Feb 08 '24 14:02 AThousandShips

Appears the internal node is still accessible to scripting and therefore causes some problems, will investigate

AThousandShips avatar Feb 08 '24 14:02 AThousandShips

Will need some tweaking possibly to handle the ability to instance these types, but unsure, the alternative would be to deal somehow with the duplication of the child nodes in a way that prevents breaking, but unsure how that would work best

AThousandShips avatar Feb 08 '24 15:02 AThousandShips

It seems this is relatively trivial, will look at a different fix leveraging is_owned_by_parent

Edit: Better solution, will push momentarily

AThousandShips avatar Feb 08 '24 15:02 AThousandShips

I've identified a few other places where force_parent_owned might be needed and will look at a PR for that too

AThousandShips avatar Feb 08 '24 16:02 AThousandShips

They shouldn't be removed even then, the layers would be doubled because the recreation of the data from the properties, I didn't realise that in my first attempt but it had extra layers because the map doesn't detect them being added, granted with more such details that would work but alone these lines shouldn't be removed even if the layer is exposed

AThousandShips avatar Feb 08 '24 17:02 AThousandShips

Thanks!

akien-mga avatar Feb 12 '24 12:02 akien-mga

Thank you!

AThousandShips avatar Feb 12 '24 13:02 AThousandShips