From 65085d9330c37e9c753ec1cf2d2bcd6dc4adb69d Mon Sep 17 00:00:00 2001 From: 31 <31eee384@gmail.com> Date: Sun, 28 Jan 2024 22:45:53 -0800 Subject: [PATCH 1/2] c_sharp_exports.rst: clarify why exporting nodes/resources is useful --- tutorials/scripting/c_sharp/c_sharp_exports.rst | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tutorials/scripting/c_sharp/c_sharp_exports.rst b/tutorials/scripting/c_sharp/c_sharp_exports.rst index c1bc52436eb..9f116c278b5 100644 --- a/tutorials/scripting/c_sharp/c_sharp_exports.rst +++ b/tutorials/scripting/c_sharp/c_sharp_exports.rst @@ -71,7 +71,9 @@ Exported members can specify a default value; otherwise, the `default value of t set => _greeting = value; } -Resources and nodes can be exported. +Resources and nodes can be exported. The property editor shows a user-friendly +assignment dialog for these types. This can be used instead of ``GD.Load`` and +``GetNode``. .. code-block:: csharp @@ -81,6 +83,17 @@ Resources and nodes can be exported. [Export] public Node Node { get; set; } +Exporting a specific type of resource or node lets the property editor show a +filtered list of possibilities. + +.. code-block:: csharp + + [Export] + public PackedScene PackedScene { get; set; } + + [Export] + public RigidBody2D RigidBody2D { get; set; } + Grouping exports ---------------- From 7c344c528f4e2681b128844fc796695d75b31593 Mon Sep 17 00:00:00 2001 From: 31 <31eee384@gmail.com> Date: Mon, 29 Jan 2024 10:08:39 -0800 Subject: [PATCH 2/2] Simplify node/resource export in "Basic use" --- .../scripting/c_sharp/c_sharp_exports.rst | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/tutorials/scripting/c_sharp/c_sharp_exports.rst b/tutorials/scripting/c_sharp/c_sharp_exports.rst index 9f116c278b5..43db11cc614 100644 --- a/tutorials/scripting/c_sharp/c_sharp_exports.rst +++ b/tutorials/scripting/c_sharp/c_sharp_exports.rst @@ -71,20 +71,9 @@ Exported members can specify a default value; otherwise, the `default value of t set => _greeting = value; } -Resources and nodes can be exported. The property editor shows a user-friendly -assignment dialog for these types. This can be used instead of ``GD.Load`` and -``GetNode``. - -.. code-block:: csharp - - [Export] - public Resource Resource { get; set; } - - [Export] - public Node Node { get; set; } - -Exporting a specific type of resource or node lets the property editor show a -filtered list of possibilities. +Any type of ``Resource`` or ``Node`` can be exported. The property editor shows +a user-friendly assignment dialog for these types. This can be used instead of +``GD.Load`` and ``GetNode``. See :ref:`Nodes and Resources `. .. code-block:: csharp @@ -254,6 +243,8 @@ Color given as red-green-blue value (alpha will always be 1). [Export(PropertyHint.ColorNoAlpha)] private Color Color { get; set; } +.. _doc_c_sharp_exports_nodes: + Nodes -----