godot icon indicating copy to clipboard operation
godot copied to clipboard

Stop pasted child nodes being assigned an owner when previously unowned

Open snailrhymer opened this issue 2 years ago • 2 comments

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.

snailrhymer avatar Jul 17 '22 22:07 snailrhymer

This breaks nodes with owner: godot windows tools 64_gBct4s2qdc

KoBeWi avatar Jul 18 '22 10:07 KoBeWi

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.

snailrhymer avatar Jul 18 '22 20:07 snailrhymer

Rebased and force-pushed.

YuriSizov avatar Mar 15 '23 15:03 YuriSizov

Thanks!

YuriSizov avatar Mar 15 '23 15:03 YuriSizov