You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
VARIANT_ENUM_CAST does work in Godot itself with enum classes.
Are you sure this is true?
There was a relatively recent PR where an attempt was made to add support for binding enum classes, but it ended up getting closed because it turned out to be trickier to implement than expected
EulerOrder, HatDir, HatMask, JoyAxis, JoyButton, MIDIMessage, MouseButton, MouseButtonMask, Key, KeyModifierMask, KeyLocation are all enum classes, and they are just from core/variant/binder_common.h alone, maybe there are more in some other places.
Also I meant the actual VARIANT_ENUM_CAST, not BIND_ENUM_CONSTANT. Found kind of relevant issue #1620 , since those enums are defined as enum classes inside the engine and are already used, VARIANT_ENUM_CAST should have already worked even then
Like, sure, don't add support for BIND_ENUM_CONSTANT enum classes as it is not in engine itself, but VARIANT_ENUM_CAST should already work as it does in the engine, and we would then use some custom ClassDB::bind_integer_constant and be on our own
Activity
dsnopek commentedon Jan 31, 2026
Are you sure this is true?
There was a relatively recent PR where an attempt was made to add support for binding enum classes, but it ended up getting closed because it turned out to be trickier to implement than expected
NoctemCat commentedon Feb 1, 2026
EulerOrder,HatDir,HatMask,JoyAxis,JoyButton,MIDIMessage,MouseButton,MouseButtonMask,Key,KeyModifierMask,KeyLocationare all enum classes, and they are just fromcore/variant/binder_common.halone, maybe there are more in some other places.Also I meant the actual
VARIANT_ENUM_CAST, notBIND_ENUM_CONSTANT. Found kind of relevant issue #1620 , since those enums are defined as enum classes inside the engine and are already used,VARIANT_ENUM_CASTshould have already worked even thenNoctemCat commentedon Feb 1, 2026
Like, sure, don't add support for
BIND_ENUM_CONSTANTenum classes as it is not in engine itself, butVARIANT_ENUM_CASTshould already work as it does in the engine, and we would then use some customClassDB::bind_integer_constantand be on our owndsnopek commentedon Feb 1, 2026
Ok, I think you're right that
VARIANT_ENUM_CAST()does work with enum classes in Godot, and I think it's this code that does it:https://github.com/godotengine/godot/blob/98782b6c8c9cabe0fb7c80bc62640735ecb076d3/core/variant/method_ptrcall.h#L243-L246
PR #1914 should fix this
NoctemCat commentedon Feb 20, 2026
Seeing as PR got merged closing issue as completed