Merge pull request #20298 from PJB3005/18-07-20-mono-partial-api-ext

Makes Mono binding classes partial & adds GetNode<T>.
This commit is contained in:
Ignacio Etcheverry 2018-07-25 18:03:57 +02:00 committed by GitHub
commit fe28e323b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 1 deletions

View File

@ -729,7 +729,7 @@ Error BindingsGenerator::_generate_cs_type(const TypeInterface &itype, const Str
output.push_back(INDENT1 "public "); 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' 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); output.push_back(itype.proxy_name);
if (itype.is_singleton) { if (itype.is_singleton) {

View File

@ -0,0 +1,10 @@
namespace Godot
{
public partial class Node
{
public T GetNode<T>(NodePath path) where T : Godot.Node
{
return (T)GetNode(path);
}
}
}