From ba441c48b085ccede6c09ea258258c22e94f6ca5 Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Fri, 20 Jul 2018 08:27:47 +0200 Subject: [PATCH] Makes Mono bindings partial & adds GetNode. (cherry picked from commit a8c97eb0944d89df9ba686f22c8241dfc2425a46) --- modules/mono/editor/bindings_generator.cpp | 2 +- modules/mono/glue/cs_files/NodeExtensions.cs | 10 ++++++++++ modules/mono/glue/cs_files/VERSION.txt | 2 +- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 modules/mono/glue/cs_files/NodeExtensions.cs diff --git a/modules/mono/editor/bindings_generator.cpp b/modules/mono/editor/bindings_generator.cpp index 6fa317ee70b..2221a1d5e83 100644 --- a/modules/mono/editor/bindings_generator.cpp +++ b/modules/mono/editor/bindings_generator.cpp @@ -731,7 +731,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str output.push_back(INDENT1 "public "); bool is_abstract = itype.is_object_type && !ClassDB::can_instance(itype.name) && ClassDB::is_class_enabled(itype.name); // can_instance returns true if there's a constructor and the class is not 'disabled' - output.push_back(itype.is_singleton ? "static class " : (is_abstract ? "abstract class " : "class ")); + output.push_back(itype.is_singleton ? "static partial class " : (is_abstract ? "abstract partial class " : "partial class ")); output.push_back(itype.proxy_name); if (itype.is_singleton) { diff --git a/modules/mono/glue/cs_files/NodeExtensions.cs b/modules/mono/glue/cs_files/NodeExtensions.cs new file mode 100644 index 00000000000..a099b0e4006 --- /dev/null +++ b/modules/mono/glue/cs_files/NodeExtensions.cs @@ -0,0 +1,10 @@ +namespace Godot +{ + public partial class Node + { + public T GetNode(NodePath path) where T : Godot.Node + { + return (T)GetNode(path); + } + } +} diff --git a/modules/mono/glue/cs_files/VERSION.txt b/modules/mono/glue/cs_files/VERSION.txt index b8626c4cff2..7ed6ff82de6 100755 --- a/modules/mono/glue/cs_files/VERSION.txt +++ b/modules/mono/glue/cs_files/VERSION.txt @@ -1 +1 @@ -4 +5