From b099a8570cf42e9108f914a11e8e1f63c5ce8729 Mon Sep 17 00:00:00 2001 From: kobewi Date: Wed, 17 Aug 2022 00:18:22 +0200 Subject: [PATCH] Complete documentation of packed arrays --- doc/classes/PackedByteArray.xml | 32 ++++++++++++++++++++++++++++++ doc/classes/PackedColorArray.xml | 5 +++++ doc/classes/PackedFloat32Array.xml | 7 ++++++- doc/classes/PackedFloat64Array.xml | 6 +++++- doc/classes/PackedInt32Array.xml | 5 +++++ doc/classes/PackedInt64Array.xml | 4 ++++ doc/classes/PackedStringArray.xml | 5 +++++ doc/classes/PackedVector2Array.xml | 6 ++++++ doc/classes/PackedVector3Array.xml | 6 ++++++ 9 files changed, 74 insertions(+), 2 deletions(-) diff --git a/doc/classes/PackedByteArray.xml b/doc/classes/PackedByteArray.xml index b02333667d1..efb559522a9 100644 --- a/doc/classes/PackedByteArray.xml +++ b/doc/classes/PackedByteArray.xml @@ -5,6 +5,7 @@ An array specifically designed to hold bytes. Packs data tightly, so it saves memory for large array sizes. + [PackedByteArray] also provides methods to encode/decode various types to/from bytes. The way values are encoded is an implementation detail and shouldn't be relied upon when interacting with external apps. @@ -78,66 +79,77 @@ + Decodes a 64-bit floating point number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0.0[/code] if a valid number can't be decoded. + Decodes a 32-bit floating point number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0.0[/code] if a valid number can't be decoded. + Decodes a 16-bit floating point number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0.0[/code] if a valid number can't be decoded. + Decodes a 16-bit signed integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded. + Decodes a 32-bit signed integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded. + Decodes a 64-bit signed integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded. + Decodes a 8-bit signed integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded. + Decodes a 16-bit unsigned integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded. + Decodes a 32-bit unsigned integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded. + Decodes a 64-bit unsigned integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded. + Decodes a 8-bit unsigned integer number from the bytes starting at [param byte_offset]. Fails if the byte count is insufficient. Returns [code]0[/code] if a valid number can't be decoded. @@ -145,6 +157,7 @@ + Decodes a [Variant] from the bytes starting at [param byte_offset]. Returns [code]null[/code] if a valid variant can't be decoded or the value is [Object]-derived and [param allow_objects] is [code]false[/code]. @@ -152,6 +165,7 @@ + Decodes a size of a [Variant] from the bytes starting at [param byte_offset]. Requires at least 4 bytes of data starting at the offset, otherwise fails. @@ -183,6 +197,7 @@ + Encodes a 64-bit floating point number as bytes at the index of [param byte_offset] bytes. The array must have at least 8 bytes of allocated space, starting at the offset. @@ -190,6 +205,7 @@ + Encodes a 32-bit floating point number as bytes at the index of [param byte_offset] bytes. The array must have at least 4 bytes of space, starting at the offset. @@ -197,6 +213,7 @@ + Encodes a 16-bit floating point number as bytes at the index of [param byte_offset] bytes. The array must have at least 2 bytes of space, starting at the offset. @@ -204,6 +221,7 @@ + Encodes a 16-bit signed integer number as bytes at the index of [param byte_offset] bytes. The array must have at least 2 bytes of space, starting at the offset. @@ -211,6 +229,7 @@ + Encodes a 32-bit signed integer number as bytes at the index of [param byte_offset] bytes. The array must have at least 2 bytes of space, starting at the offset. @@ -218,6 +237,7 @@ + Encodes a 64-bit signed integer number as bytes at the index of [param byte_offset] bytes. The array must have at least 2 bytes of space, starting at the offset. @@ -225,6 +245,7 @@ + Encodes a 8-bit signed integer number (signed byte) at the index of [param byte_offset] bytes. The array must have at least 1 byte of space, starting at the offset. @@ -232,6 +253,7 @@ + Encodes a 16-bit unsigned integer number as bytes at the index of [param byte_offset] bytes. The array must have at least 2 bytes of space, starting at the offset. @@ -239,6 +261,7 @@ + Encodes a 32-bit unsigned integer number as bytes at the index of [param byte_offset] bytes. The array must have at least 4 bytes of space, starting at the offset. @@ -246,6 +269,7 @@ + Encodes a 64-bit unsigned integer number as bytes at the index of [param byte_offset] bytes. The array must have at least 8 bytes of space, starting at the offset. @@ -253,6 +277,7 @@ + Encodes a 8-bit unsigned integer number (byte) at the index of [param byte_offset] bytes. The array must have at least 1 byte of space, starting at the offset. @@ -261,6 +286,7 @@ + Encodes a [Variant] at the index of [param byte_offset] bytes. A sufficient space must be allocated, depending on the encoded variant's size. If [param allow_objects] is [code]false[/code], [Object]-derived values are not permitted and will instead be serialized as ID-only. @@ -314,6 +340,7 @@ + Returns [code]true[/code] if a valid [Variant] value can be decoded at the [param byte_offset]. Returns [code]false[/code] othewrise or when the value is [Object]-derived and [param allow_objects] is [code]false[/code]. @@ -449,24 +476,29 @@ + Returns [code]true[/code] if contents of the arrays differ. + Returns a new [PackedByteArray] with contents of [param right] added at the end of this array. For better performance, consider using [method append_array] instead. + Returns [code]true[/code] if contents of both arrays are the same, i.e. they have all equal bytes at the corresponding indices. + Returns the byte at index [param index]. Negative indices can be used to access the elements starting from the end. Using index out of array's bounds will result in an error. + Note that the byte is returned as a 64-bit [int]. diff --git a/doc/classes/PackedColorArray.xml b/doc/classes/PackedColorArray.xml index c6949271752..a2dc8e8f1dc 100644 --- a/doc/classes/PackedColorArray.xml +++ b/doc/classes/PackedColorArray.xml @@ -177,6 +177,7 @@ + Returns a [PackedByteArray] with each color encoded as bytes. @@ -185,24 +186,28 @@ + Returns [code]true[/code] if contents of the arrays differ. + Returns a new [PackedColorArray] with contents of [param right] added at the end of this array. For better performance, consider using [method append_array] instead. + Returns [code]true[/code] if contents of both arrays are the same, i.e. they have all equal [Color]s at the corresponding indices. + Returns the [Color] at index [param index]. Negative indices can be used to access the elements starting from the end. Using index out of array's bounds will result in an error. diff --git a/doc/classes/PackedFloat32Array.xml b/doc/classes/PackedFloat32Array.xml index 41d0679099e..d350d64f38e 100644 --- a/doc/classes/PackedFloat32Array.xml +++ b/doc/classes/PackedFloat32Array.xml @@ -4,7 +4,7 @@ A packed array of 32-bit floating-point values. - An array specifically designed to hold 32-bit floating-point values. Packs data tightly, so it saves memory for large array sizes. + An array specifically designed to hold 32-bit floating-point values (float). Packs data tightly, so it saves memory for large array sizes. If you need to pack 64-bit floats tightly, see [PackedFloat64Array]. @@ -188,24 +188,29 @@ + Returns [code]true[/code] if contents of the arrays differ. + Returns a new [PackedFloat32Array] with contents of [param right] added at the end of this array. For better performance, consider using [method append_array] instead. + Returns [code]true[/code] if contents of both arrays are the same, i.e. they have all equal floats at the corresponding indices. + Returns the [float] at index [param index]. Negative indices can be used to access the elements starting from the end. Using index out of array's bounds will result in an error. + Note that [float] type is 64-bit, unlike the values stored in the array. diff --git a/doc/classes/PackedFloat64Array.xml b/doc/classes/PackedFloat64Array.xml index bedbe3603cd..690cb15fa7b 100644 --- a/doc/classes/PackedFloat64Array.xml +++ b/doc/classes/PackedFloat64Array.xml @@ -4,7 +4,7 @@ A packed array of 64-bit floating-point values. - An array specifically designed to hold 64-bit floating-point values. Packs data tightly, so it saves memory for large array sizes. + An array specifically designed to hold 64-bit floating-point values (double). Packs data tightly, so it saves memory for large array sizes. If you only need to pack 32-bit floats tightly, see [PackedFloat32Array] for a more memory-friendly alternative. @@ -188,24 +188,28 @@ + Returns [code]true[/code] if contents of the arrays differ. + Returns a new [PackedFloat64Array] with contents of [param right] added at the end of this array. For better performance, consider using [method append_array] instead. + Returns [code]true[/code] if contents of both arrays are the same, i.e. they have all equal doubles at the corresponding indices. + Returns the [float] at index [param index]. Negative indices can be used to access the elements starting from the end. Using index out of array's bounds will result in an error. diff --git a/doc/classes/PackedInt32Array.xml b/doc/classes/PackedInt32Array.xml index db4c8c09371..2f9032e2145 100644 --- a/doc/classes/PackedInt32Array.xml +++ b/doc/classes/PackedInt32Array.xml @@ -188,24 +188,29 @@ + Returns [code]true[/code] if contents of the arrays differ. + Returns a new [PackedInt32Array] with contents of [param right] added at the end of this array. For better performance, consider using [method append_array] instead. + Returns [code]true[/code] if contents of both arrays are the same, i.e. they have all equal ints at the corresponding indices. + Returns the [int] at index [param index]. Negative indices can be used to access the elements starting from the end. Using index out of array's bounds will result in an error. + Note that [int] type is 64-bit, unlike the values stored in the array. diff --git a/doc/classes/PackedInt64Array.xml b/doc/classes/PackedInt64Array.xml index 56d72692a27..5f762cde3e5 100644 --- a/doc/classes/PackedInt64Array.xml +++ b/doc/classes/PackedInt64Array.xml @@ -188,24 +188,28 @@ + Returns [code]true[/code] if contents of the arrays differ. + Returns a new [PackedInt64Array] with contents of [param right] added at the end of this array. For better performance, consider using [method append_array] instead. + Returns [code]true[/code] if contents of both arrays are the same, i.e. they have all equal ints at the corresponding indices. + Returns the [int] at index [param index]. Negative indices can be used to access the elements starting from the end. Using index out of array's bounds will result in an error. diff --git a/doc/classes/PackedStringArray.xml b/doc/classes/PackedStringArray.xml index b58a3b2553b..2c3376d6595 100644 --- a/doc/classes/PackedStringArray.xml +++ b/doc/classes/PackedStringArray.xml @@ -184,6 +184,7 @@ + Returns a [PackedByteArray] with each string encoded as bytes. @@ -192,24 +193,28 @@ + Returns [code]true[/code] if contents of the arrays differ. + Returns a new [PackedStringArray] with contents of [param right] added at the end of this array. For better performance, consider using [method append_array] instead. + Returns [code]true[/code] if contents of both arrays are the same, i.e. they have all equal [String]s at the corresponding indices. + Returns the [String] at index [param index]. Negative indices can be used to access the elements starting from the end. Using index out of array's bounds will result in an error. diff --git a/doc/classes/PackedVector2Array.xml b/doc/classes/PackedVector2Array.xml index 7cf63d3d5e8..25650ef40ad 100644 --- a/doc/classes/PackedVector2Array.xml +++ b/doc/classes/PackedVector2Array.xml @@ -178,6 +178,7 @@ + Returns a [PackedByteArray] with each vector encoded as bytes. @@ -186,30 +187,35 @@ + Returns [code]true[/code] if contents of the arrays differ. + Transforms (multiplies) all vectors in the array by the [Transform2D] matrix. + Returns a new [PackedVector2Array] with contents of [param right] added at the end of this array. For better performance, consider using [method append_array] instead. + Returns [code]true[/code] if contents of both arrays are the same, i.e. they have all equal [Vector2]s at the corresponding indices. + Returns the [Vector2] at index [param index]. Negative indices can be used to access the elements starting from the end. Using index out of array's bounds will result in an error. diff --git a/doc/classes/PackedVector3Array.xml b/doc/classes/PackedVector3Array.xml index 5ab42474f08..22979a5a37d 100644 --- a/doc/classes/PackedVector3Array.xml +++ b/doc/classes/PackedVector3Array.xml @@ -177,6 +177,7 @@ + Returns a [PackedByteArray] with each vector encoded as bytes. @@ -185,30 +186,35 @@ + Returns [code]true[/code] if contents of the arrays differ. + Transforms (multiplies) all vectors in the array by the [Transform3D] matrix. + Returns a new [PackedVector3Array] with contents of [param right] added at the end of this array. For better performance, consider using [method append_array] instead. + Returns [code]true[/code] if contents of both arrays are the same, i.e. they have all equal [Vector3]s at the corresponding indices. + Returns the [Vector3] at index [param index]. Negative indices can be used to access the elements starting from the end. Using index out of array's bounds will result in an error.