[GDNative] added reload property
This commit is contained in:
@ -1111,7 +1111,13 @@ void NativeReloadNode::_notification(int p_what) {
|
||||
NSL->_unload_stuff();
|
||||
for (Map<String, Ref<GDNative> >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) {
|
||||
|
||||
L->get()->terminate();
|
||||
Ref<GDNative> gdn = L->get();
|
||||
|
||||
if (!gdn->get_library()->is_reloadable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
gdn->terminate();
|
||||
NSL->library_classes.erase(L->key());
|
||||
}
|
||||
|
||||
@ -1129,21 +1135,23 @@ void NativeReloadNode::_notification(int p_what) {
|
||||
Set<StringName> libs_to_remove;
|
||||
for (Map<String, Ref<GDNative> >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) {
|
||||
|
||||
if (!L->get()->initialize()) {
|
||||
Ref<GDNative> gdn = L->get();
|
||||
|
||||
if (!gdn->get_library()->is_reloadable()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!gdn->initialize()) {
|
||||
libs_to_remove.insert(L->key());
|
||||
continue;
|
||||
}
|
||||
|
||||
NSL->library_classes.insert(L->key(), Map<StringName, NativeScriptDesc>());
|
||||
|
||||
void *args[1] = {
|
||||
(void *)&L->key()
|
||||
};
|
||||
|
||||
// here the library registers all the classes and stuff.
|
||||
|
||||
void *proc_ptr;
|
||||
Error err = L->get()->get_symbol(L->get()->get_library()->get_symbol_prefix() + "nativescript_init", proc_ptr);
|
||||
Error err = gdn->get_symbol(gdn->get_library()->get_symbol_prefix() + "nativescript_init", proc_ptr);
|
||||
if (err != OK) {
|
||||
ERR_PRINT(String("No godot_nativescript_init in \"" + L->key() + "\" found").utf8().get_data());
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user