Godot version:
Tested on: 3.1.1 stable, 3.2.2 stable, 3.2.3. stable and 3.2.4 beta 1
OS/device including version:
W10 64 bit
Issue description:
When testing #43121 I found out that Global Position of children doesn't seem to be accurate when set_as_toplevel is true, which resulted in a wierd jump between 2 points when switching set_as_toplevel on and off. Printing the Global Position demonstrated that the Global Position Didn't change, meaning the "Global Position" is ignored when set_as_toplevel is set to true and instead uses only the node's relative position to the parent as it's actual position.
Steps to reproduce:
Make a Scene
Make a Child node to the root and place it at coords different from the root
To that Child add a Runtime Visible Node (like a Sprite)
Attach a Script to the Sprite that prints Global Position, and can toggle set_as_toplevel
Observe Jumping between 2 points as toggled, while Global Position Doesn't change
Minimal reproduction project:
Global Pos.zip
This is an expected behavior. You seem to expect that the global_position position will keep its value, while in fact it's the position property that does. Since global_position is simply a proxy property for the underlying position one, it is normal that "position" keeps its value while "global_position" is modified depending on the toplevel status.
Closing as this is an expected behavior.
Ah my bad, I think I misunderstood the issue. You are right, the problem is in the global_position not updating properly. This is annoying...
I made a PR, if you want to give it a try: #43131
Seems like it solve the problem.
Sadly unable to test for 2 reasons:
Ok, no problem. It solve the issue for me so I guess it's enough.
It should likely be cherry-picked so you will probably be able to test it in the next 3.x release.
Most helpful comment
Ah my bad, I think I misunderstood the issue. You are right, the problem is in the global_position not updating properly. This is annoying...