Type `GDNativePropertyInfo.type` field as `GDNativeVariantType`

pull/888/head
Emmanuel Leblond 2022-10-09 23:21:32 +02:00
parent 779eaba428
commit b21931c4a3
No known key found for this signature in database
GPG Key ID: C360860E645EFFC0
4 changed files with 9 additions and 9 deletions

View File

@ -201,18 +201,18 @@ typedef GDNativeBool (*GDNativeExtensionClassGet)(GDExtensionClassInstancePtr p_
typedef uint64_t (*GDNativeExtensionClassGetRID)(GDExtensionClassInstancePtr p_instance); typedef uint64_t (*GDNativeExtensionClassGetRID)(GDExtensionClassInstancePtr p_instance);
typedef struct { typedef struct {
uint32_t type; GDNativeVariantType type;
const char *name; const char *name;
const char *class_name; const char *class_name;
uint32_t hint; uint32_t hint; // Bitfield of `PropertyHint` (defined in `extension_api.json`)
const char *hint_string; const char *hint_string;
uint32_t usage; uint32_t usage; // Bitfield of `PropertyUsageFlags` (defined in `extension_api.json`)
} GDNativePropertyInfo; } GDNativePropertyInfo;
typedef struct { typedef struct {
const char *name; const char *name;
GDNativePropertyInfo return_value; GDNativePropertyInfo return_value;
uint32_t flags; // From GDNativeExtensionClassMethodFlags uint32_t flags; // Bitfield of `GDNativeExtensionClassMethodFlags`
int32_t id; int32_t id;
GDNativePropertyInfo *arguments; GDNativePropertyInfo *arguments;
uint32_t argument_count; uint32_t argument_count;
@ -293,7 +293,7 @@ typedef struct {
void *method_userdata; void *method_userdata;
GDNativeExtensionClassMethodCall call_func; GDNativeExtensionClassMethodCall call_func;
GDNativeExtensionClassMethodPtrCall ptrcall_func; GDNativeExtensionClassMethodPtrCall ptrcall_func;
uint32_t method_flags; /* GDNativeExtensionClassMethodFlags */ uint32_t method_flags; // Bitfield of `GDNativeExtensionClassMethodFlags`
uint32_t argument_count; uint32_t argument_count;
GDNativeBool has_return_value; GDNativeBool has_return_value;
GDNativeExtensionClassMethodGetArgumentType get_argument_type_func; GDNativeExtensionClassMethodGetArgumentType get_argument_type_func;

View File

@ -219,7 +219,7 @@ public:
cls->plist = reinterpret_cast<GDNativePropertyInfo *>(memalloc(sizeof(GDNativePropertyInfo) * list.size())); \ cls->plist = reinterpret_cast<GDNativePropertyInfo *>(memalloc(sizeof(GDNativePropertyInfo) * list.size())); \
cls->plist_size = 0; \ cls->plist_size = 0; \
for (const ::godot::PropertyInfo &E : list) { \ for (const ::godot::PropertyInfo &E : list) { \
cls->plist[cls->plist_size].type = E.type; \ cls->plist[cls->plist_size].type = static_cast<GDNativeVariantType>(E.type); \
cls->plist[cls->plist_size].name = _alloc_and_copy_cstr(E.name.utf8().get_data()); \ cls->plist[cls->plist_size].name = _alloc_and_copy_cstr(E.name.utf8().get_data()); \
cls->plist[cls->plist_size].hint = E.hint; \ cls->plist[cls->plist_size].hint = E.hint; \
cls->plist[cls->plist_size].hint_string = _alloc_and_copy_cstr(E.hint_string.utf8().get_data()); \ cls->plist[cls->plist_size].hint_string = _alloc_and_copy_cstr(E.hint_string.utf8().get_data()); \

View File

@ -182,7 +182,7 @@ public:
for (int i = 0; i < p_method_info.arguments.size(); i++) { for (int i = 0; i < p_method_info.arguments.size(); i++) {
names.push_back(p_method_info.arguments[i].name.utf8().get_data()); names.push_back(p_method_info.arguments[i].name.utf8().get_data());
arguments.push_back(GDNativePropertyInfo{ arguments.push_back(GDNativePropertyInfo{
static_cast<uint32_t>(p_method_info.arguments[i].type), // uint32_t type; static_cast<GDNativeVariantType>(p_method_info.arguments[i].type), // GDNativeVariantType type;
_alloc_and_copy_cstr(p_method_info.arguments[i].name.utf8().get_data()), // const char *name; _alloc_and_copy_cstr(p_method_info.arguments[i].name.utf8().get_data()), // const char *name;
_alloc_and_copy_cstr(p_method_info.arguments[i].class_name.utf8().get_data()), // const char *class_name; _alloc_and_copy_cstr(p_method_info.arguments[i].class_name.utf8().get_data()), // const char *class_name;
p_method_info.arguments[i].hint, // NONE //uint32_t hint; p_method_info.arguments[i].hint, // NONE //uint32_t hint;

View File

@ -95,7 +95,7 @@ void ClassDB::add_property(const char *p_class, const PropertyInfo &p_pinfo, con
// register with Godot // register with Godot
GDNativePropertyInfo prop_info = { GDNativePropertyInfo prop_info = {
static_cast<uint32_t>(p_pinfo.type), // uint32_t type; static_cast<GDNativeVariantType>(p_pinfo.type), // GDNativeVariantType type;
_alloc_and_copy_cstr(p_pinfo.name.utf8().get_data()), // const char *name; _alloc_and_copy_cstr(p_pinfo.name.utf8().get_data()), // const char *name;
_alloc_and_copy_cstr(p_pinfo.class_name.utf8().get_data()), // const char *class_name; _alloc_and_copy_cstr(p_pinfo.class_name.utf8().get_data()), // const char *class_name;
p_pinfo.hint, // NONE //uint32_t hint; p_pinfo.hint, // NONE //uint32_t hint;
@ -241,7 +241,7 @@ void ClassDB::add_signal(const char *p_class, const MethodInfo &p_signal) {
for (const PropertyInfo &par : p_signal.arguments) { for (const PropertyInfo &par : p_signal.arguments) {
parameters.push_back(GDNativePropertyInfo{ parameters.push_back(GDNativePropertyInfo{
static_cast<uint32_t>(par.type), // uint32_t type; static_cast<GDNativeVariantType>(par.type), // GDNativeVariantType type;
_alloc_and_copy_cstr(par.name.utf8().get_data()), // const char *name; _alloc_and_copy_cstr(par.name.utf8().get_data()), // const char *name;
_alloc_and_copy_cstr(par.class_name.utf8().get_data()), // const char *class_name; _alloc_and_copy_cstr(par.class_name.utf8().get_data()), // const char *class_name;
par.hint, // NONE //uint32_t hint; par.hint, // NONE //uint32_t hint;