Skip to content
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

TypedArray and TypedDictionary do not allow enums as template parameters #1684

Open
BenLubar opened this issue Jan 13, 2025 · 0 comments
Open
Labels
bug This has been identified as a bug
Milestone

Comments

@BenLubar
Copy link

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 and TypedDictionary should be able to take enum types that have been registered with VARIANT_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:

class Foo : public Object {
    GDCLASS(Foo, Object);

protected:
    static void _bind_methods();

public:
    enum Animal {
        CAT,
        DOG,
        HORSE,
    };

    TypedArray<Animal> get_animals_that_should_go_in_a_house() const;
    TypedDictionary<Animal, ArrayMesh> get_animal_meshes() const;
};

VARIANT_ENUM_CAST(Foo::Animal);

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

@dsnopek dsnopek added the bug This has been identified as a bug label Jan 21, 2025
@dsnopek dsnopek added this to the 4.x milestone Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This has been identified as a bug
Projects
None yet
Development

No branches or pull requests

2 participants