1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-13 13:31:48 +00:00

C#: Support type hints for exported Arrays

Added the code for Dictionary as well, but it's not yet supported by the Godot inspector.
This commit is contained in:
Ignacio Etcheverry
2019-03-05 21:39:50 +01:00
parent 187e6ae26d
commit 480d4c6fba
11 changed files with 208 additions and 37 deletions

View File

@@ -32,6 +32,7 @@
#define GDMONOMARSHAL_H
#include "core/variant.h"
#include "gd_mono.h"
#include "gd_mono_utils.h"
@@ -56,7 +57,25 @@ T unbox(MonoObject *p_obj) {
#define BOX_PTR(x) mono_value_box(mono_domain_get(), CACHED_CLASS_RAW(IntPtr), x)
#define BOX_ENUM(m_enum_class, x) mono_value_box(mono_domain_get(), m_enum_class, &x)
Variant::Type managed_to_variant_type(const ManagedType &p_type);
// FIXME: Made this struct in a hurry. It could be done differently.
struct ExportInfo {
struct ArrayInfo {
Variant::Type element_type;
ArrayInfo() :
element_type(Variant::NIL) {}
} array;
struct DictionaryInfo {
Variant::Type key_type;
Variant::Type value_type;
DictionaryInfo() :
key_type(Variant::NIL),
value_type(Variant::NIL) {}
} dictionary;
};
Variant::Type managed_to_variant_type(const ManagedType &p_type, ExportInfo *r_export_info = NULL);
// String