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

Add automatic generation of getters and setters to GDCLASS and a helper macro for using them #1401

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

Conversation

TeagabC
Copy link

@TeagabC TeagabC commented Mar 4, 2024

First time PR here.

This lets you add properties without defining setters and getters. Example usage:

class Example : public Node {
  GDCLASS(Example, Node)
protected:
  static void _bind_methods();
public:
  int x;
};

void Example::_bind_methods() {
  AUTO_ADD_PROPERTY(PropertyInfo(Variant::INT, "x"), &Example::x);
}

It achieves it by adding templated getters and setters in GDCLASS. Is this something you would consider adding support for? Thanks

@TeagabC TeagabC requested a review from a team as a code owner March 4, 2024 02:06
@dsnopek
Copy link
Collaborator

dsnopek commented Mar 5, 2024

Thanks!

However, one of the design goals of godot-cpp is to be as API compatible with Godot modules as possible, allowing GDExtensions to optionally be compiled as modules, and for code to freely move between modules and GDExtensions.

So, in order to add something like this to godot-cpp, support for it would first need to be added to Godot itself.

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.

3 participants