Refine registration annotation handling #727
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #606
This refines how we register annotations according to the linked proposal (specifically this comment and refined by this comment)
It includes the following changes:
RegisterClass
is renamed toGodotScript
RegisterSignal
is droppedRegisterProperty
,RegisterConstructor
andRegisterFunction
are combined intoGodotMember
To summarize the implemented registration changes from the proposal:
All
If a fine grained annotation is used (like
Export
, a type hint annotation,Rpc
orTool
) a class or member does not have to be registered explicitly anymore. Annotations inherit from each other nowClasses
Classes still need to be registered manually (reason for this is outlined in this comment).
Signals
Signals no longer need to be registered at all. As they are only of use in Godot anyway, their sole existence in code is already documentation and hint enough that they should be exposed to godot
Properties
Still need to be annotated explicitly. If a property is registered in a parent class, it "inherits" that registration status even if not explicitly registered again in a child class (no matter if the child class overrides the property or not).
Functions
User defined functions still need to be registered manually. Like properties, they inherit their registration status from parent classes.
Godot api functions which are overridden in child classes (like
_ready
or_process
) do not need to be registered explicitly anymore. They are godot api functions and thus are always relevant to godot.