Open
Description
Edit bromeon: updated list according to latest developments.
To register a class with godot we use the GDExtensionClassCreationInfo
struct, which has two versions depending on the godot version:
pub struct GDExtensionClassCreationInfo2 {
pub is_virtual: GDExtensionBool,
pub is_abstract: GDExtensionBool,
pub is_exposed: GDExtensionBool, // only in 2
pub set_func: GDExtensionClassSet,
pub get_func: GDExtensionClassGet,
pub get_property_list_func: GDExtensionClassGetPropertyList,
pub free_property_list_func: GDExtensionClassFreePropertyList,
pub property_can_revert_func: GDExtensionClassPropertyCanRevert,
pub property_get_revert_func: GDExtensionClassPropertyGetRevert,
pub validate_property_func: GDExtensionClassValidateProperty, // only in 2
pub notification_func: GDExtensionClassNotification2, // different type in 2
pub to_string_func: GDExtensionClassToString,
pub reference_func: GDExtensionClassReference,
pub unreference_func: GDExtensionClassUnreference,
pub create_instance_func: GDExtensionClassCreateInstance,
pub free_instance_func: GDExtensionClassFreeInstance,
pub recreate_instance_func: GDExtensionClassRecreateInstance,
pub get_virtual_func: GDExtensionClassGetVirtual,
pub get_virtual_call_data_func: GDExtensionClassGetVirtualCallData, // only in 2
pub call_virtual_with_data_func: GDExtensionClassCallVirtualWithData, // only in 2
pub get_rid_func: GDExtensionClassGetRID,
pub class_userdata: *mut ::std::os::raw::c_void,
}
Each corresponding to something configurable about class registration.
Current state of user-available registration options:
-
is_virtual
1 -
is_abstract
we might need to set this to true for classes that cant be instantiated 1 -
is_exposed
-
set_func
-
get_func
-
get_property_list_func
(Addget_property_list
#707) -
free_property_list_func
-
property_can_revert_func
-
property_get_revert_func
-
validate_property_func
-
notification_func
throughon_notification
in interface -
to_string_func
throughto_string
in interface -
create_instance_func
based oninit
function in interface -
recreate_instance_func
based oninit
function in interface -
get_virtual_func
generated from virtual method implementations
Not necessary
get_rid_func
-- already available in regular class APIsget_virtual_call_data_func
-- mutually exclusive withget_virtual_func
, will not implement without a use-casecall_virtual_with_data_func
-- must be implemented along with above
Not planned for now
class_userdata
reference_func
-- is used to update the refcount, but the user cannot add custom logic to thisunreference_func
-- is used to update the refcount, but the user cannot add custom logic to this
The planned builder-api would likely want the ability to set/override these options as desired.