summaryrefslogtreecommitdiff
path: root/doc/classes
diff options
context:
space:
mode:
Diffstat (limited to 'doc/classes')
-rw-r--r--doc/classes/HTTPRequest.xml10
-rw-r--r--doc/classes/PackedScene.xml7
-rw-r--r--doc/classes/Resource.xml3
-rw-r--r--doc/classes/Timer.xml1
4 files changed, 19 insertions, 2 deletions
diff --git a/doc/classes/HTTPRequest.xml b/doc/classes/HTTPRequest.xml
index 53ca1fc6a9..0b0d71fccf 100644
--- a/doc/classes/HTTPRequest.xml
+++ b/doc/classes/HTTPRequest.xml
@@ -14,11 +14,19 @@
add_child(http_request)
http_request.connect("request_completed", self, "_http_request_completed")
- # Perform the HTTP request. The URL below returns some JSON as of writing.
+ # Perform a GET request. The URL below returns JSON as of writing.
var error = http_request.request("https://httpbin.org/get")
if error != OK:
push_error("An error occurred in the HTTP request.")
+ # Perform a POST request. The URL below returns JSON as of writing.
+ # Note: Don't make simultaneous requests using a single HTTPRequest node.
+ # The snippet below is provided for reference only.
+ var body = {"name": "Godette"}
+ var error = http_request.request("https://httpbin.org/post", [], true, HTTPClient.METHOD_POST, body)
+ if error != OK:
+ push_error("An error occurred in the HTTP request.")
+
# Called when the HTTP request is completed.
func _http_request_completed(result, response_code, headers, body):
diff --git a/doc/classes/PackedScene.xml b/doc/classes/PackedScene.xml
index 2d70dea012..bb56330248 100644
--- a/doc/classes/PackedScene.xml
+++ b/doc/classes/PackedScene.xml
@@ -7,6 +7,13 @@
A simplified interface to a scene file. Provides access to operations and checks that can be performed on the scene resource itself.
Can be used to save a node to a file. When saving, the node as well as all the node it owns get saved (see [code]owner[/code] property on [Node]).
[b]Note:[/b] The node doesn't need to own itself.
+ [b]Example of loading a saved scene:[/b]
+ [codeblock]
+ # Use `load()` instead of `preload()` if the path isn't known at compile-time.
+ var scene = preload("res://scene.tscn").instance()
+ # Add the node as a child of the node the script is attached to.
+ add_child(scene)
+ [/codeblock]
[b]Example of saving a node with different owners:[/b] The following example creates 3 objects: [code]Node2D[/code] ([code]node[/code]), [code]RigidBody2D[/code] ([code]rigid[/code]) and [code]CollisionObject2D[/code] ([code]collision[/code]). [code]collision[/code] is a child of [code]rigid[/code] which is a child of [code]node[/code]. Only [code]rigid[/code] is owned by [code]node[/code] and [code]pack[/code] will therefore only save those two nodes, but not [code]collision[/code].
[codeblock]
# Create the objects.
diff --git a/doc/classes/Resource.xml b/doc/classes/Resource.xml
index 5bc34772c8..0aa40dffb3 100644
--- a/doc/classes/Resource.xml
+++ b/doc/classes/Resource.xml
@@ -23,7 +23,8 @@
<argument index="0" name="subresources" type="bool" default="false">
</argument>
<description>
- Duplicates the resource, returning a new resource. By default, sub-resources are shared between resource copies for efficiency, this can be changed by passing [code]true[/code] to the [code]subresources[/code] argument.
+ Duplicates the resource, returning a new resource. By default, sub-resources are shared between resource copies for efficiency. This can be changed by passing [code]true[/code] to the [code]subresources[/code] argument which will copy the subresources.
+ [b]Note:[/b] If [code]subresources[/code] is [code]true[/code], this method will only perform a shallow copy. Nested resources within subresources will not be duplicated and will still be shared.
</description>
</method>
<method name="get_local_scene" qualifiers="const">
diff --git a/doc/classes/Timer.xml b/doc/classes/Timer.xml
index c1e5987a06..5d684755fa 100644
--- a/doc/classes/Timer.xml
+++ b/doc/classes/Timer.xml
@@ -5,6 +5,7 @@
</brief_description>
<description>
Counts down a specified interval and emits a signal on reaching 0. Can be set to repeat or "one-shot" mode.
+ [b]Note:[/b] To create an one-shot timer without instantiating a node, use [method SceneTree.create_timer].
</description>
<tutorials>
</tutorials>