Browse Source

Sync classref with current source

Rémi Verschelde 5 years ago
parent
commit
1f752eb961

+ 1 - 1
classes/class_area.rst

@@ -103,7 +103,7 @@ Emitted when another area exits.
 
 - **area_shape_entered** **(** :ref:`int<class_int>` area_id, :ref:`Area<class_Area>` area, :ref:`int<class_int>` area_shape, :ref:`int<class_int>` self_shape **)**
 
-Emitted when another area enters, reporting which areas overlapped.
+Emitted when another area enters, reporting which areas overlapped. ``shape_owner_get_owner(shape_find_owner(shape))`` returns the parent object of the owner of the ``shape``.
 
 ----
 

+ 1 - 1
classes/class_area2d.rst

@@ -95,7 +95,7 @@ Emitted when another area exits.
 
 - **area_shape_entered** **(** :ref:`int<class_int>` area_id, :ref:`Area2D<class_Area2D>` area, :ref:`int<class_int>` area_shape, :ref:`int<class_int>` self_shape **)**
 
-Emitted when another area enters, reporting which shapes overlapped.
+Emitted when another area enters, reporting which shapes overlapped. ``shape_owner_get_owner(shape_find_owner(shape))`` returns the parent object of the owner of the ``shape``.
 
 ----
 

+ 4 - 4
classes/class_array.rst

