summaryrefslogtreecommitdiff
path: root/modules/gdnative/nativescript
diff options
context:
space:
mode:
authorkarroffel <therzog@mail.de>2018-01-06 12:31:30 +0100
committerkarroffel <therzog@mail.de>2018-01-06 12:31:30 +0100
commit34cdcf5cd0b4ea087b62ecae71c2ac86e06220a9 (patch)
treec60590845788f9adcc39bac7cabd68089cea538f /modules/gdnative/nativescript
parent0e6e98a65f26c915b5717992ba881cf33406c8bf (diff)
[GDNative] added reload property
Diffstat (limited to 'modules/gdnative/nativescript')
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index 61b59f92e8..2d94599ea0 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -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 {