summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-10-15 17:34:43 +0200
committerGitHub <noreply@github.com>2021-10-15 17:34:43 +0200
commit4a0a91facf804207c477df4330d56d69d2a40d6f (patch)
treea923dc71b15e22a3a1005b9526802692ed30517d /modules
parent1efe7093bec9c0bfaa2ecedd9d5777b594d7283a (diff)
parent1f62d309d8fca013d5fd5f280060f2fbcdc9aef5 (diff)
Merge pull request #53576 from raulsntos/fix-mono-to-variant-array
Diffstat (limited to 'modules')
-rw-r--r--modules/mono/mono_gd/gd_mono_marshal.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/modules/mono/mono_gd/gd_mono_marshal.cpp b/modules/mono/mono_gd/gd_mono_marshal.cpp
index c9789bf270..11a31217d7 100644
--- a/modules/mono/mono_gd/gd_mono_marshal.cpp
+++ b/modules/mono/mono_gd/gd_mono_marshal.cpp
@@ -181,6 +181,18 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type, bool *r_nil_is_
return Variant::PACKED_COLOR_ARRAY;
}
+ if (array_type->eklass == CACHED_CLASS_RAW(StringName)) {
+ return Variant::ARRAY;
+ }
+
+ if (array_type->eklass == CACHED_CLASS_RAW(NodePath)) {
+ return Variant::ARRAY;
+ }
+
+ if (array_type->eklass == CACHED_CLASS_RAW(RID)) {
+ return Variant::ARRAY;
+ }
+
GDMonoClass *array_type_class = GDMono::get_singleton()->get_class(array_type->eklass);
if (CACHED_CLASS(GodotObject)->is_assignable_from(array_type_class)) {
return Variant::ARRAY;
@@ -361,6 +373,18 @@ MonoArray *variant_to_mono_array(const Variant &p_var, GDMonoClass *p_type_class
return PackedColorArray_to_mono_array(p_var.operator PackedColorArray());
}
+ if (array_type->eklass == CACHED_CLASS_RAW(StringName)) {
+ return Array_to_mono_array(p_var.operator Array());
+ }
+
+ if (array_type->eklass == CACHED_CLASS_RAW(NodePath)) {
+ return Array_to_mono_array(p_var.operator Array());
+ }
+
+ if (array_type->eklass == CACHED_CLASS_RAW(RID)) {
+ return Array_to_mono_array(p_var.operator Array());
+ }
+
if (mono_class_is_assignable_from(CACHED_CLASS(GodotObject)->get_mono_ptr(), array_type->eklass)) {
return Array_to_mono_array(p_var.operator ::Array(), array_type->eklass);
}
@@ -1118,6 +1142,18 @@ Variant mono_object_to_variant_impl(MonoObject *p_obj, const ManagedType &p_type
return mono_array_to_PackedColorArray((MonoArray *)p_obj);
}
+ if (array_type->eklass == CACHED_CLASS_RAW(StringName)) {
+ return mono_array_to_Array((MonoArray *)p_obj);
+ }
+
+ if (array_type->eklass == CACHED_CLASS_RAW(NodePath)) {
+ return mono_array_to_Array((MonoArray *)p_obj);
+ }
+
+ if (array_type->eklass == CACHED_CLASS_RAW(RID)) {
+ return mono_array_to_Array((MonoArray *)p_obj);
+ }
+
GDMonoClass *array_type_class = GDMono::get_singleton()->get_class(array_type->eklass);
if (CACHED_CLASS(GodotObject)->is_assignable_from(array_type_class)) {
return mono_array_to_Array((MonoArray *)p_obj);