Operating system or device - Godot version:
ALL - 3.0 ALPHA1
Issue description:
Inside an ScrollContainer, The VBoxContainer and it Panel child anchor and margin are reset to all begin and 0. It always happens when the following actions are performed:
Additionally, sometimes (not reproducible in the attachment project), while resizing the VBoxContainer or its Panel child will suffer this issue after increasing the width to some specific amount. However this cannot have be reproduced in a minimal project yet, please take it in consideration.
Please note that this also applies to HBoxContainer with other parent nodes, but is been omitted for brevity.
Steps to reproduce:
Expected results.
The anchor and margin for VBoxContainer and Panel are kept.
Current results.
The anchor and margin for VBoxContainer and Panel are reset to all begin and 0, except for the Panel height that is kept as the min size Y.
Workaround.
For simple GUIs the following script can be used, but may not work properly on more complex GUIs:
func _process(delta):
set_anchor_and_margin(MARGIN_RIGHT, ANCHOR_END, 0)
set_anchor_and_margin(MARGIN_BOTTOM, ANCHOR_END, 0)
Link to minimal example project:
The following attachment has a simple project with an example of this issue. The example contains a sample of the bug and and example of the workaround.
See also.
Can confirm margins are being reset when the game starts / scene is reloaded. This happens for MarginContainer and all other *Container nodes as far as I can see...
This is not a bug, containers override any setting you change in margins. It's by design.
Yes, I had a closer look now - you need to set this under "Custom Constants" -> Margin properties.
@reduz does this means that it is not possible to have responsive containers without having to set the size in every loop through an script?
I am using Godot to do complex GUIs, and to be honest it is really impressive how simple is to make multi-tabbed responsive complex GUIs with minimal scripting for the layout. However this limitation is pretty annoying, and if it is by design it is hard to understand the objective of such behavior. Is really not possible to change this behavior?
I don't see any Margin properties under Custom Constants.
Most helpful comment
@reduz does this means that it is not possible to have responsive containers without having to set the size in every loop through an script?
I am using Godot to do complex GUIs, and to be honest it is really impressive how simple is to make multi-tabbed responsive complex GUIs with minimal scripting for the layout. However this limitation is pretty annoying, and if it is by design it is hard to understand the objective of such behavior. Is really not possible to change this behavior?