mirror of
https://github.com/godotengine/godot-docs.git
synced 2025-12-31 17:49:03 +03:00
Replace Pool*Arrays with Packed*Arrays in tutorials and references
This commit is contained in:
@@ -282,13 +282,15 @@ class GDScriptLexer(RegexLexer):
|
||||
"NodePath",
|
||||
"Dictionary",
|
||||
"Array",
|
||||
"PoolByteArray",
|
||||
"PoolIntArray",
|
||||
"PoolRealArray",
|
||||
"PoolStringArray",
|
||||
"PoolVector2Array",
|
||||
"PoolVector3Array",
|
||||
"PoolColorArray",
|
||||
"PackedByteArray",
|
||||
"PackedInt32Array",
|
||||
"PackedInt64Array",
|
||||
"PackedFloat32Array",
|
||||
"PackedFloat64Array",
|
||||
"PackedStringArray",
|
||||
"PackedVector2Array",
|
||||
"PackedVector3Array",
|
||||
"PackedColorArray",
|
||||
"null",
|
||||
),
|
||||
prefix=r"(?<!\.)",
|
||||
|
||||
@@ -408,7 +408,7 @@ Each track is described by a list of key-value pairs in the format
|
||||
- 1 (linear)
|
||||
- 2 (cubic)
|
||||
|
||||
4. The ``keys`` correspond to the keyframes. It appears as a ``PoolRealArray()``,
|
||||
4. The ``keys`` correspond to the keyframes. It appears as a ``PackedFloat32Array()``,
|
||||
but may have a different structure for tracks with different types.
|
||||
|
||||
- A Transform track uses every 12 real numbers in the ``keys`` to describe
|
||||
@@ -430,11 +430,11 @@ Each track is described by a list of key-value pairs in the format
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = true
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = PoolRealArray( 0, 1, -0.0358698, -0.829927, 0.444204, 0, 0, 0, 1, 0.815074, 0.815074, 0.815074, 4.95833, 1, -0.0358698, -0.829927, 0.444204, 0, 0, 0, 1, 0.815074, 0.815074, 0.815074 )
|
||||
tracks/0/keys = PackedFloat32Array( 0, 1, -0.0358698, -0.829927, 0.444204, 0, 0, 0, 1, 0.815074, 0.815074, 0.815074, 4.95833, 1, -0.0358698, -0.829927, 0.444204, 0, 0, 0, 1, 0.815074, 0.815074, 0.815074 )
|
||||
tracks/1/type = "transform"
|
||||
tracks/1/path = NodePath("Armature001/Skeleton:Bone.001")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = true
|
||||
tracks/1/enabled = false
|
||||
tracks/1/keys = PoolRealArray( 0, 1, 0, 5.96046e-08, 0, 0, 0, 0, 1, 1, 1, 1, 4.95833, 1, 0, 5.96046e-08, 0, 0, 0, 0, 1, 1, 1, 1 )
|
||||
tracks/1/keys = PackedFloat32Array( 0, 1, 0, 5.96046e-08, 0, 0, 0, 0, 1, 1, 1, 1, 4.95833, 1, 0, 5.96046e-08, 0, 0, 0, 0, 1, 1, 1, 1 )
|
||||
|
||||
@@ -266,20 +266,22 @@ GDScript C#
|
||||
Array
|
||||
-----
|
||||
|
||||
*This is temporary. PoolArrays will need their own types to be used the way they are meant to.*
|
||||
*This is temporary. PackedArrays will need their own types to be used the way they are meant to.*
|
||||
|
||||
===================== ==============================================================
|
||||
GDScript C#
|
||||
===================== ==============================================================
|
||||
``Array`` ``Godot.Collections.Array``
|
||||
``PoolIntArray`` ``int[]``
|
||||
``PoolByteArray`` ``byte[]``
|
||||
``PoolFloatArray`` ``float[]``
|
||||
``PoolStringArray`` ``String[]``
|
||||
``PoolColorArray`` ``Color[]``
|
||||
``PoolVector2Array`` ``Vector2[]``
|
||||
``PoolVector3Array`` ``Vector3[]``
|
||||
===================== ==============================================================
|
||||
====================== ==============================================================
|
||||
GDScript C#
|
||||
====================== ==============================================================
|
||||
``Array`` ``Godot.Collections.Array``
|
||||
``PackedInt32Array`` ``int[]``
|
||||
``PackedInt64Array`` ``long[]``
|
||||
``PackedByteArray`` ``byte[]``
|
||||
``PackedFloat32Array`` ``float[]``
|
||||
``PackedFloat64Array`` ``double[]``
|
||||
``PackedStringArray`` ``String[]``
|
||||
``PackedColorArray`` ``Color[]``
|
||||
``PackedVector2Array`` ``Vector2[]``
|
||||
``PackedVector3Array`` ``Vector3[]``
|
||||
====================== ==============================================================
|
||||
|
||||
``Godot.Collections.Array<T>`` is a type-safe wrapper around ``Godot.Collections.Array``.
|
||||
Use the ``Godot.Collections.Array<T>(Godot.Collections.Array)`` constructor to create one.
|
||||
|
||||
@@ -339,7 +339,7 @@ Built-in types
|
||||
Built-in types are stack-allocated. They are passed as values. This means a copy
|
||||
is created on each assignment or when passing them as arguments to functions.
|
||||
The only exceptions are ``Array``\ s and ``Dictionaries``, which are passed by
|
||||
reference so they are shared. (Pooled arrays such as ``PoolByteArray`` are still
|
||||
reference so they are shared. (Pooled arrays such as ``PackedByteArray`` are still
|
||||
passed as values.)
|
||||
|
||||
Basic built-in types
|
||||
@@ -370,7 +370,7 @@ It is stored as a 64-bit value, equivalent to "int64_t" in C++.
|
||||
Stores real numbers, including decimals, using floating-point values.
|
||||
It is stored as a 64-bit value, equivalent to "double" in C++.
|
||||
Note: Currently, data structures such as Vector2, Vector3, and
|
||||
PoolRealArray store 32-bit single-precision "float" values.
|
||||
PackedFloat32Array store 32-bit single-precision "float" values.
|
||||
|
||||
:ref:`String <class_String>`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
@@ -490,13 +490,15 @@ arrays are available. These only accept a single data type. They avoid memory
|
||||
fragmentation and use less memory, but are atomic and tend to run slower than generic
|
||||
arrays. They are therefore only recommended to use for large data sets:
|
||||
|
||||
- :ref:`PoolByteArray <class_PoolByteArray>`: An array of bytes (integers from 0 to 255).
|
||||
- :ref:`PoolIntArray <class_PoolIntArray>`: An array of integers.
|
||||
- :ref:`PoolRealArray <class_PoolRealArray>`: An array of floats.
|
||||
- :ref:`PoolStringArray <class_PoolStringArray>`: An array of strings.
|
||||
- :ref:`PoolVector2Array <class_PoolVector2Array>`: An array of :ref:`Vector2 <class_Vector2>` objects.
|
||||
- :ref:`PoolVector3Array <class_PoolVector3Array>`: An array of :ref:`Vector3 <class_Vector3>` objects.
|
||||
- :ref:`PoolColorArray <class_PoolColorArray>`: An array of :ref:`Color <class_Color>` objects.
|
||||
- :ref:`PackedByteArray <class_PackedByteArray>`: An array of bytes (integers from 0 to 255).
|
||||
- :ref:`PackedInt32Array <class_PackedInt32Array>`: An array of 32-bit integers.
|
||||
- :ref:`PackedInt64Array <class_PackedInt64Array>`: An array of 64-bit integers.
|
||||
- :ref:`PackedFloat32Array <class_PackedFloat32Array>`: An array of 32-bit floats.
|
||||
- :ref:`PackedFloat64Array <class_PackedFloat64Array>`: An array of 64-bit floats.
|
||||
- :ref:`PackedStringArray <class_PackedStringArray>`: An array of strings.
|
||||
- :ref:`PackedVector2Array <class_PackedVector2Array>`: An array of :ref:`Vector2 <class_Vector2>` objects.
|
||||
- :ref:`PackedVector3Array <class_PackedVector3Array>`: An array of :ref:`Vector3 <class_Vector3>` objects.
|
||||
- :ref:`PackedColorArray <class_PackedColorArray>`: An array of :ref:`Color <class_Color>` objects.
|
||||
|
||||
:ref:`Dictionary <class_Dictionary>`
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
@@ -173,8 +173,8 @@ initializers, but they must be constant expressions.
|
||||
|
||||
# Typed arrays also work, only initialized empty:
|
||||
|
||||
export var vector3s = PoolVector3Array()
|
||||
export var strings = PoolStringArray()
|
||||
export var vector3s = PackedVector3Array()
|
||||
export var strings = PackedStringArray()
|
||||
|
||||
# Regular array, created local for every instance.
|
||||
# Default value can include run-time values, but can't
|
||||
|
||||
@@ -54,7 +54,7 @@ to each other.
|
||||
array object in traditional C++ libraries. It is a "templated"
|
||||
type, meaning that its records can only contain a particular type (denoted
|
||||
by angled brackets). So, for example, a
|
||||
:ref:`PoolStringArray <class_PoolStringArray>` would be something like
|
||||
:ref:`PackedStringArray <class_PackedStringArray>` would be something like
|
||||
a ``Vector<String>``.
|
||||
|
||||
Contiguous memory stores imply the following operation performance:
|
||||
|
||||
@@ -193,7 +193,7 @@ returned by ``eval()`` under certain circumstances:
|
||||
* JavaScript ``boolean`` is returned as GDScript :ref:`class_bool`
|
||||
* JavaScript ``string`` is returned as GDScript :ref:`class_String`
|
||||
* JavaScript ``ArrayBuffer``, ``TypedArray`` and ``DataView`` are returned as
|
||||
GDScript :ref:`class_PoolByteArray`
|
||||
GDScript :ref:`PackedByteArray<class_PackedByteArray>`
|
||||
|
||||
::
|
||||
|
||||
|
||||
@@ -171,7 +171,7 @@ In our example, we will simply use a fixed number of points, no matter the radiu
|
||||
|
||||
func draw_circle_arc(center, radius, angle_from, angle_to, color):
|
||||
var nb_points = 32
|
||||
var points_arc = PoolVector2Array()
|
||||
var points_arc = PackedVector2Array()
|
||||
|
||||
for i in range(nb_points + 1):
|
||||
var angle_point = deg2rad(angle_from + i * (angle_to-angle_from) / nb_points - 90)
|
||||
@@ -200,7 +200,7 @@ In our example, we will simply use a fixed number of points, no matter the radiu
|
||||
|
||||
Remember the number of points our shape has to be decomposed into? We fixed this
|
||||
number in the ``nb_points`` variable to a value of ``32``. Then, we initialize an empty
|
||||
``PoolVector2Array``, which is simply an array of ``Vector2``\ s.
|
||||
``PackedVector2Array``, which is simply an array of ``Vector2``\ s.
|
||||
|
||||
The next step consists of computing the actual positions of these 32 points that
|
||||
compose an arc. This is done in the first for-loop: we iterate over the number of
|
||||
@@ -219,7 +219,7 @@ between -1 and 1, the position is located on a circle of radius 1. To have this
|
||||
position on our support circle, which has a radius of ``radius``, we simply need to
|
||||
multiply the position by ``radius``. Finally, we need to position our support circle
|
||||
at the ``center`` position, which is performed by adding it to our ``Vector2`` value.
|
||||
Finally, we insert the point in the ``PoolVector2Array`` which was previously defined.
|
||||
Finally, we insert the point in the ``PackedVector2Array`` which was previously defined.
|
||||
|
||||
Now, we need to actually draw our points. As you can imagine, we will not simply
|
||||
draw our 32 points: we need to draw everything that is between each of them.
|
||||
@@ -276,9 +276,9 @@ the same as before, except that we draw a polygon instead of lines:
|
||||
|
||||
func draw_circle_arc_poly(center, radius, angle_from, angle_to, color):
|
||||
var nb_points = 32
|
||||
var points_arc = PoolVector2Array()
|
||||
var points_arc = PackedVector2Array()
|
||||
points_arc.push_back(center)
|
||||
var colors = PoolColorArray([color])
|
||||
var colors = PackedColorArray([color])
|
||||
|
||||
for i in range(nb_points + 1):
|
||||
var angle_point = deg2rad(angle_from + i * (angle_to - angle_from) / nb_points - 90)
|
||||
|
||||
@@ -14,19 +14,19 @@ lines, points, etc. A complete list can be found under the :ref:`Mesh <class_mes
|
||||
class reference page.
|
||||
|
||||
The second is the actual Array that stores the mesh information. The array is a normal Godot array that
|
||||
is constructed with empty brackets ``[]``. It stores a ``Pool**Array`` (e.g. PoolVector3Array,
|
||||
PoolIntArray, etc.) for each type of information.
|
||||
is constructed with empty brackets ``[]``. It stores a ``Packed**Array`` (e.g. PackedVector3Array,
|
||||
PackedInt32Array, etc.) for each type of information.
|
||||
|
||||
- ``ARRAY_VERTEX`` = 0 | PoolVector3Array or PoolVector2Array
|
||||
- ``ARRAY_NORMAL`` = 1 | PoolVector3Array
|
||||
- ``ARRAY_TANGENT`` = 2 | PoolRealArray of groups of 4 floats. first 3 floats determine the tangent, and
|
||||
- ``ARRAY_VERTEX`` = 0 | PackedVector3Array or PackedVector2Array
|
||||
- ``ARRAY_NORMAL`` = 1 | PackedVector3Array
|
||||
- ``ARRAY_TANGENT`` = 2 | PackedFloat32Array of groups of 4 floats. first 3 floats determine the tangent, and
|
||||
the last the binormal direction as -1 or 1.
|
||||
- ``ARRAY_COLOR`` = 3 | PoolColorArray
|
||||
- ``ARRAY_TEX_UV`` = 4 | PoolVector2Array or PoolVector3Array
|
||||
- ``ARRAY_TEX_UV2`` = 5 | PoolVector2Array or PoolVector3Array
|
||||
- ``ARRAY_BONES`` = 6 | PoolRealArray of groups of 4 floats or PoolIntArray of groups of 4 ints
|
||||
- ``ARRAY_WEIGHTS`` = 7 | PoolRealArray of groups of 4 floats
|
||||
- ``ARRAY_INDEX`` = 8 | PoolIntArray
|
||||
- ``ARRAY_COLOR`` = 3 | PackedColorArray
|
||||
- ``ARRAY_TEX_UV`` = 4 | PackedVector2Array or PackedVector3Array
|
||||
- ``ARRAY_TEX_UV2`` = 5 | PackedVector2Array or PackedVector3Array
|
||||
- ``ARRAY_BONES`` = 6 | PackedFloat32Array of groups of 4 floats or PackedInt32Array of groups of 4 ints
|
||||
- ``ARRAY_WEIGHTS`` = 7 | PackedFloat32Array of groups of 4 floats
|
||||
- ``ARRAY_INDEX`` = 8 | PackedInt32Array
|
||||
|
||||
The Array of vertices is always required. All the others are optional and will only be used if included.
|
||||
|
||||
@@ -75,10 +75,10 @@ Next create the arrays for each data type you will use.
|
||||
.. tabs::
|
||||
.. code-tab:: gdscript GDScript
|
||||
|
||||
var verts = PoolVector3Array()
|
||||
var uvs = PoolVector2Array()
|
||||
var normals = PoolVector3Array()
|
||||
var indices = PoolIntArray()
|
||||
var verts = PackedVector3Array()
|
||||
var uvs = PackedVector2Array()
|
||||
var normals = PackedVector3Array()
|
||||
var indices = PackedInt32Array()
|
||||
|
||||
Once you have filled your data arrays with your geometry you can create a mesh
|
||||
by adding each array to ``surface_array`` and then committing to the mesh.
|
||||
@@ -107,11 +107,11 @@ Put together the full code looks like:
|
||||
var arr = []
|
||||
arr.resize(Mesh.ARRAY_MAX)
|
||||
|
||||
# PoolVectorXXArrays for mesh construction.
|
||||
var verts = PoolVector3Array()
|
||||
var uvs = PoolVector2Array()
|
||||
var normals = PoolVector3Array()
|
||||
var indices = PoolIntArray()
|
||||
# PackedVectorXArrays for mesh construction.
|
||||
var verts = PackedVector3Array()
|
||||
var uvs = PackedVector2Array()
|
||||
var normals = PackedVector3Array()
|
||||
var indices = PackedInt32Array()
|
||||
|
||||
#######################################
|
||||
## Insert code here to generate mesh ##
|
||||
@@ -152,7 +152,7 @@ that you find online.
|
||||
|
||||
func _ready():
|
||||
|
||||
# Set up the PoolVectorXArrays.
|
||||
# Set up the PackedVectorXArrays.
|
||||
|
||||
# Vertex indices.
|
||||
var thisrow = 0
|
||||
|
||||
@@ -59,7 +59,7 @@ Surface array
|
||||
|
||||
The surface array is an array of length ``ArrayMesh.ARRAY_MAX``. Each position in the array is
|
||||
filled with a sub-array containing per-vertex information. For example, the array located at
|
||||
``ArrayMesh.ARRAY_NORMAL`` is a :ref:`PoolVector3Array <class_PoolVector3Array>` of vertex normals.
|
||||
``ArrayMesh.ARRAY_NORMAL`` is a :ref:`PackedVector3Array <class_PackedVector3Array>` of vertex normals.
|
||||
|
||||
The surface array can be indexed or non-indexed. Creating a non-indexed array is as easy as not assigning
|
||||
an array at the index ``ArrayMesh.ARRAY_INDEX``. A non-indexed array stores unique vertex information for
|
||||
|
||||
@@ -64,19 +64,23 @@ integer, specifying the type of data:
|
||||
+--------+--------------------------+
|
||||
| 20 | raw array |
|
||||
+--------+--------------------------+
|
||||
| 21 | int array |
|
||||
| 21 | int32 array |
|
||||
+--------+--------------------------+
|
||||
| 22 | real array |
|
||||
| 22 | int64 array |
|
||||
+--------+--------------------------+
|
||||
| 23 | string array |
|
||||
| 23 | float32 array |
|
||||
+--------+--------------------------+
|
||||
| 24 | vector2 array |
|
||||
| 24 | float64 array |
|
||||
+--------+--------------------------+
|
||||
| 25 | vector3 array |
|
||||
| 25 | string array |
|
||||
+--------+--------------------------+
|
||||
| 26 | color array |
|
||||
| 26 | vector2 array |
|
||||
+--------+--------------------------+
|
||||
| 27 | max |
|
||||
| 27 | vector3 array |
|
||||
+--------+--------------------------+
|
||||
| 28 | color array |
|
||||
+--------+--------------------------+
|
||||
| 29 | max |
|
||||
+--------+--------------------------+
|
||||
|
||||
Following this is the actual packet contents, which varies for each type
|
||||
@@ -109,7 +113,7 @@ of packet:
|
||||
+----------+-------+---------+-------------------------+
|
||||
| Offset | Len | Type | Description |
|
||||
+==========+=======+=========+=========================+
|
||||
| 4 | 4 | Float | IEE 754 32-Bits Float |
|
||||
| 4 | 4 | Float | IEEE 754 32-Bits Float |
|
||||
+----------+-------+---------+-------------------------+
|
||||
|
||||
4: :ref:`String<class_string>`
|
||||
@@ -376,8 +380,8 @@ one after the other, using this same format.
|
||||
Then what follows is, for amount of "elements", values one after the
|
||||
other, using this same format.
|
||||
|
||||
20: :ref:`PoolByteArray<class_poolbytearray>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
20: :ref:`PackedByteArray<class_PackedByteArray>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+---------------+-------+-----------+------------------------+
|
||||
| Offset | Len | Type | Description |
|
||||
@@ -389,8 +393,8 @@ other, using this same format.
|
||||
|
||||
The array data is padded to 4 bytes.
|
||||
|
||||
21: :ref:`PoolIntArray<class_poolintarray>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
21: :ref:`PackedInt32Array<class_PackedInt32Array>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+------------------+-------+-----------+---------------------------+
|
||||
| Offset | Len | Type | Description |
|
||||
@@ -400,19 +404,41 @@ The array data is padded to 4 bytes.
|
||||
| 8..8+length\*4 | 4 | Integer | 32 Bits Signed Integer |
|
||||
+------------------+-------+-----------+---------------------------+
|
||||
|
||||
22: :ref:`PoolRealArray<class_poolrealarray>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
22: :ref:`PackedInt64Array<class_PackedInt64Array>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+------------------+-------+-----------+---------------------------+
|
||||
| Offset | Len | Type | Description |
|
||||
+==================+=======+===========+===========================+
|
||||
| 4 | 4 |Integer | Array Length (Floats) |
|
||||
| 4 | 8 | Integer | Array Length (Integers) |
|
||||
+------------------+-------+-----------+---------------------------+
|
||||
| 8..8+length\*4 | 4 |Integer | 32 Bits IEE 754 Float |
|
||||
| 8..8+length\*8 | 8 | Integer | 64 Bits Signed Integer |
|
||||
+------------------+-------+-----------+---------------------------+
|
||||
|
||||
23: :ref:`PoolStringArray<class_poolstringarray>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
23: :ref:`PackedFloat32Array<class_PackedFloat32Array>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+------------------+-------+-----------+---------------------------+
|
||||
| Offset | Len | Type | Description |
|
||||
+==================+=======+===========+===========================+
|
||||
| 4 | 4 | Integer | Array Length (Floats) |
|
||||
+------------------+-------+-----------+---------------------------+
|
||||
| 8..8+length\*4 | 4 | Integer | 32 Bits IEEE 754 Float |
|
||||
+------------------+-------+-----------+---------------------------+
|
||||
|
||||
24: :ref:`PackedFloat64Array<class_PackedFloat64Array>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+------------------+-------+-----------+---------------------------+
|
||||
| Offset | Len | Type | Description |
|
||||
+==================+=======+===========+===========================+
|
||||
| 4 | 4 | Integer | Array Length (Floats) |
|
||||
+------------------+-------+-----------+---------------------------+
|
||||
| 8..8+length\*8 | 8 | Integer | 64 Bits IEEE 754 Float |
|
||||
+------------------+-------+-----------+---------------------------+
|
||||
|
||||
25: :ref:`PackedStringArray<class_PackedStringArray>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+----------+-------+-----------+--------------------------+
|
||||
| Offset | Len | Type | Description |
|
||||
@@ -432,8 +458,8 @@ For each String:
|
||||
|
||||
Every string is padded to 4 bytes.
|
||||
|
||||
24: :ref:`PoolVector2Array<class_poolvector2array>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
26: :ref:`PackedVector2Array<class_PackedVector2Array>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+-------------------+-------+-----------+----------------+
|
||||
| Offset | Len | Type | Description |
|
||||
@@ -445,8 +471,8 @@ Every string is padded to 4 bytes.
|
||||
| 8..12+length\*8 | 4 | Float | Y Coordinate |
|
||||
+-------------------+-------+-----------+----------------+
|
||||
|
||||
25: :ref:`PoolVector3Array<class_poolvector3array>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
27: :ref:`PackedVector3Array<class_PackedVector3Array>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+--------------------+-------+-----------+----------------+
|
||||
| Offset | Len | Type | Description |
|
||||
@@ -460,8 +486,8 @@ Every string is padded to 4 bytes.
|
||||
| 8..16+length\*12 | 4 | Float | Z Coordinate |
|
||||
+--------------------+-------+-----------+----------------+
|
||||
|
||||
26: :ref:`PoolColorArray<class_poolcolorarray>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
28: :ref:`PackedColorArray<class_PackedColorArray>`
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
+--------------------+-------+-----------+----------------+
|
||||
| Offset | Len | Type | Description |
|
||||
|
||||
@@ -81,7 +81,7 @@ It will connect and fetch a website.
|
||||
|
||||
# This method works for both anyway
|
||||
|
||||
var rb = PoolByteArray() # Array that will hold the data.
|
||||
var rb = PackedByteArray() # Array that will hold the data.
|
||||
|
||||
while http.get_status() == HTTPClient.STATUS_BODY:
|
||||
# While there is body left to be read
|
||||
|
||||
@@ -89,12 +89,12 @@ or all the handle related ones.
|
||||
|
||||
var spatial = gizmo.get_spatial_node()
|
||||
|
||||
var lines = PoolVector3Array()
|
||||
var lines = PackedVector3Array()
|
||||
|
||||
lines.push_back(Vector3(0, 1, 0))
|
||||
lines.push_back(Vector3(0, spatial.my_custom_value, 0))
|
||||
|
||||
var handles = PoolVector3Array()
|
||||
var handles = PackedVector3Array()
|
||||
|
||||
handles.push_back(Vector3(0, 1, 0))
|
||||
handles.push_back(Vector3(0, spatial.my_custom_value, 0))
|
||||
@@ -129,12 +129,12 @@ So the final plugin would look somewhat like this:
|
||||
|
||||
var spatial = gizmo.get_spatial_node()
|
||||
|
||||
var lines = PoolVector3Array()
|
||||
var lines = PackedVector3Array()
|
||||
|
||||
lines.push_back(Vector3(0, 1, 0))
|
||||
lines.push_back(Vector3(0, spatial.my_custom_value, 0))
|
||||
|
||||
var handles = PoolVector3Array()
|
||||
var handles = PackedVector3Array()
|
||||
|
||||
handles.push_back(Vector3(0, 1, 0))
|
||||
handles.push_back(Vector3(0, spatial.my_custom_value, 0))
|
||||
@@ -195,12 +195,12 @@ This way all the gizmo logic and drawing methods can be implemented in a new cla
|
||||
|
||||
var spatial = get_spatial_node()
|
||||
|
||||
var lines = PoolVector3Array()
|
||||
var lines = PackedVector3Array()
|
||||
|
||||
lines.push_back(Vector3(0, 1, 0))
|
||||
lines.push_back(Vector3(gizmo_size, spatial.my_custom_value, 0))
|
||||
|
||||
var handles = PoolVector3Array()
|
||||
var handles = PackedVector3Array()
|
||||
|
||||
handles.push_back(Vector3(0, 1, 0))
|
||||
handles.push_back(Vector3(gizmo_size, spatial.my_custom_value, 0))
|
||||
|
||||
@@ -162,7 +162,7 @@ Now, attach a script to the MeshInstance and use the following code:
|
||||
|
||||
func _ready():
|
||||
# Create a single triangle out of vertices:
|
||||
var verts = PoolVector3Array()
|
||||
var verts = PackedVector3Array()
|
||||
verts.append(Vector3(-1.0, -1.0, 0.0))
|
||||
verts.append(Vector3(-1.0, 3.0, 0.0))
|
||||
verts.append(Vector3(3.0, -1.0, 0.0))
|
||||
|
||||
Reference in New Issue
Block a user