godotengine / godot

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

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

Open fpdotmonkey opened 5 days ago

fpdotmonkey commented 5 days 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 5 days 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 3 days 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?