diff options
Diffstat (limited to 'modules/mono')
-rw-r--r-- | modules/mono/csharp_script.cpp | 53 | ||||
-rw-r--r-- | modules/mono/editor/godotsharp_builds.cpp | 4 | ||||
-rw-r--r-- | modules/mono/editor/godotsharp_editor.cpp | 4 |
3 files changed, 35 insertions, 26 deletions
diff --git a/modules/mono/csharp_script.cpp b/modules/mono/csharp_script.cpp index 6f9e7f49df..7de90dfbc3 100644 --- a/modules/mono/csharp_script.cpp +++ b/modules/mono/csharp_script.cpp @@ -1201,8 +1201,6 @@ bool CSharpScript::_update_exports() { exported_members_cache.clear(); exported_members_defval_cache.clear(); - const Vector<GDMonoField *> &fields = script_class->get_all_fields(); - // We are creating a temporary new instance of the class here to get the default value // TODO Workaround. Should be replaced with IL opcodes analysis @@ -1226,36 +1224,47 @@ bool CSharpScript::_update_exports() { return false; } - for (int i = 0; i < fields.size(); i++) { - GDMonoField *field = fields[i]; + GDMonoClass *top = script_class; - if (field->is_static() || field->get_visibility() != GDMono::PUBLIC) - continue; + while (top && top != native) { + const Vector<GDMonoField *> &fields = top->get_all_fields(); + + for (int i = 0; i < fields.size(); i++) { + GDMonoField *field = fields[i]; + + if (field->is_static() || field->get_visibility() != GDMono::PUBLIC) + continue; - String name = field->get_name(); - StringName cname = name; + String name = field->get_name(); + StringName cname = name; - Variant::Type type = GDMonoMarshal::managed_to_variant_type(field->get_type()); + if (member_info.has(cname)) + continue; - if (field->has_attribute(CACHED_CLASS(ExportAttribute))) { - MonoObject *attr = field->get_attribute(CACHED_CLASS(ExportAttribute)); + Variant::Type type = GDMonoMarshal::managed_to_variant_type(field->get_type()); - // Field has Export attribute - int hint = CACHED_FIELD(ExportAttribute, hint)->get_int_value(attr); - String hint_string = CACHED_FIELD(ExportAttribute, hint_string)->get_string_value(attr); - int usage = CACHED_FIELD(ExportAttribute, usage)->get_int_value(attr); + if (field->has_attribute(CACHED_CLASS(ExportAttribute))) { + MonoObject *attr = field->get_attribute(CACHED_CLASS(ExportAttribute)); - PropertyInfo prop_info = PropertyInfo(type, name, PropertyHint(hint), hint_string, PropertyUsageFlags(usage)); + // Field has Export attribute + int hint = CACHED_FIELD(ExportAttribute, hint)->get_int_value(attr); + String hint_string = CACHED_FIELD(ExportAttribute, hint_string)->get_string_value(attr); + int usage = CACHED_FIELD(ExportAttribute, usage)->get_int_value(attr); - member_info[cname] = prop_info; - exported_members_cache.push_back(prop_info); + PropertyInfo prop_info = PropertyInfo(type, name, PropertyHint(hint), hint_string, PropertyUsageFlags(usage)); - if (tmp_object) { - exported_members_defval_cache[cname] = GDMonoMarshal::mono_object_to_variant(field->get_value(tmp_object)); + member_info[cname] = prop_info; + exported_members_cache.push_back(prop_info); + + if (tmp_object) { + exported_members_defval_cache[cname] = GDMonoMarshal::mono_object_to_variant(field->get_value(tmp_object)); + } + } else { + member_info[cname] = PropertyInfo(type, name, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_SCRIPT_VARIABLE); } - } else { - member_info[cname] = PropertyInfo(type, name, PROPERTY_HINT_NONE, "", PROPERTY_USAGE_SCRIPT_VARIABLE); } + + top = top->get_parent_class(); } } diff --git a/modules/mono/editor/godotsharp_builds.cpp b/modules/mono/editor/godotsharp_builds.cpp index b10f1f87d8..7b80e26645 100644 --- a/modules/mono/editor/godotsharp_builds.cpp +++ b/modules/mono/editor/godotsharp_builds.cpp @@ -352,8 +352,8 @@ GodotSharpBuilds::GodotSharpBuilds() { // Build tool settings EditorSettings *ed_settings = EditorSettings::get_singleton(); - if (!ed_settings->has("mono/builds/build_tool")) { - ed_settings->set("mono/builds/build_tool", MSBUILD); + if (!ed_settings->has_setting("mono/builds/build_tool")) { + ed_settings->set_setting("mono/builds/build_tool", MSBUILD); } ed_settings->add_property_hint(PropertyInfo(Variant::INT, "mono/builds/build_tool", PROPERTY_HINT_ENUM, "MSBuild (System),MSBuild (Mono),xbuild")); } diff --git a/modules/mono/editor/godotsharp_editor.cpp b/modules/mono/editor/godotsharp_editor.cpp index 5aaf029495..30e7653256 100644 --- a/modules/mono/editor/godotsharp_editor.cpp +++ b/modules/mono/editor/godotsharp_editor.cpp @@ -237,8 +237,8 @@ GodotSharpEditor::GodotSharpEditor(EditorNode *p_editor) { // External editor settings EditorSettings *ed_settings = EditorSettings::get_singleton(); - if (!ed_settings->has("mono/editor/external_editor")) { - ed_settings->set("mono/editor/external_editor", EDITOR_NONE); + if (!ed_settings->has_setting("mono/editor/external_editor")) { + ed_settings->set_setting("mono/editor/external_editor", EDITOR_NONE); } ed_settings->add_property_hint(PropertyInfo(Variant::INT, "mono/editor/external_editor", PROPERTY_HINT_ENUM, "None,MonoDevelop,Visual Studio,Visual Studio Code")); } |