1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Mono: Add properties support in scripts

This commit is contained in:
Ignacio Etcheverry
2018-01-04 21:05:46 +01:00
parent f9f6f250e6
commit 119a910bc6
20 changed files with 691 additions and 170 deletions

View File

@@ -113,7 +113,7 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) {
if (tclass == CACHED_CLASS(Plane))
return Variant::PLANE;
if (mono_class_is_enum(tclass->get_raw()))
if (mono_class_is_enum(tclass->get_mono_ptr()))
return Variant::INT;
} break;
@@ -164,7 +164,7 @@ Variant::Type managed_to_variant_type(const ManagedType &p_type) {
} break;
case MONO_TYPE_GENERICINST: {
if (CACHED_RAW_MONO_CLASS(Dictionary) == p_type.type_class->get_raw()) {
if (CACHED_RAW_MONO_CLASS(Dictionary) == p_type.type_class->get_mono_ptr()) {
return Variant::DICTIONARY;
}
} break;
@@ -306,9 +306,9 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
if (tclass == CACHED_CLASS(Plane))
RETURN_BOXED_STRUCT(Plane, p_var);
if (mono_class_is_enum(tclass->get_raw())) {
if (mono_class_is_enum(tclass->get_mono_ptr())) {
int val = p_var->operator signed int();
return BOX_ENUM(tclass->get_raw(), val);
return BOX_ENUM(tclass->get_mono_ptr(), val);
}
} break;
@@ -432,7 +432,7 @@ MonoObject *variant_to_mono_object(const Variant *p_var, const ManagedType &p_ty
}
break;
case MONO_TYPE_GENERICINST: {
if (CACHED_RAW_MONO_CLASS(Dictionary) == p_type.type_class->get_raw()) {
if (CACHED_RAW_MONO_CLASS(Dictionary) == p_type.type_class->get_mono_ptr()) {
return Dictionary_to_mono_object(p_var->operator Dictionary());
}
} break;
@@ -528,7 +528,7 @@ Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type) {
if (tclass == CACHED_CLASS(Plane))
RETURN_UNBOXED_STRUCT(Plane, p_obj);
if (mono_class_is_enum(tclass->get_raw()))
if (mono_class_is_enum(tclass->get_mono_ptr()))
return unbox<int32_t>(p_obj);
} break;
@@ -585,7 +585,7 @@ Variant mono_object_to_variant(MonoObject *p_obj, const ManagedType &p_type) {
} break;
case MONO_TYPE_GENERICINST: {
if (CACHED_RAW_MONO_CLASS(Dictionary) == p_type.type_class->get_raw()) {
if (CACHED_RAW_MONO_CLASS(Dictionary) == p_type.type_class->get_mono_ptr()) {
return mono_object_to_Dictionary(p_obj);
}
} break;