-
-
Notifications
You must be signed in to change notification settings - Fork 218
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 abstraction for ScriptInstanceExtension
#196
Comments
Hi Sayaks, |
firstly you're likely gonna need to include both #204 and #207, or manually work around them then you can have a look at https://github.com/sayaks/godot-mun where i messed around with it a bit. i also actually documented some undocumented functions from godot. a lot of the code is messy especially because i did not have #204 or #207 implemented, you can see i used a hacky patch in the cargo.toml for gdext, and i also inlined some of the most (hopefully all) of the really hacky issues i faced are fixed in the two issues i mentioned. |
Thanks, It seems that in C++ I needed to define the function (I wanted to point at in GDExtensionScriptInstanceInfo) outside any class definition. |
Implemented in #492. |
When creating a language extension for godot, you need to create instances of your scripts. These are the actual objects that will run the code that your scripts define. For performance reasons, these are not normal godot classes, but instead a pointer to the instance and a vtable (struct of function pointers).
This means that if you want to use/create these instances, you currently need to do a lot of manual pointer casting and ffi-stuff. Generally through the method
script_instance_create
and using theGDExtensionScriptInstanceInfo
struct directly.Ideally there would be some abstraction, probably a trait or something that will let you easily create the instance, and a trait for the
GDExtensionScriptInstanceInfo
struct, as it is effectively just an interface for what methods are supported.Another issue is that this is almost entirely undocumented, as there is no godot documentation page (that i could find) that talks about this.
The text was updated successfully, but these errors were encountered: