Debian Codegraph @

doc/classes/PackedByteArray.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="PackedByteArray" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A packed array of bytes.
5 </brief_description>
6 <description>
7 An array specifically designed to hold bytes. Packs data tightly, so it saves memory for large array sizes.
8 [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.
9 [b]Note:[/b] Packed arrays are always passed by reference. To get a copy of an array that can be modified independently of the original array, use [method duplicate]. This is [i]not[/i] the case for built-in properties and methods. In these cases the returned packed array is a copy, and changing it will [i]not[/i] affect the original value. To update a built-in property of this type, modify the returned array and then assign it to the property again.
10 </description>
11 <tutorials>
12 </tutorials>
13 <constructors>
14 <constructor name="PackedByteArray">
15 <return type="PackedByteArray" />
16 <description>
17 Constructs an empty [PackedByteArray].
18 </description>
19 </constructor>
20 <constructor name="PackedByteArray">
21 <return type="PackedByteArray" />
22 <param index="0" name="from" type="PackedByteArray" />
23 <description>
24 Constructs a [PackedByteArray] as a copy of the given [PackedByteArray].
25 </description>
26 </constructor>
27 <constructor name="PackedByteArray">
28 <return type="PackedByteArray" />
29 <param index="0" name="from" type="Array" />
30 <description>
31 Constructs a new [PackedByteArray]. Optionally, you can pass in a generic [Array] that will be converted.
32 </description>
33 </constructor>
34 </constructors>
35 <methods>
36 <method name="append">
37 <return type="bool" />
38 <param index="0" name="value" type="int" />
39 <description>
40 Appends an element at the end of the array (alias of [method push_back]).
41 </description>
42 </method>
43 <method name="append_array">
44 <return type="void" />
45 <param index="0" name="array" type="PackedByteArray" />
46 <description>
47 Appends a [PackedByteArray] at the end of this array.
48 </description>
49 </method>
50 <method name="bsearch" qualifiers="const">
51 <return type="int" />
52 <param index="0" name="value" type="int" />
53 <param index="1" name="before" type="bool" default="true" />
54 <description>
55 Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search. Optionally, a [param before] specifier can be passed. If [code]false[/code], the returned index comes after all existing entries of the value in the array.
56 [b]Note:[/b] Calling [method bsearch] on an unsorted array results in unexpected behavior.
57 </description>
58 </method>
59 <method name="bswap16">
60 <return type="void" />
61 <param index="0" name="offset" type="int" default="0" />
62 <param index="1" name="count" type="int" default="-1" />
63 <description>
64 Swaps the byte order of [param count] 16-bit segments of the array starting at [param offset]. Swap is done in-place. If [param count] is less than zero, all segments to the end of array are processed, if processed data size is not a multiple of 2, the byte after the last processed 16-bit segment is not modified.
65 </description>
66 </method>
67 <method name="bswap32">
68 <return type="void" />
69 <param index="0" name="offset" type="int" default="0" />
70 <param index="1" name="count" type="int" default="-1" />
71 <description>
72 Swaps the byte order of [param count] 32-bit segments of the array starting at [param offset]. Swap is done in-place. If [param count] is less than zero, all segments to the end of array are processed, if processed data size is not a multiple of 4, bytes after the last processed 32-bit segment are not modified.
73 </description>
74 </method>
75 <method name="bswap64">
76 <return type="void" />
77 <param index="0" name="offset" type="int" default="0" />
78 <param index="1" name="count" type="int" default="-1" />
79 <description>
80 Swaps the byte order of [param count] 64-bit segments of the array starting at [param offset]. Swap is done in-place. If [param count] is less than zero, all segments to the end of array are processed, if processed data size is not a multiple of 8, bytes after the last processed 64-bit segment are not modified.
81 </description>
82 </method>
83 <method name="clear">
84 <return type="void" />
85 <description>
86 Clears the array. This is equivalent to using [method resize] with a size of [code]0[/code].
87 </description>
88 </method>
89 <method name="compress" qualifiers="const">
90 <return type="PackedByteArray" />
91 <param index="0" name="compression_mode" type="int" default="0" />
92 <description>
93 Returns a new [PackedByteArray] with the data compressed. Set the compression mode using one of [enum FileAccess.CompressionMode]'s constants.
94 </description>
95 </method>
96 <method name="count" qualifiers="const">
97 <return type="int" />
98 <param index="0" name="value" type="int" />
99 <description>
100 Returns the number of times an element is in the array.
101 </description>
102 </method>
103 <method name="decode_double" qualifiers="const">
104 <return type="float" />
105 <param index="0" name="byte_offset" type="int" />
106 <description>
107 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.
108 </description>
109 </method>
110 <method name="decode_float" qualifiers="const">
111 <return type="float" />
112 <param index="0" name="byte_offset" type="int" />
113 <description>
114 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.
115 </description>
116 </method>
117 <method name="decode_half" qualifiers="const">
118 <return type="float" />
119 <param index="0" name="byte_offset" type="int" />
120 <description>
121 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.
122 </description>
123 </method>
124 <method name="decode_s8" qualifiers="const">
125 <return type="int" />
126 <param index="0" name="byte_offset" type="int" />
127 <description>
128 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.
129 </description>
130 </method>
131 <method name="decode_s16" qualifiers="const">
132 <return type="int" />
133 <param index="0" name="byte_offset" type="int" />
134 <description>
135 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.
136 </description>
137 </method>
138 <method name="decode_s32" qualifiers="const">
139 <return type="int" />
140 <param index="0" name="byte_offset" type="int" />
141 <description>
142 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.
143 </description>
144 </method>
145 <method name="decode_s64" qualifiers="const">
146 <return type="int" />
147 <param index="0" name="byte_offset" type="int" />
148 <description>
149 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.
150 </description>
151 </method>
152 <method name="decode_u8" qualifiers="const">
153 <return type="int" />
154 <param index="0" name="byte_offset" type="int" />
155 <description>
156 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.
157 </description>
158 </method>
159 <method name="decode_u16" qualifiers="const">
160 <return type="int" />
161 <param index="0" name="byte_offset" type="int" />
162 <description>
163 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.
164 </description>
165 </method>
166 <method name="decode_u32" qualifiers="const">
167 <return type="int" />
168 <param index="0" name="byte_offset" type="int" />
169 <description>
170 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.
171 </description>
172 </method>
173 <method name="decode_u64" qualifiers="const">
174 <return type="int" />
175 <param index="0" name="byte_offset" type="int" />
176 <description>
177 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.
178 </description>
179 </method>
180 <method name="decode_var" qualifiers="const">
181 <return type="Variant" />
182 <param index="0" name="byte_offset" type="int" />
183 <param index="1" name="allow_objects" type="bool" default="false" />
184 <description>
185 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].
186 </description>
187 </method>
188 <method name="decode_var_size" qualifiers="const">
189 <return type="int" />
190 <param index="0" name="byte_offset" type="int" />
191 <param index="1" name="allow_objects" type="bool" default="false" />
192 <description>
193 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.
194 </description>
195 </method>
196 <method name="decompress" qualifiers="const">
197 <return type="PackedByteArray" />
198 <param index="0" name="buffer_size" type="int" />
199 <param index="1" name="compression_mode" type="int" default="0" />
200 <description>
201 Returns a new [PackedByteArray] with the data decompressed. Set [param buffer_size] to the size of the uncompressed data. Set the compression mode using one of [enum FileAccess.CompressionMode]'s constants.
202 [b]Note:[/b] Decompression is not guaranteed to work with data not compressed by Godot, for example if data compressed with the deflate compression mode lacks a checksum or header.
203 </description>
204 </method>
205 <method name="decompress_dynamic" qualifiers="const">
206 <return type="PackedByteArray" />
207 <param index="0" name="max_output_size" type="int" />
208 <param index="1" name="compression_mode" type="int" default="0" />
209 <description>
210 Returns a new [PackedByteArray] with the data decompressed. Set the compression mode using one of [enum FileAccess.CompressionMode]'s constants. [b]This method only accepts brotli, gzip, and deflate compression modes.[/b]
211 This method is potentially slower than [method decompress], as it may have to re-allocate its output buffer multiple times while decompressing, whereas [method decompress] knows it's output buffer size from the beginning.
212 GZIP has a maximal compression ratio of 1032:1, meaning it's very possible for a small compressed payload to decompress to a potentially very large output. To guard against this, you may provide a maximum size this function is allowed to allocate in bytes via [param max_output_size]. Passing -1 will allow for unbounded output. If any positive value is passed, and the decompression exceeds that amount in bytes, then an error will be returned.
213 [b]Note:[/b] Decompression is not guaranteed to work with data not compressed by Godot, for example if data compressed with the deflate compression mode lacks a checksum or header.
214 </description>
215 </method>
216 <method name="duplicate" qualifiers="const">
217 <return type="PackedByteArray" />
218 <description>
219 Creates a copy of the array, and returns it.
220 </description>
221 </method>
222 <method name="encode_double">
223 <return type="void" />
224 <param index="0" name="byte_offset" type="int" />
225 <param index="1" name="value" type="float" />
226 <description>
227 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.
228 </description>
229 </method>
230 <method name="encode_float">
231 <return type="void" />
232 <param index="0" name="byte_offset" type="int" />
233 <param index="1" name="value" type="float" />
234 <description>
235 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.
236 </description>
237 </method>
238 <method name="encode_half">
239 <return type="void" />
240 <param index="0" name="byte_offset" type="int" />
241 <param index="1" name="value" type="float" />
242 <description>
243 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.
244 </description>
245 </method>
246 <method name="encode_s8">
247 <return type="void" />
248 <param index="0" name="byte_offset" type="int" />
249 <param index="1" name="value" type="int" />
250 <description>
251 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.
252 </description>
253 </method>
254 <method name="encode_s16">
255 <return type="void" />
256 <param index="0" name="byte_offset" type="int" />
257 <param index="1" name="value" type="int" />
258 <description>
259 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.
260 </description>
261 </method>
262 <method name="encode_s32">
263 <return type="void" />
264 <param index="0" name="byte_offset" type="int" />
265 <param index="1" name="value" type="int" />
266 <description>
267 Encodes a 32-bit signed 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.
268 </description>
269 </method>
270 <method name="encode_s64">
271 <return type="void" />
272 <param index="0" name="byte_offset" type="int" />
273 <param index="1" name="value" type="int" />
274 <description>
275 Encodes a 64-bit signed 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.
276 </description>
277 </method>
278 <method name="encode_u8">
279 <return type="void" />
280 <param index="0" name="byte_offset" type="int" />
281 <param index="1" name="value" type="int" />
282 <description>
283 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.
284 </description>
285 </method>
286 <method name="encode_u16">
287 <return type="void" />
288 <param index="0" name="byte_offset" type="int" />
289 <param index="1" name="value" type="int" />
290 <description>
291 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.
292 </description>
293 </method>
294 <method name="encode_u32">
295 <return type="void" />
296 <param index="0" name="byte_offset" type="int" />
297 <param index="1" name="value" type="int" />
298 <description>
299 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.
300 </description>
301 </method>
302 <method name="encode_u64">
303 <return type="void" />
304 <param index="0" name="byte_offset" type="int" />
305 <param index="1" name="value" type="int" />
306 <description>
307 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.
308 </description>
309 </method>
310 <method name="encode_var">
311 <return type="int" />
312 <param index="0" name="byte_offset" type="int" />
313 <param index="1" name="value" type="Variant" />
314 <param index="2" name="allow_objects" type="bool" default="false" />
315 <description>
316 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.
317 </description>
318 </method>
319 <method name="erase">
320 <return type="bool" />
321 <param index="0" name="value" type="int" />
322 <description>
323 Removes the first occurrence of a value from the array and returns [code]true[/code]. If the value does not exist in the array, nothing happens and [code]false[/code] is returned. To remove an element by index, use [method remove_at] instead.
324 </description>
325 </method>
326 <method name="fill">
327 <return type="void" />
328 <param index="0" name="value" type="int" />
329 <description>
330 Assigns the given value to all elements in the array. This can typically be used together with [method resize] to create an array with a given size and initialized elements.
331 </description>
332 </method>
333 <method name="find" qualifiers="const">
334 <return type="int" />
335 <param index="0" name="value" type="int" />
336 <param index="1" name="from" type="int" default="0" />
337 <description>
338 Searches the array for a value and returns its index or [code]-1[/code] if not found. Optionally, the initial search index can be passed.
339 </description>
340 </method>
341 <method name="get" qualifiers="const">
342 <return type="int" />
343 <param index="0" name="index" type="int" />
344 <description>
345 Returns the byte at the given [param index] in the array. If [param index] is out-of-bounds or negative, this method fails and returns [code]0[/code].
346 This method is similar (but not identical) to the [code][][/code] operator. Most notably, when this method fails, it doesn't pause project execution if run from the editor.
347 </description>
348 </method>
349 <method name="get_string_from_ascii" qualifiers="const">
350 <return type="String" />
351 <description>
352 Converts ASCII/Latin-1 encoded array to [String]. Fast alternative to [method get_string_from_utf8] if the content is ASCII/Latin-1 only. Unlike the UTF-8 function this function maps every byte to a character in the array. Multibyte sequences will not be interpreted correctly. For parsing user input always use [method get_string_from_utf8]. This is the inverse of [method String.to_ascii_buffer].
353 </description>
354 </method>
355 <method name="get_string_from_multibyte_char" qualifiers="const">
356 <return type="String" />
357 <param index="0" name="encoding" type="String" default="&quot;&quot;" />
358 <description>
359 Converts system multibyte code page encoded array to [String]. If conversion fails, empty string is returned. This is the inverse of [method String.to_multibyte_char_buffer].
360 The values permitted for [param encoding] are system dependent. If [param encoding] is empty string, system default encoding is used.
361 - For Windows, see [url=https://learn.microsoft.com/en-us/windows/win32/Intl/code-page-identifiers]Code Page Identifiers[/url] .NET names.
362 - For macOS and Linux/BSD, see [code]libiconv[/code] library documentation and [code]iconv --list[/code] for a list of supported encodings.
363 </description>
364 </method>
365 <method name="get_string_from_utf8" qualifiers="const">
366 <return type="String" />
367 <description>
368 Converts UTF-8 encoded array to [String]. Slower than [method get_string_from_ascii] but supports UTF-8 encoded data. Use this function if you are unsure about the source of the data. For user input this function should always be preferred. Returns empty string if source array is not valid UTF-8 string. This is the inverse of [method String.to_utf8_buffer].
369 </description>
370 </method>
371 <method name="get_string_from_utf16" qualifiers="const">
372 <return type="String" />
373 <description>
374 Converts UTF-16 encoded array to [String]. If the BOM is missing, little-endianness is assumed. Returns empty string if source array is not valid UTF-16 string. This is the inverse of [method String.to_utf16_buffer].
375 </description>
376 </method>
377 <method name="get_string_from_utf32" qualifiers="const">
378 <return type="String" />
379 <description>
380 Converts UTF-32 encoded array to [String]. Returns empty string if source array is not valid UTF-32 string. This is the inverse of [method String.to_utf32_buffer].
381 </description>
382 </method>
383 <method name="get_string_from_wchar" qualifiers="const">
384 <return type="String" />
385 <description>
386 Converts wide character ([code]wchar_t[/code], UTF-16 on Windows, UTF-32 on other platforms) encoded array to [String]. Returns empty string if source array is not valid wide string. This is the inverse of [method String.to_wchar_buffer].
387 </description>
388 </method>
389 <method name="has" qualifiers="const">
390 <return type="bool" />
391 <param index="0" name="value" type="int" />
392 <description>
393 Returns [code]true[/code] if the array contains [param value].
394 </description>
395 </method>
396 <method name="has_encoded_var" qualifiers="const">
397 <return type="bool" />
398 <param index="0" name="byte_offset" type="int" />
399 <param index="1" name="allow_objects" type="bool" default="false" />
400 <description>
401 Returns [code]true[/code] if a valid [Variant] value can be decoded at the [param byte_offset]. Returns [code]false[/code] otherwise or when the value is [Object]-derived and [param allow_objects] is [code]false[/code].
402 </description>
403 </method>
404 <method name="hex_encode" qualifiers="const">
405 <return type="String" />
406 <description>
407 Returns a hexadecimal representation of this array as a [String].
408 [codeblocks]
409 [gdscript]
410 var array = PackedByteArray([11, 46, 255])
411 print(array.hex_encode()) # Prints "0b2eff"
412 [/gdscript]
413 [csharp]
414 byte[] array = [11, 46, 255];
415 GD.Print(array.HexEncode()); // Prints "0b2eff"
416 [/csharp]
417 [/codeblocks]
418 </description>
419 </method>
420 <method name="insert">
421 <return type="int" />
422 <param index="0" name="at_index" type="int" />
423 <param index="1" name="value" type="int" />
424 <description>
425 Inserts a new element at a given position in the array. The position must be valid, or at the end of the array ([code]idx == size()[/code]).
426 </description>
427 </method>
428 <method name="is_empty" qualifiers="const">
429 <return type="bool" />
430 <description>
431 Returns [code]true[/code] if the array is empty.
432 </description>
433 </method>
434 <method name="push_back">
435 <return type="bool" />
436 <param index="0" name="value" type="int" />
437 <description>
438 Appends an element at the end of the array.
439 </description>
440 </method>
441 <method name="remove_at">
442 <return type="void" />
443 <param index="0" name="index" type="int" />
444 <description>
445 Removes an element from the array by index.
446 </description>
447 </method>
448 <method name="resize">
449 <return type="int" />
450 <param index="0" name="new_size" type="int" />
451 <description>
452 Sets the size of the array. If the array is grown, reserves elements at the end of the array. If the array is shrunk, truncates the array to the new size. Calling [method resize] once and assigning the new values is faster than adding new elements one by one.
453 Returns [constant OK] on success, or one of the following [enum Error] constants if this method fails: [constant ERR_INVALID_PARAMETER] if the size is negative, or [constant ERR_OUT_OF_MEMORY] if allocations fail. Use [method size] to find the actual size of the array after resize.
454 </description>
455 </method>
456 <method name="reverse">
457 <return type="void" />
458 <description>
459 Reverses the order of the elements in the array.
460 </description>
461 </method>
462 <method name="rfind" qualifiers="const">
463 <return type="int" />
464 <param index="0" name="value" type="int" />
465 <param index="1" name="from" type="int" default="-1" />
466 <description>
467 Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array.
468 </description>
469 </method>
470 <method name="set">
471 <return type="void" />
472 <param index="0" name="index" type="int" />
473 <param index="1" name="value" type="int" />
474 <description>
475 Changes the byte at the given index.
476 </description>
477 </method>
478 <method name="size" qualifiers="const">
479 <return type="int" />
480 <description>
481 Returns the number of elements in the array.
482 </description>
483 </method>
484 <method name="slice" qualifiers="const">
485 <return type="PackedByteArray" />
486 <param index="0" name="begin" type="int" />
487 <param index="1" name="end" type="int" default="2147483647" />
488 <description>
489 Returns the slice of the [PackedByteArray], from [param begin] (inclusive) to [param end] (exclusive), as a new [PackedByteArray].
490 The absolute value of [param begin] and [param end] will be clamped to the array size, so the default value for [param end] makes it slice to the size of the array by default (i.e. [code]arr.slice(1)[/code] is a shorthand for [code]arr.slice(1, arr.size())[/code]).
491 If either [param begin] or [param end] are negative, they will be relative to the end of the array (i.e. [code]arr.slice(0, -2)[/code] is a shorthand for [code]arr.slice(0, arr.size() - 2)[/code]).
492 </description>
493 </method>
494 <method name="sort">
495 <return type="void" />
496 <description>
497 Sorts the elements of the array in ascending order.
498 </description>
499 </method>
500 <method name="to_color_array" qualifiers="const">
501 <return type="PackedColorArray" />
502 <description>
503 Returns a copy of the data converted to a [PackedColorArray], where each block of 16 bytes has been converted to a [Color] variant.
504 [b]Note:[/b] The size of the input array must be a multiple of 16 (size of four 32-bit float variables). The size of the new array will be [code]byte_array.size() / 16[/code]. If the original data can't be converted to [Color] variants, the resulting data is undefined.
505 </description>
506 </method>
507 <method name="to_float32_array" qualifiers="const">
508 <return type="PackedFloat32Array" />
509 <description>
510 Returns a copy of the data converted to a [PackedFloat32Array], where each block of 4 bytes has been converted to a 32-bit float (C++ [code skip-lint]float[/code]).
511 The size of the input array must be a multiple of 4 (size of 32-bit float). The size of the new array will be [code]byte_array.size() / 4[/code].
512 If the original data can't be converted to 32-bit floats, the resulting data is undefined.
513 </description>
514 </method>
515 <method name="to_float64_array" qualifiers="const">
516 <return type="PackedFloat64Array" />
517 <description>
518 Returns a copy of the data converted to a [PackedFloat64Array], where each block of 8 bytes has been converted to a 64-bit float (C++ [code]double[/code], Godot [float]).
519 The size of the input array must be a multiple of 8 (size of 64-bit double). The size of the new array will be [code]byte_array.size() / 8[/code].
520 If the original data can't be converted to 64-bit floats, the resulting data is undefined.
521 </description>
522 </method>
523 <method name="to_int32_array" qualifiers="const">
524 <return type="PackedInt32Array" />
525 <description>
526 Returns a copy of the data converted to a [PackedInt32Array], where each block of 4 bytes has been converted to a signed 32-bit integer (C++ [code]int32_t[/code]).
527 The size of the input array must be a multiple of 4 (size of 32-bit integer). The size of the new array will be [code]byte_array.size() / 4[/code].
528 If the original data can't be converted to signed 32-bit integers, the resulting data is undefined.
529 </description>
530 </method>
531 <method name="to_int64_array" qualifiers="const">
532 <return type="PackedInt64Array" />
533 <description>
534 Returns a copy of the data converted to a [PackedInt64Array], where each block of 8 bytes has been converted to a signed 64-bit integer (C++ [code]int64_t[/code], Godot [int]).
535 The size of the input array must be a multiple of 8 (size of 64-bit integer). The size of the new array will be [code]byte_array.size() / 8[/code].
536 If the original data can't be converted to signed 64-bit integers, the resulting data is undefined.
537 </description>
538 </method>
539 <method name="to_vector2_array" qualifiers="const">
540 <return type="PackedVector2Array" />
541 <description>
542 Returns a copy of the data converted to a [PackedVector2Array], where each block of 8 bytes or 16 bytes (32-bit or 64-bit) has been converted to a [Vector2] variant.
543 [b]Note:[/b] The size of the input array must be a multiple of 8 or 16 (depending on the build settings, see [Vector2] for more details). The size of the new array will be [code]byte_array.size() / (8 or 16)[/code]. If the original data can't be converted to [Vector2] variants, the resulting data is undefined.
544 </description>
545 </method>
546 <method name="to_vector3_array" qualifiers="const">
547 <return type="PackedVector3Array" />
548 <description>
549 Returns a copy of the data converted to a [PackedVector3Array], where each block of 12 or 24 bytes (32-bit or 64-bit) has been converted to a [Vector3] variant.
550 [b]Note:[/b] The size of the input array must be a multiple of 12 or 24 (depending on the build settings, see [Vector3] for more details). The size of the new array will be [code]byte_array.size() / (12 or 24)[/code]. If the original data can't be converted to [Vector3] variants, the resulting data is undefined.
551 </description>
552 </method>
553 <method name="to_vector4_array" qualifiers="const">
554 <return type="PackedVector4Array" />
555 <description>
556 Returns a copy of the data converted to a [PackedVector4Array], where each block of 16 or 32 bytes (32-bit or 64-bit) has been converted to a [Vector4] variant.
557 [b]Note:[/b] The size of the input array must be a multiple of 16 or 32 (depending on the build settings, see [Vector4] for more details). The size of the new array will be [code]byte_array.size() / (16 or 32)[/code]. If the original data can't be converted to [Vector4] variants, the resulting data is undefined.
558 </description>
559 </method>
560 </methods>
561 <operators>
562 <operator name="operator !=">
563 <return type="bool" />
564 <param index="0" name="right" type="PackedByteArray" />
565 <description>
566 Returns [code]true[/code] if contents of the arrays differ.
567 </description>
568 </operator>
569 <operator name="operator +">
570 <return type="PackedByteArray" />
571 <param index="0" name="right" type="PackedByteArray" />
572 <description>
573 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.
574 </description>
575 </operator>
576 <operator name="operator ==">
577 <return type="bool" />
578 <param index="0" name="right" type="PackedByteArray" />
579 <description>
580 Returns [code]true[/code] if contents of both arrays are the same, i.e. they have all equal bytes at the corresponding indices.
581 </description>
582 </operator>
583 <operator name="operator []">
584 <return type="int" />
585 <param index="0" name="index" type="int" />
586 <description>
587 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.
588 Note that the byte is returned as a 64-bit [int].
589 </description>
590 </operator>
591 </operators>
592 </class>