Skip to content

List of methods that can be exported to Godot #672

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

Closed
Tracked by #767
ralpha opened this issue Jan 10, 2021 · 3 comments · Fixed by #781
Closed
Tracked by #767

List of methods that can be exported to Godot #672

ralpha opened this issue Jan 10, 2021 · 3 comments · Fixed by #781
Labels
c: bindings Component: GDNative bindings (mod api) documentation

Comments

@ralpha
Copy link

ralpha commented Jan 10, 2021

Add a list of methods to the documentation that can be exported to Godot (ex: _input(), _ready(),...) and most importantly the parameter/argument types.
There is the Godot documentation but this is not for the Rust structs. https://docs.godotengine.org/en/stable/classes/class_node.html#method-descriptions

Although not hard now. I was first struggling to find the right types that the parameters should have in Rust. Maybe add something like this to the doc page here:
https://docs.rs/gdnative/0.9.1/gdnative/attr.methods.html
Or links to Godot docs. As searching in rust docs (https://docs.rs/gdnative/0.9.1/gdnative/index.html?search=_input) does not turn of anything (useful).

Created this issue after posting it on Discord.

@ghost ghost added c: bindings Component: GDNative bindings (mod api) documentation labels Jan 11, 2021
@jacobsky
Copy link
Contributor

jacobsky commented Sep 3, 2021

@Bromeon I'll go ahead and work on this one. I think it's a natural extension to the work from documenting the #[export] tag :)

For now, I'll assume that we are primarily interested in virtual methods like _ready() that are lacking documentation and I will also assume that the main point of interest will be documenting things in Node and Control (to mention the _gui_input method). I'll also go ahead and link the relevant documentation so that we don't have to duplicate documenting "what it does" and can focus on "how to call it"

Please feel free to let me know if you have any other points you'd like me to mention. I'll try to get a PR in by early next week.

@Bromeon
Copy link
Member

Bromeon commented Sep 3, 2021

Yes, the focus are Node and Control methods, which are called by the engine. Things like _ready(), _process(), _enter_tree(), _input(), etc.

I agree that the signature, a one-liner explaining what it does and a link to the Godot docs would be good.
For example:

fn _physics_process(&self, owner: &Node, delta: f32);

Called during physics update, with a fixed timestamp.
See Godot docs for more information.

The question is where we want to add these docs?

@jacobsky
Copy link
Contributor

jacobsky commented Sep 5, 2021

@Bromeon I'll proceed by using that sample as the template for this change.

With regards to where it should be added, I was thinking that the NativeClass docs under #[export] would be the most fitting.

The reason is that I believe the biggest risk to not documenting is that a user may not be aware of which function names are reserved for Godot to call via notifications.

For example: If a user thinks "oh, I need a private method that processes some data occasionally, I'll just call it _process(&mut self, _owner: &Node, data; Instance<MyDataClass>) I'll connect this to the data instance as a signal callback", they will be a bit shocked to see 60+ errors per second as Godot fails to call the method due to incorrect parameter types.

That was just my line of thinking though.

jacobsky added a commit to jacobsky/godot-rust that referenced this issue Sep 6, 2021
jacobsky added a commit to jacobsky/godot-rust that referenced this issue Sep 6, 2021
jacobsky added a commit to jacobsky/godot-rust that referenced this issue Sep 6, 2021
jacobsky added a commit to jacobsky/godot-rust that referenced this issue Sep 6, 2021
…o the Godot Docs in the #[export] trait documentation.

Also fixed up as per the requests in PR godot-rust#781

closes godot-rust#672
jacobsky added a commit to jacobsky/godot-rust that referenced this issue Sep 6, 2021
…o the Godot Docs in the #[export] trait documentation.

Also fixed up as per the requests in PR godot-rust#781

closes godot-rust#672
jacobsky added a commit to jacobsky/godot-rust that referenced this issue Sep 7, 2021
…o the Godot Docs in the #[export] trait documentation.

Also fixed up as per the requests in PR godot-rust#781

closes godot-rust#672
jacobsky added a commit to jacobsky/godot-rust that referenced this issue Sep 13, 2021
…o the Godot Docs in the #[export] trait documentation.

Also fixed up as per the requests in PR godot-rust#781
Fixed the doc test failures.
closes godot-rust#672
bors bot added a commit that referenced this issue Sep 22, 2021
781: Added Godot exportable methods along with the expected signature r=jacobsky a=jacobsky

Added a list of the Godot Virtual methods from Node and Control to the #[export] trait documentation.

closes #672

Co-authored-by: Jacobsky <[email protected]>
@bors bors bot closed this as completed in 3cc09db Sep 22, 2021
Bromeon pushed a commit to Bromeon/godot-rust that referenced this issue Sep 27, 2021
…o the Godot Docs in the #[export] trait documentation.

Also fixed up as per the requests in PR godot-rust#781
Fixed the doc test failures.
closes godot-rust#672
Bogay pushed a commit to Bogay/godot-rust that referenced this issue Nov 17, 2021
…o the Godot Docs in the #[export] trait documentation.

Also fixed up as per the requests in PR godot-rust#781
Fixed the doc test failures.
closes godot-rust#672
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c: bindings Component: GDNative bindings (mod api) documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants