Skip to content

Commit 37cf368

Browse files
committed
Clarify what is defined by the parent in Scene organization
"Parent-defined" could be understood as the method or signal from the parent being called, but the parent defines just the name of the method or signal, instead of the method body.
1 parent 094f10f commit 37cf368

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

tutorials/best_practices/scene_organization.rst

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ initialize it:
5959
$Child.signal_name.connect(method_on_the_object)
6060

6161
# Child
62-
signal_name.emit() # Triggers parent-defined behavior.
62+
signal_name.emit() # Triggers parent-specified behavior.
6363

6464
.. code-tab:: csharp
6565

6666
// Parent
6767
GetNode("Child").Connect("SignalName", Callable.From(ObjectWithMethod.MethodOnTheObject));
6868

6969
// Child
70-
EmitSignal("SignalName"); // Triggers parent-defined behavior.
70+
EmitSignal("SignalName"); // Triggers parent-specified behavior.
7171

7272
.. code-tab:: cpp C++
7373

@@ -80,7 +80,7 @@ initialize it:
8080
}
8181
8282
// Child
83-
emit_signal("signal_name"); // Triggers parent-defined behavior.
83+
emit_signal("signal_name"); // Triggers parent-specified behavior.
8484

8585
2. Call a method. Used to start behavior.
8686

@@ -91,15 +91,15 @@ initialize it:
9191
$Child.method_name = "do"
9292

9393
# Child, assuming it has String property 'method_name' and method 'do'.
94-
call(method_name) # Call parent-defined method (which child must own).
94+
call(method_name) # Call parent-specified method (which child must own).
9595

9696
.. code-tab:: csharp
9797

9898
// Parent
9999
GetNode("Child").Set("MethodName", "Do");
100100

101101
// Child
102-
Call(MethodName); // Call parent-defined method (which child must own).
102+
Call(MethodName); // Call parent-specified method (which child must own).
103103

104104
.. code-tab:: cpp C++
105105

@@ -110,7 +110,7 @@ initialize it:
110110
}
111111
112112
// Child
113-
call(method_name); // Call parent-defined method (which child must own).
113+
call(method_name); // Call parent-specified method (which child must own).
114114

115115
3. Initialize a :ref:`Callable <class_Callable>` property. Safer than a method
116116
as ownership of the method is unnecessary. Used to start behavior.
@@ -122,15 +122,15 @@ initialize it:
122122
$Child.func_property = object_with_method.method_on_the_object
123123

124124
# Child
125-
func_property.call() # Call parent-defined method (can come from anywhere).
125+
func_property.call() # Call parent-specified method (can come from anywhere).
126126

127127
.. code-tab:: csharp
128128

129129
// Parent
130130
GetNode("Child").Set("FuncProperty", Callable.From(ObjectWithMethod.MethodOnTheObject));
131131

132132
// Child
133-
FuncProperty.Call(); // Call parent-defined method (can come from anywhere).
133+
FuncProperty.Call(); // Call parent-specified method (can come from anywhere).
134134

135135
.. code-tab:: cpp C++
136136

@@ -141,7 +141,7 @@ initialize it:
141141
}
142142
143143
// Child
144-
func_property.call(); // Call parent-defined method (can come from anywhere).
144+
func_property.call(); // Call parent-specified method (can come from anywhere).
145145

146146
4. Initialize a Node or other Object reference.
147147

@@ -152,15 +152,15 @@ initialize it:
152152
$Child.target = self
153153

154154
# Child
155-
print(target) # Use parent-defined node.
155+
print(target) # Use parent-specified node.
156156

157157
.. code-tab:: csharp
158158

159159
// Parent
160160
GetNode("Child").Set("Target", this);
161161

162162
// Child
163-
GD.Print(Target); // Use parent-defined node.
163+
GD.Print(Target); // Use parent-specified node.
164164

165165
.. code-tab:: cpp C++
166166

@@ -182,15 +182,15 @@ initialize it:
182182
$Child.target_path = ".."
183183

184184
# Child
185-
get_node(target_path) # Use parent-defined NodePath.
185+
get_node(target_path) # Use parent-specified NodePath.
186186

187187
.. code-tab:: csharp
188188

189189
// Parent
190190
GetNode("Child").Set("TargetPath", NodePath(".."));
191191

192192
// Child
193-
GetNode(TargetPath); // Use parent-defined NodePath.
193+
GetNode(TargetPath); // Use parent-specified NodePath.
194194

195195
.. code-tab:: cpp C++
196196

@@ -201,7 +201,7 @@ initialize it:
201201
}
202202
203203
// Child
204-
get_node<Node>(target_path); // Use parent-defined NodePath.
204+
get_node<Node>(target_path); // Use parent-specified NodePath.
205205

206206
These options hide the points of access from the child node. This in turn
207207
keeps the child **loosely coupled** to its environment. You can reuse it
@@ -265,7 +265,7 @@ in another context without any extra changes to its API.
265265
GDCLASS(Left, Node)
266266

267267
protected:
268-
static void _bind_methods() {}
268+
static void _bind_methods() {}
269269

270270
public:
271271
Node *target = nullptr;
@@ -389,8 +389,8 @@ If you have a system that...
389389
to swap out the main scene's content. This structure more or less keeps
390390
the "World" as the main game node.
391391

392-
Any GUI would also need to be either a singleton, a transitory part of the
393-
"World", or manually added as a direct child of the root. Otherwise, the
392+
Any GUI would also need to be either a singleton, a transitory part of the
393+
"World", or manually added as a direct child of the root. Otherwise, the
394394
GUI nodes would also delete themselves during scene transitions.
395395

396396
If you have systems that modify other systems' data, you should define those as

0 commit comments

Comments
 (0)