@@ -39,6 +39,7 @@ cdef inline void unregister_extension_class(bytes class_name) noexcept:
3939 # Note we cannot free the spec given we don't know if the unregister operation has succeeded
4040 # TODO: correct me once https://github.com/godotengine/godot/pull/67121 is merged
4141
42+
4243cdef inline void _extension_class_to_string(GDExtensionClassInstancePtr p_instance, GDExtensionBool * r_is_valid, GDExtensionStringPtr p_out) noexcept with gil:
4344 cdef ExtensionClassSpec spec = < ExtensionClassSpec> p_instance
4445 (< gd_string_t* > p_out)[0 ] = gd_string_from_pybytes(spec.class_name)
@@ -51,6 +52,9 @@ cdef inline void register_extension_class_creation(
5152 GDExtensionClassCreateInstance create_instance_func,
5253 GDExtensionClassFreeInstance free_instance_func,
5354 GDExtensionClassGetVirtual get_virtual_func,
55+ bint is_virtual,
56+ bint is_abstract,
57+ bint is_exposed,
5458) noexcept:
5559 cdef ExtensionClassSpec spec = ExtensionClassSpec()
5660 spec.class_name = class_name
@@ -60,29 +64,43 @@ cdef inline void register_extension_class_creation(
6064 cdef list specs_list = _get_extension_gc_protector()
6165 specs_list.append(spec)
6266
63- # TODO: replace by `GDExtensionClassCreationInfo2`
64- cdef GDExtensionClassCreationInfo info
67+ cdef GDExtensionClassCreationInfo2 info
68+ info.is_virtual = is_virtual
69+ info.is_abstract = is_abstract
70+ info.is_exposed = is_exposed
6571 info.set_func = NULL # GDExtensionClassSet
6672 info.get_func = NULL # GDExtensionClassGet
6773 info.get_property_list_func = NULL # GDExtensionClassGetPropertyList
6874 info.free_property_list_func = NULL # GDExtensionClassFreePropertyList
6975 info.property_can_revert_func = NULL # GDExtensionClassPropertyCanRevert
7076 info.property_get_revert_func = NULL # GDExtensionClassPropertyGetRevert
71- info.notification_func = NULL # GDExtensionClassNotification
77+ info.validate_property_func = NULL # GDExtensionClassValidateProperty
78+ info.notification_func = NULL # GDExtensionClassNotification2
7279 info.to_string_func = & _extension_class_to_string # GDExtensionClassToString
7380 info.reference_func = NULL # GDExtensionClassReference
7481 info.unreference_func = NULL # GDExtensionClassUnreference
7582 info.create_instance_func = create_instance_func
7683 info.free_instance_func = free_instance_func
84+ info.recreate_instance_func = NULL # GDExtensionClassRecreateInstance
85+ # Queries a virtual function by name and returns a callback to invoke the requested virtual function.
7786 info.get_virtual_func = get_virtual_func
87+ # Paired with `call_virtual_with_data_func`, this is an alternative to `get_virtual_func` for extensions that
88+ # need or benefit from extra data when calling virtual functions.
89+ # Returns user data that will be passed to `call_virtual_with_data_func`.
90+ # Returning `NULL` from this function signals to Godot that the virtual function is not overridden.
91+ # Data returned from this function should be managed by the extension and must be valid until the extension is deinitialized.
92+ # You should supply either `get_virtual_func`, or `get_virtual_call_data_func` with `call_virtual_with_data_func`.
93+ info.get_virtual_call_data_func = NULL # GDExtensionClassGetVirtualCallData
94+ # Used to call virtual functions when `get_virtual_call_data_func` is not null.
95+ info.call_virtual_with_data_func = NULL # GDExtensionClassCallVirtualWithData
7896 info.get_rid_func = NULL # GDExtensionClassGetRID
7997 # Don't increment refcount given we rely on gc protector
8098 info.class_userdata = < void * > spec # void*
8199
82100 cdef gd_string_name_t gdname = gd_string_name_from_utf8_and_len(< char * > class_name, len (class_name))
83101 cdef gd_string_name_t gdname_parent = gd_string_name_from_utf8_and_len(< char * > parent_class_name, len (parent_class_name))
84102 # TODO: correct me once https://github.com/godotengine/godot/pull/67121 is merged
85- pythonscript_gdextension.classdb_register_extension_class (
103+ pythonscript_gdextension.classdb_register_extension_class2 (
86104 pythonscript_gdextension_library,
87105 & gdname,
88106 & gdname_parent,
@@ -385,6 +403,9 @@ cdef inline void register_extension_class_method(
385403 if info.arguments_info != NULL :
386404 free(info.arguments_info)
387405
406+ if info.arguments_metadata != NULL :
407+ free(info.arguments_metadata)
408+
388409 # TODO: free `info.default_arguments`
389410
390411 # TODO: correct me once https://github.com/godotengine/godot/pull/67121 is merged
0 commit comments