Open lilizoey opened 10 months ago
Thanks for listing all these functions, very useful! 👍
Two things to keep in mind:
Maybe handy: direct link to Godot's gdextension_interface.h on master
.
Recent updates:
is_abstract
I would exclude the following from the list -- let's only implement them if we have strong demand with concrete use cases.
get_virtual_call_data_func
-- this is an alternative to get_virtual_func
for languages like Go, no need right nowcall_virtual_with_data_func
-- sameclass_userdata
-- should remain reserved for gdext implementation. Metadata can always be added by the user as associated functions/constants.reference_func
-- too low-level.unreference_func
-- same.Furthermore, is_virtual
should probably not be set manually, but in conjunction with abstract classes (if that's implemented).
Let's make a concrete plan on what to support for which use cases, and then start working on them. Otherwise this becomes another eternal issue. If we don't have a use case right now, we can always open new issues once one comes up, but we shouldn't track all parameters pre-emptively just in case.
The only remaining one where I see immediate usefulness is get_rid_func
. This one behaves like a regular virtual function and should be part of the interface trait for every Resource
derived class. Note that this is being deprecated in favor of actual virtual functions in https://github.com/godotengine/godot/pull/96787; not sure if we want to add it for compat in older Godot versions.
Also ticked off a few that have been implemented in the meantime.
i think validate_property_func
would also be useful, it can be used to override properties defined by a superclass.
To register a class with godot we use the
GDExtensionClassCreationInfo
struct, which has two versions depending on the godot version: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
(https://github.com/godot-rust/gdext/pull/707)free_property_list_func
property_can_revert_func
property_get_revert_func
validate_property_func
notification_func
throughon_notification
in interfaceto_string_func
throughto_string
in interfacereference_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 thiscreate_instance_func
based oninit
function in interfacerecreate_instance_func
based oninit
function in interfaceget_virtual_func
generated from virtual method implementationsget_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 aboveget_rid_func
class_userdata
The planned builder-api would likely want the ability to set/override these options as desired.
[^1]: See this pr for information about what virtual vs abstract classes mean in godot