GDExtension: provide `free_property_list_func` with length of array
This commit is contained in:
parent
11d3768132
commit
27a637d287
|
@ -387,7 +387,7 @@ void GDExtension::_register_extension_class(GDExtensionClassLibraryPtr p_library
|
|||
p_extension_funcs->set_func, // GDExtensionClassSet set_func;
|
||||
p_extension_funcs->get_func, // GDExtensionClassGet get_func;
|
||||
p_extension_funcs->get_property_list_func, // GDExtensionClassGetPropertyList get_property_list_func;
|
||||
p_extension_funcs->free_property_list_func, // GDExtensionClassFreePropertyList free_property_list_func;
|
||||
nullptr, // GDExtensionClassFreePropertyList2 free_property_list_func;
|
||||
p_extension_funcs->property_can_revert_func, // GDExtensionClassPropertyCanRevert property_can_revert_func;
|
||||
p_extension_funcs->property_get_revert_func, // GDExtensionClassPropertyGetRevert property_get_revert_func;
|
||||
nullptr, // GDExtensionClassValidateProperty validate_property_func;
|
||||
|
@ -406,7 +406,8 @@ void GDExtension::_register_extension_class(GDExtensionClassLibraryPtr p_library
|
|||
};
|
||||
|
||||
const ClassCreationDeprecatedInfo legacy = {
|
||||
p_extension_funcs->notification_func,
|
||||
p_extension_funcs->notification_func, // GDExtensionClassNotification notification_func;
|
||||
p_extension_funcs->free_property_list_func, // GDExtensionClassFreePropertyList free_property_list_func;
|
||||
};
|
||||
_register_extension_class_internal(p_library, p_class_name, p_parent_class_name, &class_info3, &legacy);
|
||||
}
|
||||
|
@ -420,7 +421,7 @@ void GDExtension::_register_extension_class2(GDExtensionClassLibraryPtr p_librar
|
|||
p_extension_funcs->set_func, // GDExtensionClassSet set_func;
|
||||
p_extension_funcs->get_func, // GDExtensionClassGet get_func;
|
||||
p_extension_funcs->get_property_list_func, // GDExtensionClassGetPropertyList get_property_list_func;
|
||||
p_extension_funcs->free_property_list_func, // GDExtensionClassFreePropertyList free_property_list_func;
|
||||
nullptr, // GDExtensionClassFreePropertyList2 free_property_list_func;
|
||||
p_extension_funcs->property_can_revert_func, // GDExtensionClassPropertyCanRevert property_can_revert_func;
|
||||
p_extension_funcs->property_get_revert_func, // GDExtensionClassPropertyGetRevert property_get_revert_func;
|
||||
p_extension_funcs->validate_property_func, // GDExtensionClassValidateProperty validate_property_func;
|
||||
|
@ -438,7 +439,11 @@ void GDExtension::_register_extension_class2(GDExtensionClassLibraryPtr p_librar
|
|||
p_extension_funcs->class_userdata, // void *class_userdata;
|
||||
};
|
||||
|
||||
_register_extension_class_internal(p_library, p_class_name, p_parent_class_name, &class_info3);
|
||||
const ClassCreationDeprecatedInfo legacy = {
|
||||
nullptr, // GDExtensionClassNotification notification_func;
|
||||
p_extension_funcs->free_property_list_func, // GDExtensionClassFreePropertyList free_property_list_func;
|
||||
};
|
||||
_register_extension_class_internal(p_library, p_class_name, p_parent_class_name, &class_info3, &legacy);
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
|
@ -514,13 +519,14 @@ void GDExtension::_register_extension_class_internal(GDExtensionClassLibraryPtr
|
|||
extension->gdextension.set = p_extension_funcs->set_func;
|
||||
extension->gdextension.get = p_extension_funcs->get_func;
|
||||
extension->gdextension.get_property_list = p_extension_funcs->get_property_list_func;
|
||||
extension->gdextension.free_property_list = p_extension_funcs->free_property_list_func;
|
||||
extension->gdextension.free_property_list2 = p_extension_funcs->free_property_list_func;
|
||||
extension->gdextension.property_can_revert = p_extension_funcs->property_can_revert_func;
|
||||
extension->gdextension.property_get_revert = p_extension_funcs->property_get_revert_func;
|
||||
extension->gdextension.validate_property = p_extension_funcs->validate_property_func;
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
if (p_deprecated_funcs) {
|
||||
extension->gdextension.notification = p_deprecated_funcs->notification_func;
|
||||
extension->gdextension.free_property_list = p_deprecated_funcs->free_property_list_func;
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
extension->gdextension.notification2 = p_extension_funcs->notification_func;
|
||||
|
|
|
@ -71,6 +71,7 @@ class GDExtension : public Resource {
|
|||
struct ClassCreationDeprecatedInfo {
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
GDExtensionClassNotification notification_func = nullptr;
|
||||
GDExtensionClassFreePropertyList free_property_list_func = nullptr;
|
||||
#endif // DISABLE_DEPRECATED
|
||||
};
|
||||
|
||||
|
|
|
@ -256,6 +256,7 @@ typedef struct {
|
|||
|
||||
typedef const GDExtensionPropertyInfo *(*GDExtensionClassGetPropertyList)(GDExtensionClassInstancePtr p_instance, uint32_t *r_count);
|
||||
typedef void (*GDExtensionClassFreePropertyList)(GDExtensionClassInstancePtr p_instance, const GDExtensionPropertyInfo *p_list);
|
||||
typedef void (*GDExtensionClassFreePropertyList2)(GDExtensionClassInstancePtr p_instance, const GDExtensionPropertyInfo *p_list, uint32_t p_count);
|
||||
typedef GDExtensionBool (*GDExtensionClassPropertyCanRevert)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name);
|
||||
typedef GDExtensionBool (*GDExtensionClassPropertyGetRevert)(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name, GDExtensionVariantPtr r_ret);
|
||||
typedef GDExtensionBool (*GDExtensionClassValidateProperty)(GDExtensionClassInstancePtr p_instance, GDExtensionPropertyInfo *p_property);
|
||||
|
@ -333,7 +334,7 @@ typedef struct {
|
|||
GDExtensionClassSet set_func;
|
||||
GDExtensionClassGet get_func;
|
||||
GDExtensionClassGetPropertyList get_property_list_func;
|
||||
GDExtensionClassFreePropertyList free_property_list_func;
|
||||
GDExtensionClassFreePropertyList2 free_property_list_func;
|
||||
GDExtensionClassPropertyCanRevert property_can_revert_func;
|
||||
GDExtensionClassPropertyGetRevert property_get_revert_func;
|
||||
GDExtensionClassValidateProperty validate_property_func;
|
||||
|
|
|
@ -138,7 +138,7 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static void placeholder_instance_free_property_list(GDExtensionClassInstancePtr p_instance, const GDExtensionPropertyInfo *p_list) {
|
||||
static void placeholder_instance_free_property_list(GDExtensionClassInstancePtr p_instance, const GDExtensionPropertyInfo *p_list, uint32_t p_count) {
|
||||
}
|
||||
|
||||
static GDExtensionBool placeholder_instance_property_can_revert(GDExtensionClassInstancePtr p_instance, GDExtensionConstStringNamePtr p_name) {
|
||||
|
@ -600,12 +600,13 @@ ObjectGDExtension *ClassDB::get_placeholder_extension(const StringName &p_class)
|
|||
placeholder_extension->set = &PlaceholderExtensionInstance::placeholder_instance_set;
|
||||
placeholder_extension->get = &PlaceholderExtensionInstance::placeholder_instance_get;
|
||||
placeholder_extension->get_property_list = &PlaceholderExtensionInstance::placeholder_instance_get_property_list;
|
||||
placeholder_extension->free_property_list = &PlaceholderExtensionInstance::placeholder_instance_free_property_list;
|
||||
placeholder_extension->free_property_list2 = &PlaceholderExtensionInstance::placeholder_instance_free_property_list;
|
||||
placeholder_extension->property_can_revert = &PlaceholderExtensionInstance::placeholder_instance_property_can_revert;
|
||||
placeholder_extension->property_get_revert = &PlaceholderExtensionInstance::placeholder_instance_property_get_revert;
|
||||
placeholder_extension->validate_property = &PlaceholderExtensionInstance::placeholder_instance_validate_property;
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
placeholder_extension->notification = nullptr;
|
||||
placeholder_extension->free_property_list = nullptr;
|
||||
#endif // DISABLE_DEPRECATED
|
||||
placeholder_extension->notification2 = &PlaceholderExtensionInstance::placeholder_instance_notification;
|
||||
placeholder_extension->to_string = &PlaceholderExtensionInstance::placeholder_instance_to_string;
|
||||
|
|
|
@ -503,9 +503,14 @@ void Object::get_property_list(List<PropertyInfo> *p_list, bool p_reversed) cons
|
|||
for (uint32_t i = 0; i < pcount; i++) {
|
||||
p_list->push_back(PropertyInfo(pinfo[i]));
|
||||
}
|
||||
if (current_extension->free_property_list) {
|
||||
if (current_extension->free_property_list2) {
|
||||
current_extension->free_property_list2(_extension_instance, pinfo, pcount);
|
||||
}
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
else if (current_extension->free_property_list) {
|
||||
current_extension->free_property_list(_extension_instance, pinfo);
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
#ifdef TOOLS_ENABLED
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -324,12 +324,13 @@ struct ObjectGDExtension {
|
|||
GDExtensionClassSet set;
|
||||
GDExtensionClassGet get;
|
||||
GDExtensionClassGetPropertyList get_property_list;
|
||||
GDExtensionClassFreePropertyList free_property_list;
|
||||
GDExtensionClassFreePropertyList2 free_property_list2;
|
||||
GDExtensionClassPropertyCanRevert property_can_revert;
|
||||
GDExtensionClassPropertyGetRevert property_get_revert;
|
||||
GDExtensionClassValidateProperty validate_property;
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
GDExtensionClassNotification notification;
|
||||
GDExtensionClassFreePropertyList free_property_list;
|
||||
#endif // DISABLE_DEPRECATED
|
||||
GDExtensionClassNotification2 notification2;
|
||||
GDExtensionClassToString to_string;
|
||||
|
|
Loading…
Reference in New Issue