gdext
gdext copied to clipboard
Classes at wrong init level
PhysicsServer2D/3D
and their related classes should be at Server
.
Sometimes one would want to inherit from Object
but have a class available before Scene
. Could Object
have its init level just be Core
/Server
or something?
PhysicsServer2D/3D
and their related classes should be atServer
.
Ah yeah, the great heuristic "ends in 'Server'" because GDExtension doesn't expose the init level 😁
Could
Object
have its init level just beCore
/Server
or something?
Since other classes inherit from Object
and are loaded earlier, that implies that Object
itself should also be available at that time, so probably yes?
Are there other such classes (RefCounted
or Resource
) which are available earlier?
However, if we allow different init levels for user-defined classes, we may need to consider that "assume base class' init level" may not be desired. It wouldn't matter if no custom registration logic is run, but as soon as we have builders and user-defined register_class()
overrides, it's possible that the user expects Scene
level unless specified otherwise.
However, if we allow different init levels for user-defined classes, we may need to consider that "assume base class' init level" may not be desired. It wouldn't matter if no custom registration logic is run, but as soon as we have builders and user-defined
register_class()
overrides, it's possible that the user expectsScene
level unless specified otherwise.
Maybe we should have everything get registered at Scene
by default, unless the base class uses Editor
. And allow the user to specify the level manually if they want earlier. Failing (ideally at compile time but maybe only runtime is feasible?) if they try to register it earlier than the base class.
Fixed by https://github.com/godot-rust/gdext/pull/680.