From 9b6f65af82d02d1ec92de1d2d6250884de20cbf3 Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Mon, 9 Oct 2017 23:50:06 +0200 Subject: Mono: Make use of ClassInfo's exposed API - BindingsGenerator only generates exposed classes. - Fix creation of managed instances of non-exposed classes. --- modules/mono/editor/bindings_generator.cpp | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) (limited to 'modules/mono/editor') diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 123f00ea10..704910c5b9 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -133,12 +133,6 @@ static bool is_csharp_keyword(const String &p_name) { p_name == "virtual" || p_name == "volatile" || p_name == "void" || p_name == "while"; } -static bool is_singleton_black_listed(const String &p_type) { - - return p_type == "IP_Unix" || p_type == "InputDefault" || p_type == "AudioServerSW" || p_type == "PhysicsServerSW" || - p_type == "Physics2DServerSW" || p_type == "SpatialSoundServerSW" || p_type == "SpatialSound2DServerSW"; -} - inline static String escape_csharp_keyword(const String &p_name) { return is_csharp_keyword(p_name) ? "@" + p_name : p_name; @@ -247,9 +241,6 @@ void BindingsGenerator::_generate_header_icalls() { void BindingsGenerator::_generate_method_icalls(const TypeInterface &p_itype) { - if (p_itype.base_name.length() && obj_types[p_itype.base_name].is_singleton && is_singleton_black_listed(p_itype.name)) - return; - for (const List::Element *E = p_itype.methods.front(); E; E = E->next()) { const MethodInterface &imethod = E->get(); @@ -580,9 +571,6 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str bool is_derived_type = itype.base_name.length(); - if (is_derived_type && obj_types[itype.base_name].is_singleton && is_singleton_black_listed(itype.name)) - return ERR_SKIP; - List &custom_icalls = itype.api_type == ClassDB::API_EDITOR ? editor_custom_icalls : core_custom_icalls; if (verbose_output) @@ -1167,9 +1155,6 @@ Error BindingsGenerator::generate_glue(const String &p_output_dir) { for (Map::Element *type_elem = obj_types.front(); type_elem; type_elem = type_elem->next()) { const TypeInterface &itype = type_elem->get(); - if (itype.base_name.length() && obj_types[itype.base_name].is_singleton && is_singleton_black_listed(itype.name)) - continue; - List &custom_icalls = itype.api_type == ClassDB::API_EDITOR ? editor_custom_icalls : core_custom_icalls; OS::get_singleton()->print(String("Generating " + itype.name + "...\n").utf8()); @@ -1519,6 +1504,12 @@ void BindingsGenerator::_populate_object_type_interfaces() { itype.is_reference = ClassDB::is_parent_class(type_cname, refclass_name); itype.memory_own = itype.is_reference; + if (!ClassDB::is_class_exposed(type_cname)) { + WARN_PRINTS("Ignoring type " + String(type_cname) + " because it's not exposed"); + class_list.pop_front(); + continue; + } + itype.c_out = "\treturn "; itype.c_out += C_METHOD_UNMANAGED_GET_MANAGED; itype.c_out += itype.is_reference ? "(%1.ptr());\n" : "(%1);\n"; -- cgit v1.2.3