summaryrefslogtreecommitdiff
path: root/modules/gdnative
diff options
context:
space:
mode:
Diffstat (limited to 'modules/gdnative')
-rw-r--r--modules/gdnative/gdnative.cpp2
-rw-r--r--modules/gdnative/gdnative.h2
-rw-r--r--modules/gdnative/gdnative/variant.cpp12
-rw-r--r--modules/gdnative/gdnative_library_editor_plugin.cpp22
-rw-r--r--modules/gdnative/gdnative_library_singleton_editor.cpp6
-rw-r--r--modules/gdnative/include/gdnative/pool_arrays.h4
-rw-r--r--modules/gdnative/include/gdnative/variant.h14
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp63
-rw-r--r--modules/gdnative/nativescript/nativescript.h14
-rw-r--r--modules/gdnative/pluginscript/pluginscript_language.cpp25
-rw-r--r--modules/gdnative/pluginscript/pluginscript_language.h2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_loader.cpp2
-rw-r--r--modules/gdnative/pluginscript/pluginscript_loader.h2
-rw-r--r--modules/gdnative/videodecoder/video_stream_gdnative.cpp2
-rw-r--r--modules/gdnative/videodecoder/video_stream_gdnative.h2
15 files changed, 50 insertions, 124 deletions
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 1571b821a5..33b734f672 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -493,7 +493,7 @@ Error GDNative::get_symbol(StringName p_procedure_name, void *&r_handle, bool p_
return result;
}
-RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_original_path, Error *r_error) {
+RES GDNativeLibraryResourceLoader::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress) {
Ref<GDNativeLibrary> lib;
lib.instance();
diff --git a/modules/gdnative/gdnative.h b/modules/gdnative/gdnative.h
index c0c2cdf24c..b4c5ec9d00 100644
--- a/modules/gdnative/gdnative.h
+++ b/modules/gdnative/gdnative.h
@@ -166,7 +166,7 @@ public:
class GDNativeLibraryResourceLoader : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path, Error *r_error);
+ virtual RES load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads = false, float *r_progress = nullptr);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;
diff --git a/modules/gdnative/gdnative/variant.cpp b/modules/gdnative/gdnative/variant.cpp
index 1d8ba6087f..f0fc44ae8a 100644
--- a/modules/gdnative/gdnative/variant.cpp
+++ b/modules/gdnative/gdnative/variant.cpp
@@ -209,13 +209,13 @@ void GDAPI godot_variant_new_packed_byte_array(godot_variant *r_dest, const godo
void GDAPI godot_variant_new_packed_int_array(godot_variant *r_dest, const godot_packed_int_array *p_pia) {
Variant *dest = (Variant *)r_dest;
- PackedIntArray *pia = (PackedIntArray *)p_pia;
+ PackedInt32Array *pia = (PackedInt32Array *)p_pia;
memnew_placement_custom(dest, Variant, Variant(*pia));
}
void GDAPI godot_variant_new_packed_real_array(godot_variant *r_dest, const godot_packed_real_array *p_pra) {
Variant *dest = (Variant *)r_dest;
- PackedRealArray *pra = (PackedRealArray *)p_pra;
+ PackedFloat32Array *pra = (PackedFloat32Array *)p_pra;
memnew_placement_custom(dest, Variant, Variant(*pra));
}
@@ -402,8 +402,8 @@ godot_packed_byte_array GDAPI godot_variant_as_packed_byte_array(const godot_var
godot_packed_int_array GDAPI godot_variant_as_packed_int_array(const godot_variant *p_self) {
godot_packed_int_array raw_dest;
const Variant *self = (const Variant *)p_self;
- PackedIntArray *dest = (PackedIntArray *)&raw_dest;
- memnew_placement(dest, PackedIntArray(self->operator PackedIntArray())); // operator = is overloaded by PackedIntArray
+ PackedInt32Array *dest = (PackedInt32Array *)&raw_dest;
+ memnew_placement(dest, PackedInt32Array(self->operator PackedInt32Array())); // operator = is overloaded by PackedInt32Array
*dest = *self;
return raw_dest;
}
@@ -411,8 +411,8 @@ godot_packed_int_array GDAPI godot_variant_as_packed_int_array(const godot_varia
godot_packed_real_array GDAPI godot_variant_as_packed_real_array(const godot_variant *p_self) {
godot_packed_real_array raw_dest;
const Variant *self = (const Variant *)p_self;
- PackedRealArray *dest = (PackedRealArray *)&raw_dest;
- memnew_placement(dest, PackedRealArray(self->operator PackedRealArray())); // operator = is overloaded by PackedRealArray
+ PackedFloat32Array *dest = (PackedFloat32Array *)&raw_dest;
+ memnew_placement(dest, PackedFloat32Array(self->operator PackedFloat32Array())); // operator = is overloaded by PackedFloat32Array
*dest = *self;
return raw_dest;
}
diff --git a/modules/gdnative/gdnative_library_editor_plugin.cpp b/modules/gdnative/gdnative_library_editor_plugin.cpp
index b434bc8385..db90199e63 100644
--- a/modules/gdnative/gdnative_library_editor_plugin.cpp
+++ b/modules/gdnative/gdnative_library_editor_plugin.cpp
@@ -53,14 +53,6 @@ void GDNativeLibraryEditor::edit(Ref<GDNativeLibrary> p_library) {
}
void GDNativeLibraryEditor::_bind_methods() {
-
- ClassDB::bind_method("_on_item_button", &GDNativeLibraryEditor::_on_item_button);
- ClassDB::bind_method("_on_library_selected", &GDNativeLibraryEditor::_on_library_selected);
- ClassDB::bind_method("_on_dependencies_selected", &GDNativeLibraryEditor::_on_dependencies_selected);
- ClassDB::bind_method("_on_filter_selected", &GDNativeLibraryEditor::_on_filter_selected);
- ClassDB::bind_method("_on_item_collapsed", &GDNativeLibraryEditor::_on_item_collapsed);
- ClassDB::bind_method("_on_item_activated", &GDNativeLibraryEditor::_on_item_activated);
- ClassDB::bind_method("_on_create_new_entry", &GDNativeLibraryEditor::_on_create_new_entry);
}
void GDNativeLibraryEditor::_update_tree() {
@@ -359,7 +351,7 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() {
filter_list->set_item_checked(idx, true);
idx += 1;
}
- filter_list->connect_compat("index_pressed", this, "_on_filter_selected");
+ filter_list->connect("index_pressed", callable_mp(this, &GDNativeLibraryEditor::_on_filter_selected));
tree = memnew(Tree);
container->add_child(tree);
@@ -374,16 +366,16 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() {
tree->set_column_title(2, TTR("Dependencies"));
tree->set_column_expand(3, false);
tree->set_column_min_width(3, int(110 * EDSCALE));
- tree->connect_compat("button_pressed", this, "_on_item_button");
- tree->connect_compat("item_collapsed", this, "_on_item_collapsed");
- tree->connect_compat("item_activated", this, "_on_item_activated");
+ tree->connect("button_pressed", callable_mp(this, &GDNativeLibraryEditor::_on_item_button));
+ tree->connect("item_collapsed", callable_mp(this, &GDNativeLibraryEditor::_on_item_collapsed));
+ tree->connect("item_activated", callable_mp(this, &GDNativeLibraryEditor::_on_item_activated));
file_dialog = memnew(EditorFileDialog);
file_dialog->set_access(EditorFileDialog::ACCESS_RESOURCES);
file_dialog->set_resizable(true);
add_child(file_dialog);
- file_dialog->connect_compat("file_selected", this, "_on_library_selected");
- file_dialog->connect_compat("files_selected", this, "_on_dependencies_selected");
+ file_dialog->connect("file_selected", callable_mp(this, &GDNativeLibraryEditor::_on_library_selected));
+ file_dialog->connect("files_selected", callable_mp(this, &GDNativeLibraryEditor::_on_dependencies_selected));
new_architecture_dialog = memnew(ConfirmationDialog);
add_child(new_architecture_dialog);
@@ -392,7 +384,7 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() {
new_architecture_dialog->add_child(new_architecture_input);
new_architecture_dialog->set_custom_minimum_size(Vector2(300, 80) * EDSCALE);
new_architecture_input->set_anchors_and_margins_preset(PRESET_HCENTER_WIDE, PRESET_MODE_MINSIZE, 5 * EDSCALE);
- new_architecture_dialog->get_ok()->connect_compat("pressed", this, "_on_create_new_entry");
+ new_architecture_dialog->get_ok()->connect("pressed", callable_mp(this, &GDNativeLibraryEditor::_on_create_new_entry));
}
void GDNativeLibraryEditorPlugin::edit(Object *p_node) {
diff --git a/modules/gdnative/gdnative_library_singleton_editor.cpp b/modules/gdnative/gdnative_library_singleton_editor.cpp
index e5eb3c44d0..378339ecea 100644
--- a/modules/gdnative/gdnative_library_singleton_editor.cpp
+++ b/modules/gdnative/gdnative_library_singleton_editor.cpp
@@ -192,8 +192,6 @@ void GDNativeLibrarySingletonEditor::_notification(int p_what) {
void GDNativeLibrarySingletonEditor::_bind_methods() {
- ClassDB::bind_method(D_METHOD("_item_edited"), &GDNativeLibrarySingletonEditor::_item_edited);
- ClassDB::bind_method(D_METHOD("_discover_singletons"), &GDNativeLibrarySingletonEditor::_discover_singletons);
ClassDB::bind_method(D_METHOD("_update_libraries"), &GDNativeLibrarySingletonEditor::_update_libraries);
}
@@ -207,8 +205,8 @@ GDNativeLibrarySingletonEditor::GDNativeLibrarySingletonEditor() {
libraries->set_hide_root(true);
add_margin_child(TTR("Libraries: "), libraries, true);
updating = false;
- libraries->connect_compat("item_edited", this, "_item_edited");
- EditorFileSystem::get_singleton()->connect_compat("filesystem_changed", this, "_discover_singletons");
+ libraries->connect("item_edited", callable_mp(this, &GDNativeLibrarySingletonEditor::_item_edited));
+ EditorFileSystem::get_singleton()->connect("filesystem_changed", callable_mp(this, &GDNativeLibrarySingletonEditor::_discover_singletons));
}
#endif // TOOLS_ENABLED
diff --git a/modules/gdnative/include/gdnative/pool_arrays.h b/modules/gdnative/include/gdnative/pool_arrays.h
index 315fb7ada2..c610377f54 100644
--- a/modules/gdnative/include/gdnative/pool_arrays.h
+++ b/modules/gdnative/include/gdnative/pool_arrays.h
@@ -48,7 +48,7 @@ typedef struct {
} godot_packed_byte_array;
#endif
-/////// PackedIntArray
+/////// PackedInt32Array
#define GODOT_PACKED_INT_ARRAY_SIZE sizeof(void *)
@@ -59,7 +59,7 @@ typedef struct {
} godot_packed_int_array;
#endif
-/////// PackedRealArray
+/////// PackedFloat32Array
#define GODOT_PACKED_REAL_ARRAY_SIZE sizeof(void *)
diff --git a/modules/gdnative/include/gdnative/variant.h b/modules/gdnative/include/gdnative/variant.h
index 4d70f1143c..934e856fbf 100644
--- a/modules/gdnative/include/gdnative/variant.h
+++ b/modules/gdnative/include/gdnative/variant.h
@@ -56,31 +56,33 @@ typedef enum godot_variant_type {
GODOT_VARIANT_TYPE_STRING,
// math types
-
- GODOT_VARIANT_TYPE_VECTOR2, // 5
+ GODOT_VARIANT_TYPE_VECTOR2,
+ GODOT_VARIANT_TYPE_VECTOR2I,
GODOT_VARIANT_TYPE_RECT2,
+ GODOT_VARIANT_TYPE_RECT2I,
GODOT_VARIANT_TYPE_VECTOR3,
+ GODOT_VARIANT_TYPE_VECTOR3I,
GODOT_VARIANT_TYPE_TRANSFORM2D,
GODOT_VARIANT_TYPE_PLANE,
- GODOT_VARIANT_TYPE_QUAT, // 10
+ GODOT_VARIANT_TYPE_QUAT,
GODOT_VARIANT_TYPE_AABB,
GODOT_VARIANT_TYPE_BASIS,
GODOT_VARIANT_TYPE_TRANSFORM,
// misc types
GODOT_VARIANT_TYPE_COLOR,
- GODOT_VARIANT_TYPE_NODE_PATH, // 15
+ GODOT_VARIANT_TYPE_NODE_PATH,
GODOT_VARIANT_TYPE_RID,
GODOT_VARIANT_TYPE_OBJECT,
GODOT_VARIANT_TYPE_DICTIONARY,
- GODOT_VARIANT_TYPE_ARRAY, // 20
+ GODOT_VARIANT_TYPE_ARRAY,
// arrays
GODOT_VARIANT_TYPE_PACKED_BYTE_ARRAY,
GODOT_VARIANT_TYPE_PACKED_INT_ARRAY,
GODOT_VARIANT_TYPE_PACKED_REAL_ARRAY,
GODOT_VARIANT_TYPE_PACKED_STRING_ARRAY,
- GODOT_VARIANT_TYPE_PACKED_VECTOR2_ARRAY, // 25
+ GODOT_VARIANT_TYPE_PACKED_VECTOR2_ARRAY,
GODOT_VARIANT_TYPE_PACKED_VECTOR3_ARRAY,
GODOT_VARIANT_TYPE_PACKED_COLOR_ARRAY,
} godot_variant_type;
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index 8240ae2f83..d0e196b3e6 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -222,15 +222,11 @@ ScriptInstance *NativeScript::instance_create(Object *p_this) {
nsi->userdata = script_data->create_func.create_func((godot_object *)p_this, script_data->create_func.method_data);
#endif
-#ifndef NO_THREADS
- owners_lock->lock();
-#endif
-
- instance_owners.insert(p_this);
+ {
+ MutexLock lock(owners_lock);
-#ifndef NO_THREADS
- owners_lock->unlock();
-#endif
+ instance_owners.insert(p_this);
+ }
return nsi;
}
@@ -782,17 +778,10 @@ NativeScript::NativeScript() {
library = Ref<GDNative>();
lib_path = "";
class_name = "";
-#ifndef NO_THREADS
- owners_lock = Mutex::create();
-#endif
}
NativeScript::~NativeScript() {
NSL->unregister_script(this);
-
-#ifndef NO_THREADS
- memdelete(owners_lock);
-#endif
}
#define GET_SCRIPT_DESC() script->get_script_desc()
@@ -1140,16 +1129,9 @@ NativeScriptInstance::~NativeScriptInstance() {
script_data->destroy_func.destroy_func((godot_object *)owner, script_data->destroy_func.method_data, userdata);
if (owner) {
-
-#ifndef NO_THREADS
- script->owners_lock->lock();
-#endif
+ MutexLock lock(script->owners_lock);
script->instance_owners.erase(owner);
-
-#ifndef NO_THREADS
- script->owners_lock->unlock();
-#endif
}
}
@@ -1246,7 +1228,6 @@ NativeScriptLanguage::NativeScriptLanguage() {
NativeScriptLanguage::singleton = this;
#ifndef NO_THREADS
has_objects_to_register = false;
- mutex = Mutex::create();
#endif
#ifdef DEBUG_ENABLED
@@ -1283,10 +1264,6 @@ NativeScriptLanguage::~NativeScriptLanguage() {
NSL->library_classes.clear();
NSL->library_gdnatives.clear();
NSL->library_script_users.clear();
-
-#ifndef NO_THREADS
- memdelete(mutex);
-#endif
}
String NativeScriptLanguage::get_name() const {
@@ -1413,9 +1390,7 @@ void NativeScriptLanguage::get_public_constants(List<Pair<String, Variant> > *p_
void NativeScriptLanguage::profiling_start() {
#ifdef DEBUG_ENABLED
-#ifndef NO_THREADS
MutexLock lock(mutex);
-#endif
profile_data.clear();
profiling = true;
@@ -1424,9 +1399,7 @@ void NativeScriptLanguage::profiling_start() {
void NativeScriptLanguage::profiling_stop() {
#ifdef DEBUG_ENABLED
-#ifndef NO_THREADS
MutexLock lock(mutex);
-#endif
profiling = false;
#endif
@@ -1434,9 +1407,8 @@ void NativeScriptLanguage::profiling_stop() {
int NativeScriptLanguage::profiling_get_accumulated_data(ProfilingInfo *p_info_arr, int p_info_max) {
#ifdef DEBUG_ENABLED
-#ifndef NO_THREADS
MutexLock lock(mutex);
-#endif
+
int current = 0;
for (Map<StringName, ProfileData>::Element *d = profile_data.front(); d; d = d->next()) {
@@ -1458,9 +1430,8 @@ int NativeScriptLanguage::profiling_get_accumulated_data(ProfilingInfo *p_info_a
int NativeScriptLanguage::profiling_get_frame_data(ProfilingInfo *p_info_arr, int p_info_max) {
#ifdef DEBUG_ENABLED
-#ifndef NO_THREADS
MutexLock lock(mutex);
-#endif
+
int current = 0;
for (Map<StringName, ProfileData>::Element *d = profile_data.front(); d; d = d->next()) {
@@ -1484,9 +1455,7 @@ int NativeScriptLanguage::profiling_get_frame_data(ProfilingInfo *p_info_arr, in
void NativeScriptLanguage::profiling_add_data(StringName p_signature, uint64_t p_time) {
#ifdef DEBUG_ENABLED
-#ifndef NO_THREADS
MutexLock lock(mutex);
-#endif
Map<StringName, ProfileData>::Element *d = profile_data.find(p_signature);
if (d) {
@@ -1705,9 +1674,8 @@ void NativeScriptLanguage::defer_init_library(Ref<GDNativeLibrary> lib, NativeSc
#endif
void NativeScriptLanguage::init_library(const Ref<GDNativeLibrary> &lib) {
-#ifndef NO_THREADS
MutexLock lock(mutex);
-#endif
+
// See if this library was "registered" already.
const String &lib_path = lib->get_current_library_path();
ERR_FAIL_COND_MSG(lib_path.length() == 0, lib->get_name() + " does not have a library for the current platform.");
@@ -1743,16 +1711,14 @@ void NativeScriptLanguage::init_library(const Ref<GDNativeLibrary> &lib) {
}
void NativeScriptLanguage::register_script(NativeScript *script) {
-#ifndef NO_THREADS
MutexLock lock(mutex);
-#endif
+
library_script_users[script->lib_path].insert(script);
}
void NativeScriptLanguage::unregister_script(NativeScript *script) {
-#ifndef NO_THREADS
MutexLock lock(mutex);
-#endif
+
Map<String, Set<NativeScript *> >::Element *S = library_script_users.find(script->lib_path);
if (S) {
S->get().erase(script);
@@ -1803,9 +1769,7 @@ void NativeScriptLanguage::frame() {
#ifdef DEBUG_ENABLED
{
-#ifndef NO_THREADS
MutexLock lock(mutex);
-#endif
for (Map<StringName, ProfileData>::Element *d = profile_data.front(); d; d = d->next()) {
d->get().last_frame_call_count = d->get().frame_call_count;
@@ -1867,9 +1831,7 @@ void NativeReloadNode::_notification(int p_what) {
if (unloaded)
break;
-#ifndef NO_THREADS
MutexLock lock(NSL->mutex);
-#endif
NSL->_unload_stuff(true);
for (Map<String, Ref<GDNative> >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) {
@@ -1904,9 +1866,8 @@ void NativeReloadNode::_notification(int p_what) {
if (!unloaded)
break;
-#ifndef NO_THREADS
MutexLock lock(NSL->mutex);
-#endif
+
Set<StringName> libs_to_remove;
for (Map<String, Ref<GDNative> >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) {
@@ -1970,7 +1931,7 @@ void NativeReloadNode::_notification(int p_what) {
#endif
}
-RES ResourceFormatLoaderNativeScript::load(const String &p_path, const String &p_original_path, Error *r_error) {
+RES ResourceFormatLoaderNativeScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress) {
return ResourceFormatLoaderText::singleton->load(p_path, p_original_path, r_error);
}
diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h
index 609ffa2bd4..90542c96b7 100644
--- a/modules/gdnative/nativescript/nativescript.h
+++ b/modules/gdnative/nativescript/nativescript.h
@@ -35,6 +35,7 @@
#include "core/io/resource_saver.h"
#include "core/oa_hash_map.h"
#include "core/ordered_hash_map.h"
+#include "core/os/mutex.h"
#include "core/os/thread_safe.h"
#include "core/resource.h"
#include "core/script_language.h"
@@ -44,10 +45,6 @@
#include "modules/gdnative/gdnative.h"
#include <nativescript/godot_nativescript.h>
-#ifndef NO_THREADS
-#include "core/os/mutex.h"
-#endif
-
struct NativeScriptDesc {
struct Method {
@@ -127,9 +124,7 @@ class NativeScript : public Script {
String script_class_name;
String script_class_icon_path;
-#ifndef NO_THREADS
- Mutex *owners_lock;
-#endif
+ Mutex owners_lock;
Set<Object *> instance_owners;
protected:
@@ -266,9 +261,8 @@ private:
void _unload_stuff(bool p_reload = false);
+ Mutex mutex;
#ifndef NO_THREADS
- Mutex *mutex;
-
Set<Ref<GDNativeLibrary> > libs_to_init;
Set<NativeScript *> scripts_to_register;
volatile bool has_objects_to_register; // so that we don't lock mutex every frame - it's rarely needed
@@ -412,7 +406,7 @@ public:
class ResourceFormatLoaderNativeScript : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;
diff --git a/modules/gdnative/pluginscript/pluginscript_language.cpp b/modules/gdnative/pluginscript/pluginscript_language.cpp
index 4e39f4b0a8..a40b59bb2e 100644
--- a/modules/gdnative/pluginscript/pluginscript_language.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_language.cpp
@@ -399,39 +399,18 @@ void PluginScriptLanguage::reload_tool_script(const Ref<Script> &p_script, bool
}
void PluginScriptLanguage::lock() {
-#ifndef NO_THREADS
- if (_lock) {
- _lock->lock();
- }
-#endif
+ _lock.lock();
}
void PluginScriptLanguage::unlock() {
-#ifndef NO_THREADS
- if (_lock) {
- _lock->unlock();
- }
-#endif
+ _lock.unlock();
}
PluginScriptLanguage::PluginScriptLanguage(const godot_pluginscript_language_desc *desc) :
_desc(*desc) {
_resource_loader = Ref<ResourceFormatLoaderPluginScript>(memnew(ResourceFormatLoaderPluginScript(this)));
_resource_saver = Ref<ResourceFormatSaverPluginScript>(memnew(ResourceFormatSaverPluginScript(this)));
-
-// TODO: totally remove _lock attribute if NO_THREADS is set
-#ifdef NO_THREADS
- _lock = NULL;
-#else
- _lock = Mutex::create();
-#endif
}
PluginScriptLanguage::~PluginScriptLanguage() {
-#ifndef NO_THREADS
- if (_lock) {
- memdelete(_lock);
- _lock = NULL;
- }
-#endif
}
diff --git a/modules/gdnative/pluginscript/pluginscript_language.h b/modules/gdnative/pluginscript/pluginscript_language.h
index 037d7a4948..3f0d2b8d3d 100644
--- a/modules/gdnative/pluginscript/pluginscript_language.h
+++ b/modules/gdnative/pluginscript/pluginscript_language.h
@@ -53,7 +53,7 @@ class PluginScriptLanguage : public ScriptLanguage {
const godot_pluginscript_language_desc _desc;
godot_pluginscript_language_data *_data;
- Mutex *_lock;
+ Mutex _lock;
SelfList<PluginScript>::List _script_list;
public:
diff --git a/modules/gdnative/pluginscript/pluginscript_loader.cpp b/modules/gdnative/pluginscript/pluginscript_loader.cpp
index fe1cc83c69..46db20b6c2 100644
--- a/modules/gdnative/pluginscript/pluginscript_loader.cpp
+++ b/modules/gdnative/pluginscript/pluginscript_loader.cpp
@@ -39,7 +39,7 @@ ResourceFormatLoaderPluginScript::ResourceFormatLoaderPluginScript(PluginScriptL
_language = language;
}
-RES ResourceFormatLoaderPluginScript::load(const String &p_path, const String &p_original_path, Error *r_error) {
+RES ResourceFormatLoaderPluginScript::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress) {
if (r_error)
*r_error = ERR_FILE_CANT_OPEN;
diff --git a/modules/gdnative/pluginscript/pluginscript_loader.h b/modules/gdnative/pluginscript/pluginscript_loader.h
index ede31c027e..a039072fdc 100644
--- a/modules/gdnative/pluginscript/pluginscript_loader.h
+++ b/modules/gdnative/pluginscript/pluginscript_loader.h
@@ -44,7 +44,7 @@ class ResourceFormatLoaderPluginScript : public ResourceFormatLoader {
public:
ResourceFormatLoaderPluginScript(PluginScriptLanguage *language);
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;
diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.cpp b/modules/gdnative/videodecoder/video_stream_gdnative.cpp
index bd16563ff0..f6e2bad739 100644
--- a/modules/gdnative/videodecoder/video_stream_gdnative.cpp
+++ b/modules/gdnative/videodecoder/video_stream_gdnative.cpp
@@ -373,7 +373,7 @@ void VideoStreamGDNative::set_audio_track(int p_track) {
/* --- NOTE ResourceFormatLoaderVideoStreamGDNative starts here. ----- */
-RES ResourceFormatLoaderVideoStreamGDNative::load(const String &p_path, const String &p_original_path, Error *r_error) {
+RES ResourceFormatLoaderVideoStreamGDNative::load(const String &p_path, const String &p_original_path, Error *r_error, bool p_use_sub_threads, float *r_progress) {
FileAccess *f = FileAccess::open(p_path, FileAccess::READ);
if (!f) {
if (r_error) {
diff --git a/modules/gdnative/videodecoder/video_stream_gdnative.h b/modules/gdnative/videodecoder/video_stream_gdnative.h
index 024cdec196..21b5245a16 100644
--- a/modules/gdnative/videodecoder/video_stream_gdnative.h
+++ b/modules/gdnative/videodecoder/video_stream_gdnative.h
@@ -199,7 +199,7 @@ public:
class ResourceFormatLoaderVideoStreamGDNative : public ResourceFormatLoader {
public:
- virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL);
+ virtual RES load(const String &p_path, const String &p_original_path = "", Error *r_error = NULL, bool p_use_sub_threads = false, float *r_progress = nullptr);
virtual void get_recognized_extensions(List<String> *p_extensions) const;
virtual bool handles_type(const String &p_type) const;
virtual String get_resource_type(const String &p_path) const;