-
-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
Implement godot_new to allow instancing of binding types #9721
Conversation
This PR breaks script inheritance. Also you already can do that with the regular Godot API. GDScript for simplified code var gdnative_class = GDNativeScript.new()
gdnative_class.script_name = "MyClass"
gdnative_class.library = the_library_where_the_class_is
# then later somewhere
var myclass_instance = gdnative_class.new() |
Could you please clarify regarding script inheritance? If you mean the code removed that traverses data to get How does the binding code know the library name? Keep in mind I'd like to make it look like this for the user: |
modules/gdnative/godot.cpp
Outdated
if (class_info) | ||
return ((godot_class_constructor)class_info->creation_func)(); | ||
|
||
const Map<StringName, NativeLibrary *>& libraries = GDNativeScriptLanguage::get_singleton()->initialized_libraries; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change >& libraries
to > &libraries
to pass travis check.
Previously there was no way to create an object passing a class name previously registered by a native library. This commit adds implementation of godot_nativescript_new in nativescript module. It can instantiate the native script with the specified name, if the name does not belong to a native type.
@endragor this functionality can now get lifted to the bindings using the new initialization parameter. Can I close this? |
Yeah, closing this one. |
Previously there was no way to create an object passing a class name
previously registered by a native library. This commit adds
implementation of godot_new in gdnative module. It can instantiate
the native script with the specified name, if the name does not belong
to a native type.