mirror of
https://github.com/godotengine/godot.git
synced 2025-01-06 02:00:57 +00:00
Fix set field from MonoObject*
This commit is contained in:
parent
8bc96cc146
commit
ae725969d3
@ -95,7 +95,9 @@ MonoAssembly *GDMonoAssembly::_preload_hook(MonoAssemblyName *aname, char **asse
|
||||
(void)user_data; // UNUSED
|
||||
|
||||
if (search_dirs.empty()) {
|
||||
#ifdef TOOLS_DOMAIN
|
||||
search_dirs.push_back(GodotSharpDirs::get_res_temp_assemblies_dir());
|
||||
#endif
|
||||
search_dirs.push_back(GodotSharpDirs::get_res_assemblies_dir());
|
||||
search_dirs.push_back(OS::get_singleton()->get_resource_dir());
|
||||
search_dirs.push_back(OS::get_singleton()->get_executable_path().get_base_dir());
|
||||
|
@ -183,19 +183,19 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) {
|
||||
// GodotObject
|
||||
if (CACHED_CLASS(GodotObject)->is_assignable_from(type_class)) {
|
||||
MonoObject *managed = GDMonoUtils::unmanaged_get_managed(p_value.operator Object *());
|
||||
mono_field_set_value(p_object, mono_field, &managed);
|
||||
mono_field_set_value(p_object, mono_field, managed);
|
||||
break;
|
||||
}
|
||||
|
||||
if (CACHED_CLASS(NodePath) == type_class) {
|
||||
MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator NodePath());
|
||||
mono_field_set_value(p_object, mono_field, &managed);
|
||||
mono_field_set_value(p_object, mono_field, managed);
|
||||
break;
|
||||
}
|
||||
|
||||
if (CACHED_CLASS(RID) == type_class) {
|
||||
MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID());
|
||||
mono_field_set_value(p_object, mono_field, &managed);
|
||||
mono_field_set_value(p_object, mono_field, managed);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -204,8 +204,6 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) {
|
||||
} break;
|
||||
|
||||
case MONO_TYPE_OBJECT: {
|
||||
GDMonoClass *type_class = type.type_class;
|
||||
|
||||
// Variant
|
||||
switch (p_value.get_type()) {
|
||||
case Variant::BOOL: {
|
||||
@ -237,11 +235,11 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) {
|
||||
case Variant::COLOR: SET_FROM_STRUCT_AND_BREAK(Color);
|
||||
case Variant::NODE_PATH: {
|
||||
MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator NodePath());
|
||||
mono_field_set_value(p_object, mono_field, &managed);
|
||||
mono_field_set_value(p_object, mono_field, managed);
|
||||
} break;
|
||||
case Variant::_RID: {
|
||||
MonoObject *managed = GDMonoUtils::create_managed_from(p_value.operator RID());
|
||||
mono_field_set_value(p_object, mono_field, &managed);
|
||||
mono_field_set_value(p_object, mono_field, managed);
|
||||
} break;
|
||||
case Variant::OBJECT: {
|
||||
MonoObject *managed = GDMonoUtils::unmanaged_get_managed(p_value.operator Object *());
|
||||
@ -250,7 +248,7 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) {
|
||||
}
|
||||
case Variant::DICTIONARY: {
|
||||
MonoObject *managed = GDMonoMarshal::Dictionary_to_mono_object(p_value.operator Dictionary());
|
||||
mono_field_set_value(p_object, mono_field, &managed);
|
||||
mono_field_set_value(p_object, mono_field, managed);
|
||||
} break;
|
||||
case Variant::ARRAY: SET_FROM_ARRAY_AND_BREAK(Array);
|
||||
case Variant::POOL_BYTE_ARRAY: SET_FROM_ARRAY_AND_BREAK(PoolByteArray);
|
||||
@ -268,7 +266,7 @@ void GDMonoField::set_value(MonoObject *p_object, const Variant &p_value) {
|
||||
case MONO_TYPE_GENERICINST: {
|
||||
if (CACHED_RAW_MONO_CLASS(Dictionary) == type.type_class->get_raw()) {
|
||||
MonoObject *managed = GDMonoMarshal::Dictionary_to_mono_object(p_value.operator Dictionary());
|
||||
mono_field_set_value(p_object, mono_field, &managed);
|
||||
mono_field_set_value(p_object, mono_field, managed);
|
||||
break;
|
||||
}
|
||||
} break;
|
||||
|
Loading…
Reference in New Issue
Block a user