-
-
Notifications
You must be signed in to change notification settings - Fork 554
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
Using TypedArray with an enum causes 'get_class_static' is not a member of ... #1584
Comments
Does it work if you use |
I might be missing something but I don't seem to be able to use MAKE_TYPED_ARRAY_INFO. I tried to add it to the end of my Direction.hpp file after I also tried to add what would be result of the macro directly in the Direction.hpp file but I still get the same error #pragma once
namespace Game {
enum Direction {
Up,
Down,
Left,
Right
};
}
VARIANT_ENUM_CAST(Game::Direction)
namespace godot {
template<>
struct GetTypeInfo<TypedArray<Game::Direction>> {
static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_ARRAY;
static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
static inline PropertyInfo get_class_info() {
return make_property_info(Variant::Type::ARRAY,
"",
PROPERTY_HINT_ARRAY_TYPE,
Variant::get_type_name(Variant::INT).utf8().get_data());
}
};
template<>
struct GetTypeInfo<const TypedArray<Game::Direction>&> {
static constexpr GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_ARRAY;
static constexpr GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
static inline PropertyInfo get_class_info() {
return make_property_info(Variant::Type::ARRAY,
"",
PROPERTY_HINT_ARRAY_TYPE,
Variant::get_type_name(Variant::INT).utf8().get_data());
}
};
} |
It looks like it compiles to something that shows up in Godot as Edit: if I replace the |
@BenLubar Thanks, using both MAKE_TYPED_ARRAY(Game::Direction, godot::Variant::INT)
MAKE_TYPED_ARRAY_INFO(Game::Direction, godot::Variant::INT) As for showing up in Godot as ClassDB::bind_method(D_METHOD("set_sequence", "sequence"), SetSequence);
ClassDB::bind_method(D_METHOD("get_sequence"), GetSequence);
ADD_PROPERTY(
PropertyInfo(Variant::ARRAY, "sequence", PROPERTY_HINT_TYPE_STRING, String::num(Variant::INT) + "/"
+ String::num(PROPERTY_HINT_ENUM) + ":Up,Down,Left,Right"),
"set_sequence",
"get_sequence"); |
Godot version
4.3
godot-cpp version
4.3
System information
Windows 11
Issue description
When creating a TypedArray the following error occurs:
Steps to reproduce
Create an enum like so:
Try to use it as the type for a TypedArray like so:
Minimal reproduction project
N/A
The text was updated successfully, but these errors were encountered: