From 995a40e8efa9f7a868a6706e30c476305e16180b Mon Sep 17 00:00:00 2001 From: Ignacio Etcheverry Date: Wed, 12 Sep 2018 21:22:43 +0200 Subject: Move modules/mono/glue/cs_files to modules/mono/glue/Managed/Files Added dummy MSBuild project and solution to get tooling help when editing these files. --- .../Managed/Files/Extensions/NodeExtensions.cs | 45 ++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs (limited to 'modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs') diff --git a/modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs b/modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs new file mode 100644 index 0000000000..71534d7782 --- /dev/null +++ b/modules/mono/glue/Managed/Files/Extensions/NodeExtensions.cs @@ -0,0 +1,45 @@ +namespace Godot +{ + public partial class Node + { + public T GetNode(NodePath path) where T : Godot.Node + { + return (T)GetNode(path); + } + + public T GetNodeOrNull(NodePath path) where T : Godot.Node + { + return GetNode(path) as T; + } + + public T GetChild(int idx) where T : Godot.Node + { + return (T)GetChild(idx); + } + + public T GetChildOrNull(int idx) where T : Godot.Node + { + return GetChild(idx) as T; + } + + public T GetOwner() where T : Godot.Node + { + return (T)GetOwner(); + } + + public T GetOwnerOrNull() where T : Godot.Node + { + return GetOwner() as T; + } + + public T GetParent() where T : Godot.Node + { + return (T)GetParent(); + } + + public T GetParentOrNull() where T : Godot.Node + { + return GetParent() as T; + } + } +} -- cgit v1.2.3