godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.76k stars 21.12k forks source link

In enter_tree(), set_anchors_and_margins_preset() fails to set margins #64325

Open 20milliliter opened 2 years ago

20milliliter commented 2 years ago

Godot version

3.4.4.stable

System information

Windows 10, GLES3, Radeon RX 580 (22.5.2)

Issue description

Calling set_anchors_and_margins_preset (or similar methods) in _enter_tree doesn't correctly set the margins.

Steps to reproduce

  1. Open reproduction project.
  2. Add custom node CustomNode to scene.
  3. While set_anchors_and_margins_preset was called, the panel location is not correct.
  4. Toggle the resize_trigger variable export on the node, running set_anchors_and_margins_preset instead within _process.
  5. Panel location is now correct.

Minimal reproduction project

Bug.zip

KoBeWi commented 2 years ago

This is basically the same as #24859, which was resolved with a warning. But looks like this case is not covered.