@@ -172,7 +172,7 @@ Appends an element at the end of the array (alias of :ref:`push_back<class_Array
 
 - :ref:`Variant<class_Variant>` **back** **(** **)**
 
-Returns the last element of the array if the array is not empty.
+Returns the last element of the array, or ``null`` if the array is empty.
 
 ----
 
@@ -258,7 +258,7 @@ Searches the array in reverse order for a value and returns its index or -1 if n
 
 - :ref:`Variant<class_Variant>` **front** **(** **)**
 
-Returns the first element of the array if the array is not empty.
+Returns the first element of the array, or ``null`` if the array is empty.
 
 ----
 
@@ -321,7 +321,7 @@ Returns the minimum value contained in the array if all elements are of comparab
 
 - :ref:`Variant<class_Variant>` **pop_back** **(** **)**
 
-Removes the last element of the array.
+Removes and returns the last element of the array. Returns ``null`` if the array is empty.
 
 ----
 
@@ -329,7 +329,7 @@ Removes the last element of the array.
 
 - :ref:`Variant<class_Variant>` **pop_front** **(** **)**
 
-Removes the first element of the array.
+Removes and returns the first element of the array. Returns ``null`` if the array is empty.
 
 ----
 

+ 8 - 6
classes/class_basis.rst

@@ -85,13 +85,13 @@ Constants
 
 .. _class_Basis_constant_FLIP_Z:
 
-- **IDENTITY** = **Basis( 1, 0, 0, 0, 1, 0, 0, 0, 1 )**
+- **IDENTITY** = **Basis( 1, 0, 0, 0, 1, 0, 0, 0, 1 )** --- The identity basis. This is identical to calling ``Basis()`` without any parameters. This constant can be used to make your code clearer.
 
-- **FLIP_X** = **Basis( -1, 0, 0, 0, 1, 0, 0, 0, 1 )**
+- **FLIP_X** = **Basis( -1, 0, 0, 0, 1, 0, 0, 0, 1 )** --- The basis that will flip something along the X axis when used in a transformation.
 
-- **FLIP_Y** = **Basis( 1, 0, 0, 0, -1, 0, 0, 0, 1 )**
+- **FLIP_Y** = **Basis( 1, 0, 0, 0, -1, 0, 0, 0, 1 )** --- The basis that will flip something along the Y axis when used in a transformation.
 
-- **FLIP_Z** = **Basis( 1, 0, 0, 0, 1, 0, 0, 0, -1 )**
+- **FLIP_Z** = **Basis( 1, 0, 0, 0, 1, 0, 0, 0, -1 )** --- The basis that will flip something along the Z axis when used in a transformation.
 
 Description
 -----------
@@ -183,7 +183,7 @@ Returns the determinant of the matrix.
 
 - :ref:`Vector3<class_Vector3>` **get_euler** **(** **)**
 
-Assuming that the matrix is a proper rotation matrix (orthonormal matrix with determinant +1), return Euler angles (in the YXZ convention: first Z, then X, and Y last). Returned vector contains the rotation angles in the format (X angle, Y angle, Z angle).
+Returns the basis's rotation in the form of Euler angles (in the YXZ convention: first Z, then X, and Y last). The returned vector contains the rotation angles in the format (X angle, Y angle, Z angle). See :ref:`get_rotation_quat<class_Basis_method_get_rotation_quat>` if you need a quaternion instead.
 
 ----
 
@@ -191,7 +191,7 @@ Assuming that the matrix is a proper rotation matrix (orthonormal matrix with de
 
 - :ref:`int<class_int>` **get_orthogonal_index** **(** **)**
 
-This function considers a discretization of rotations into 24 points on unit sphere, lying along the vectors (x,y,z) with each component being either -1,0 or 1, and returns the index of the point best representing the orientation of the object. It is mainly used by the grid map editor. For further details, refer to Godot source code.
+This function considers a discretization of rotations into 24 points on unit sphere, lying along the vectors (x,y,z) with each component being either -1, 0, or 1, and returns the index of the point best representing the orientation of the object. It is mainly used by the grid map editor. For further details, refer to the Godot source code.
 
 ----
 
@@ -199,6 +199,8 @@ This function considers a discretization of rotations into 24 points on unit sph
 
 - :ref:`Quat<class_Quat>` **get_rotation_quat** **(** **)**
 
+Returns the basis's rotation in the form of a quaternion. See :ref:`get_euler<class_Basis_method_get_euler>` if you need Euler angles, but keep in mind quaternions should generally be preferred to Euler angles.
+
 ----
 
 .. _class_Basis_method_get_scale:

+ 3 - 1
classes/class_bitmapfont.rst

@@ -16,7 +16,9 @@ BitmapFont
 Brief Description
 -----------------
 
-Renders text using ``*.fnt`` fonts.
+Renders text using fonts under the `BMFont <https://www.angelcode.com/products/bmfont/>`_ format.
+
+Handles files with the ``.fnt`` extension
 
 Properties
 ----------

+ 23 - 0
classes/class_httprequest.rst

@@ -125,6 +125,29 @@ A node with the ability to send HTTP requests. Uses :ref:`HTTPClient<class_HTTPC
 
 Can be used to make HTTP requests, i.e. download or upload files or web content via HTTP.
 
+**Example of contacting a REST API and printing one of its returned fields:**
+
+::
+
+    func _ready():
+        # Create an HTTP request node and connect its completion signal.
+        var http_request = HTTPRequest.new()
+        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.
+        var error = http_request.request("https://httpbin.org/get")
+        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):
+        var response = parse_json(body.get_string_from_utf8())
+    
+        # Will print the user agent string used by the HTTPRequest node (as recognized by httpbin.org).
+        print(response.headers["User-Agent"])
+
 **Example of loading and displaying an image using HTTPRequest:**
 
 ::

+ 1 - 1
classes/class_immediategeometry.rst

@@ -63,7 +63,7 @@ Simple helper to draw an UV sphere with given latitude, longitude and radius.
 
 - void **add_vertex** **(** :ref:`Vector3<class_Vector3>` position **)**
 
-Adds a vertex with the currently set color/uv/etc.
+Adds a vertex in local coordinate space with the currently set color/uv/etc.
 
 ----
 

+ 2 - 0
classes/class_inputevent.rst

@@ -83,6 +83,8 @@ Property Descriptions
 
 The event's device ID.
 
+**Note:** This device ID will always be ``-1`` for emulated mouse input from a touchscreen. This can be used to distinguish emulated mouse input from physical mouse input.
+
 Method Descriptions
 -------------------
 

+ 1 - 1
classes/class_kinematiccollision.rst

@@ -77,7 +77,7 @@ The colliding body.
 | *Getter*  | get_collider_id() |
 +-----------+-------------------+
 
-The colliding body's unique :ref:`RID<class_RID>`.
+The colliding body's unique instance ID. See :ref:`Object.get_instance_id<class_Object_method_get_instance_id>`.
 
 ----
 

+ 1 - 1
classes/class_kinematiccollision2d.rst

@@ -77,7 +77,7 @@ The colliding body.
 | *Getter*  | get_collider_id() |
 +-----------+-------------------+
 
-The colliding body's unique :ref:`RID<class_RID>`.
+The colliding body's unique instance ID. See :ref:`Object.get_instance_id<class_Object_method_get_instance_id>`.
 
 ----
 

+ 1 - 1
classes/class_light2d.rst

@@ -433,7 +433,7 @@ Smooth shadow gradient length.
 | *Getter*  | get_item_shadow_cull_mask()      |
 +-----------+----------------------------------+
 
-The shadow mask. Used with :ref:`LightOccluder2D<class_LightOccluder2D>` to cast shadows. Only occluders with a matching shadow mask will cast shadows.
+The shadow mask. Used with :ref:`LightOccluder2D<class_LightOccluder2D>` to cast shadows. Only occluders with a matching light mask will cast shadows.
 
 ----
 

+ 3 - 1
classes/class_node.rst

@@ -292,6 +292,8 @@ enum **DuplicateFlags**:
 
 - **DUPLICATE_USE_INSTANCING** = **8** --- Duplicate using instancing.
 
+An instance stays linked to the original so when the original changes, the instance changes too.
+
 Constants
 ---------
 
@@ -572,7 +574,7 @@ Pause mode. How the node will behave if the :ref:`SceneTree<class_SceneTree>` is
 | *Getter*  | get_process_priority()      |
 +-----------+-----------------------------+
 
-The node's priority in the execution order of the enabled processing callbacks (i.e. :ref:`NOTIFICATION_PROCESS<class_Node_constant_NOTIFICATION_PROCESS>`, :ref:`NOTIFICATION_PHYSICS_PROCESS<class_Node_constant_NOTIFICATION_PHYSICS_PROCESS>` and their internal counterparts). Nodes with a higher process priority will have their processing callbacks executed first.
+The node's priority in the execution order of the enabled processing callbacks (i.e. :ref:`NOTIFICATION_PROCESS<class_Node_constant_NOTIFICATION_PROCESS>`, :ref:`NOTIFICATION_PHYSICS_PROCESS<class_Node_constant_NOTIFICATION_PHYSICS_PROCESS>` and their internal counterparts). Nodes whose process priority value is *lower* will have their processing callbacks executed first.
 
 Method Descriptions
 -------------------

+ 2 - 2
classes/class_node2d.rst

@@ -18,7 +18,7 @@ Node2D
 Brief Description
 -----------------
 
-A 2D game object, parent of all 2D-related nodes. Has a position, rotation, scale and Z index.
+A 2D game object, inherited by all 2D-related nodes. Has a position, rotation, scale, and Z index.
 
 Properties
 ----------
@@ -79,7 +79,7 @@ Methods
 Description
 -----------
 
-A 2D game object, with a position, rotation and scale. All 2D physics nodes and sprites inherit from Node2D. Use Node2D as a parent node to move, scale and rotate children in a 2D project. Also gives control on the node's render order.
+A 2D game object, with a transform (position, rotation, and scale). All 2D nodes, including physics objects and sprites, inherit from Node2D. Use Node2D as a parent node to move, scale and rotate children in a 2D project. Also gives control of the node's render order.
 
 Tutorials
 ---------

+ 8 - 0
classes/class_object.rst

@@ -171,6 +171,14 @@ Some classes that extend Object add memory management. This is the case of :ref:
 
 Objects export properties, which are mainly useful for storage and editing, but not really so much in programming. Properties are exported in :ref:`_get_property_list<class_Object_method__get_property_list>` and handled in :ref:`_get<class_Object_method__get>` and :ref:`_set<class_Object_method__set>`. However, scripting languages and C++ have simpler means to export them.
 
+Property membership can be tested directly in GDScript using ``in``:
+
+::
+
+    var n = Node2D.new()
+    print("position" in n)  # Prints "True".
+    print("other_property" in n)  # Prints "False".
+
 Objects also receive notifications. Notifications are a simple way to notify the object about different events, so they can all be handled together. See :ref:`_notification<class_Object_method__notification>`.
 
 Method Descriptions

+ 1 - 1
classes/class_os.rst

@@ -515,7 +515,7 @@ The current screen index (starting from 0).
 | *Getter*  | get_exit_code()      |
 +-----------+----------------------+
 
-The exit code passed to the OS when the main loop exits.
+The exit code passed to the OS when the main loop exits. By convention, an exit code of ``0`` indicates success whereas a non-zero exit code indicates an error. For portability reasons, the exit code should be set between 0 and 125 (inclusive).
 
 ----
 

+ 2 - 0
classes/class_richtextlabel.rst

@@ -350,6 +350,8 @@ If ``true``, the label uses BBCode formatting.
 
 The label's text in BBCode format. Is not representative of manual modifications to the internal tag stack. Erases changes made by other methods when edited.
 
+**Note:** It is unadvised to use ``+=`` operator with ``bbcode_text`` (e.g. ``bbcode_text += "some string"``) as it replaces the whole text and can cause slowdowns. Use :ref:`append_bbcode<class_RichTextLabel_method_append_bbcode>` for adding text instead.
+
 ----
 
 .. _class_RichTextLabel_property_custom_effects:

+ 1 - 1
classes/class_vehiclewheel.rst

@@ -296,7 +296,7 @@ This is the distance in meters the wheel is lowered from its origin point. Don't
 | *Getter*  | get_roll_influence()      |
 +-----------+---------------------------+
 
-This value affects the roll of your vehicle. If set to 0.0 for all wheels, your vehicle will be prone to rolling over, while a value of 1.0 will resist body roll.
+This value affects the roll of your vehicle. If set to 1.0 for all wheels, your vehicle will be prone to rolling over, while a value of 0.0 will resist body roll.
 
 Method Descriptions
 -------------------