godot
godot copied to clipboard
Stop pasted child nodes being assigned an owner when previously unowned
Add a check in paste_nodes() so that pasted children aren't given an owner if the 'original' child on the clipboard didn't have an owner. This makes copy & pasting behave the same as directly duplicating.
Fixes one of the causes of #62614 for master
. The fix for 3.x
is analogous but in a slightly different place; I can backport if this fix is approved.
This breaks nodes with owner:
Ah, that's quite the oversight, sorry. I incorrectly assumed that nodes duplicated to the node clipboard maintained something about their ownership structure, which isn't the case.
I've now amended copying so that information is kept, but the method feels a bit hacky - on the clipboard, all children of a copied node are given that node as an owner. Then when pasting, children's owners are checked and if equal to the node, the pasted children are given an owner.
It seems to work:
https://user-images.githubusercontent.com/61291296/179612298-c73e5054-2aaf-4309-9b88-d16efbb17065.mp4
but I don't know if there's a more sensible way to do it.
Rebased and force-pushed.
Thanks!