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

GDExtension missing CallableCustom class and methods #79065

Closed
Trey2k opened this issue Jul 5, 2023 · 4 comments
Closed

GDExtension missing CallableCustom class and methods #79065

Trey2k opened this issue Jul 5, 2023 · 4 comments

Comments

@Trey2k
Copy link

Trey2k commented Jul 5, 2023

Godot version

4.x

System information

N/A

Issue description

Currently GDExtension does not have access to the CallableCustom type at all. We can test if a Callable is custom but that's about it. This has become an issue for a addon I maintain that supports building as a module and GDExtension. The addon adds access to the luaAPI for godot. Before adding support for GDExtension when Lua tried to pass a function to GD we would create a Lua func ref and had a CallableCustom class which took that and invoked the Lua func ref in the call method. Creating a Lua func ref makes a copy of the method that must be cleaned up, so we would do that in the deconstructor.

However, when adding GDExtension support I found we don't get access to this class at all. The workaround I used was to expose a method to the class DB that took an array of args and the func ref, when Lua passed a function to GD we would return the Callable with the func ref bound.

There is 2 major issues with this workaround. It forces us to take the arguments as an array instead of being able to take any number. And the bigger issue IMO we do not have a deconstructor meaning I have no way of cleaning up the func ref.

Along with the missing class, Callable itself is also missing methods. We have is_custom(), but are notably missing get_custom(). I assume this is since the class isn't even exposed.

Steps to reproduce

  • Generate the extension_api.json and gdextension_interace.h files with: godot --dump-extension-api --dump-gdextension-interface
  • Search for CallableCustom in these files.

Minimal reproduction project

N/A

@AThousandShips
Copy link
Member

@Trey2k
Copy link
Author

Trey2k commented Jul 5, 2023

Ah that didnt turn up in my issue search for some reason

@Trey2k Trey2k closed this as completed Jul 5, 2023
@AThousandShips
Copy link
Member

It's not an issue but a PR

@Bromeon
Copy link
Contributor

Bromeon commented Feb 20, 2024

This was implemented in #79005.

@Bromeon Bromeon closed this as completed Feb 20, 2024
@akien-mga akien-mga added this to the 4.2 milestone Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants