summaryrefslogtreecommitdiffstats
path: root/core/object
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-09-12 09:25:05 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-09-12 09:25:05 +0200
commit23e51c3cb563862fe9946e1838043a1f943067a5 (patch)
tree371bc591bb3855617b4e6e8f2d857632cc69dcdd /core/object
parent18cdfb81011969efcab0dd0725a2fc6b6fdc00fd (diff)
parent27d1fb63e11b092be812e9f1fbd8730598ae9999 (diff)
downloadredot-engine-23e51c3cb563862fe9946e1838043a1f943067a5.tar.gz
Merge pull request #92888 from Hilderin/fix-unable-to-use-resourceLoader-in-c#-after-threaded-load
Fix inability to use ResourceLoader in C# after threaded load in GDScript
Diffstat (limited to 'core/object')
-rw-r--r--core/object/class_db.cpp7
-rw-r--r--core/object/class_db.h4
2 files changed, 11 insertions, 0 deletions
diff --git a/core/object/class_db.cpp b/core/object/class_db.cpp
index ee8c469515..9826d73a9d 100644
--- a/core/object/class_db.cpp
+++ b/core/object/class_db.cpp
@@ -2306,4 +2306,11 @@ void ClassDB::cleanup() {
native_structs.clear();
}
+// Array to use in optional parameters on methods and the DEFVAL_ARRAY macro.
+Array ClassDB::default_array_arg = Array::create_read_only();
+
+bool ClassDB::is_default_array_arg(const Array &p_array) {
+ return p_array.is_same_instance(default_array_arg);
+}
+
//
diff --git a/core/object/class_db.h b/core/object/class_db.h
index 620092a6c4..81100d7586 100644
--- a/core/object/class_db.h
+++ b/core/object/class_db.h
@@ -43,6 +43,7 @@
#include <type_traits>
#define DEFVAL(m_defval) (m_defval)
+#define DEFVAL_ARRAY DEFVAL(ClassDB::default_array_arg)
#ifdef DEBUG_METHODS_ENABLED
@@ -181,6 +182,9 @@ public:
};
static HashMap<StringName, NativeStruct> native_structs;
+ static Array default_array_arg;
+ static bool is_default_array_arg(const Array &p_array);
+
private:
// Non-locking variants of get_parent_class and is_parent_class.
static StringName _get_parent_class(const StringName &p_class);