godotengine / godot

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

gdextension: `Object::ConnectFlags` marked as not a bitfield in `extension_api.json` #97042

Open fpdotmonkey opened 2 months ago

fpdotmonkey commented 2 months ago

Tested versions

System information

Godot v4.3.stable - Ubuntu 24.04.1 LTS 24.04 - Wayland - Vulkan (Forward+) - dedicated AMD Radeon RX Vega M GH Graphics (RADV VEGAM) - Intel(R) Core(TM) i7-8809G CPU @ 3.10GHz (8 Threads)

Issue description

In extension_api.json, Object::ConnectFlags is marked as "is_bitfield": false, however, given that the enum values are powers of two, the default value in e.g. Signal::connect is 0 (seemingly unset), and that the behaviors associated with each enum variant are seemingly orthogonal, it would seem that this is a bitfield.

This seems to have led to issues in C# (https://github.com/godotengine/godot/issues/74829) and in Rust gdext (https://github.com/godot-rust/gdext/issues/756).

Steps to reproduce

godot --dump-extension-api
cat extension_api.json | jq '.classes[] | select(.name == "Object").enums[] | select(.name == "ConnectFlags").is_bitfield'
# false
# alternately, inspect with a pager or text editor

Minimal reproduction project (MRP)

N/A

AThousandShips commented 2 months ago

I suspect this might be a limitation to what you can bind in Object as it is so very fundamental, but might be an oversight

Was originally implemented in:

But wasn't mentioned there, so might have been overlooked

fpdotmonkey commented 2 months ago

If it's an oversight, should it be fixed in Godot or worked around by gdextension implementations? Would fixing it be a compatibility break?