From 34cdcf5cd0b4ea087b62ecae71c2ac86e06220a9 Mon Sep 17 00:00:00 2001 From: karroffel Date: Sat, 6 Jan 2018 12:31:30 +0100 Subject: [GDNative] added reload property --- modules/gdnative/nativescript/nativescript.cpp | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'modules/gdnative/nativescript') 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 >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) { - L->get()->terminate(); + Ref 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 libs_to_remove; for (Map >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) { - if (!L->get()->initialize()) { + Ref 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()); - 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 { -- cgit v1.2.3