-
-
Notifications
You must be signed in to change notification settings - Fork 640
TypedArray and TypedDictionary do not allow enums as template parameters #1684
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I don't think enums are allowed as types for However, if I'm wrong about that, then that's a bug to fix in godot-cpp. |
I naively copied the example into a test module and get this error:
|
This might not be something doable in a module but it is soemthing that is doable in other scripting languages enum TEST {
TEST_1,
TEST_2,
TEST_3,
TEST_4,
TEST_5,
}
@export var test2 : Dictionary[float,TEST] because of that I think you should be able to do it through godot-cpp too. MAKE_TYPED_ARRAY_INFO(Test, Variant::INT);
MAKE_TYPED_ARRAY(Test, Variant::INT); but for typed dictionarries I tried doing the same but couldn't make it work yet. I'll update if I find a way to make it work. |
I don't disagree that it would be useful! But as a matter of policy, we want to avoid merging new things into godot-cpp that are API incompatible with Godot modules. We already have enough existing incompatibilities that we're trying to fix, we shouldn't add any more new ones. :-) So, if this doesn't work in Godot modules, it should be fixed there first, so that we know what we add here will be compatible with it |
Godot version
4.4.dev7.official.46c8f8c5c
godot-cpp version
befe3ee
System information
Debian Trixie, i7-1360P
Issue description
Related to #1584, although the introduction of typed dictionaries makes this much more complicated.
TypedArray
andTypedDictionary
should be able to take enum types that have been registered withVARIANT_ENUM_CAST
as the element or key or value type, treating it as an integer with whatever metadata is needed to make the editor show the correct type name in the brackets.Steps to reproduce
Contrived toy example:
Actual project where I am using typed arrays and dictionaries of enum types: https://github.com/BenLubar/godot4-spy-cards-online
(In the actual project,
src/dry.h
contains a lot of helper macros.)Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: