Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refine registration annotation handling #727

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

chippmann
Copy link
Contributor

@chippmann chippmann commented Oct 13, 2024

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 to GodotScript
  • RegisterSignal is dropped
  • RegisterProperty, RegisterConstructor and RegisterFunction are combined into GodotMember
  • Entry generation updated accordingly
  • Compile time checks updated accordingly
  • IDE plugin checks and warnings updated accordingly

To summarize the implemented registration changes from the proposal:

All

If a fine grained annotation is used (like Export, a type hint annotation, Rpc or Tool) a class or member does not have to be registered explicitly anymore. Annotations inherit from each other now

Classes

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A proposal for reducing the need for @Register annotations
2 participants