-
-
Notifications
You must be signed in to change notification settings - Fork 263
Open
Labels
c: ffiLow-level components and interaction with GDExtension APILow-level components and interaction with GDExtension APIquality-of-lifeNo new functionality, but improves ergonomics/internalsNo new functionality, but improves ergonomics/internals
Milestone
Description
The PropertyInfo struct's purpose is 90% godot-rust internal type information, and 10% public API. As such, the latter has been neglected for the most part. Some public API examples:
ParamTuple::property_info(index: usize, param_name: &str) -> Option<PropertyInfo>IObject::get_property_list() -> Vec<PropertyInfo>
There are several issues related to `PropertyInfo:
-
Some methods like
property_sys(),empty_sys()should likely be private/hidden. -
There are naming collisions between
Object::get_property_listandIObject::get_property_list.- While Rust allows this, it can still be confusing. Godot solves this with the
_prefix. - We might want to rename some virtual methods to
on_*, to make clear that they're the queried as a result of some public method call. - Similar for
set/getvs.set_property/get_property-- something likeon_set/on_getmight be clearer. - Prior art:
on_notificationinstead of Godot's_notification.
- While Rust allows this, it can still be confusing. Godot solves this with the
-
The struct itself is quite low-level.
- This is probably OK if we recommend to use constructor
new_var::<T>("property_name") - However, field
class_id: ClassIdcannot be set for non-class properties, asClassIdhas no longer a publicnone()constructor.
Either we provide this, or data model needs to change (e.g. more towardsElementTypeenum, without script?)
- This is probably OK if we recommend to use constructor
-
There is also
MethodInfo, but it seems unused in public APIs? -
EditorSetting::add_property_info()andProjectSettings::add_property_info()take ahintbut as dictionary.- Could a conversion, or directly type-safe method help here?
Metadata
Metadata
Assignees
Labels
c: ffiLow-level components and interaction with GDExtension APILow-level components and interaction with GDExtension APIquality-of-lifeNo new functionality, but improves ergonomics/internalsNo new functionality, but improves ergonomics/internals