godotengine / godot

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

Setting wrap_controls = false for popups created by buttons causes them to not appear correctly #83875

Open veigaribo opened 10 months ago

veigaribo commented 10 months ago

Godot version

v4.1.stable.official [970459615]

System information

Godot v4.1.stable - Ubuntu 22.04.3 LTS 22.04 - Vulkan (Compatibility) - AMD Radeon RX 6700 XT (navi22, LLVM 15.0.7, DRM 3.49, 6.2.0-35-generic) () - AMD Ryzen 5 3600X 6-Core Processor (12 Threads)

Issue description

This issue applies (at least) to ColorPickerButton, OptionButton and MenuButton, although not in the same way.

Basically, if you create one of those, then, via script, set wrap_controls of the inner PopupPanel or PopupMenu (accessed via get_popup()) to false (not the default since they inherit from Popup), then:

I of course expected for the button to display the popup with every press, as if it didn't have that option set. The OptionButton and MenuButton (the ones that use PopupMenu) behavior seems reasonable enough to be a limitation, but the first one seems odd, specially since I tested this in version v4.0.beta10.official [d0398f62f], which I happened to have lying around, and it seems to work as I would expect there.

I stumbled upon this because I wanted to set the size for the popup window of a ColorPickerButton but it seemed that was only possible with wrap_controls disabled.

Steps to reproduce

I'm also sending a project that contains one of each button alongside a normal version of it (i.e. without the script attached) for comparison.

Minimal reproduction project

wrap_controls_color_pick_button_bug-41.zip

AThousandShips commented 10 months ago

Can you please try this with a supported version, like 4.1.2 (only the latest patch version is supported, and it might already be fixed)

veigaribo commented 10 months ago

Sure. In version v4.1.2.stable.official [399c9dc39] both problems still happen. In version v3.5.3.stable.official [6c814135b] the inheritance tree for the popup seems different so this doesn't seem to apply.

(I had downloaded the latest version prior to issuing this but I forgot to actually use it...)