binary_serialization_api.rst 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608
  1. :article_outdated: True
  2. .. _doc_binary_serialization_api:
  3. Binary serialization API
  4. ========================
  5. Introduction
  6. ------------
  7. Godot has a serialization API based on Variant. It's used for
  8. converting data types to an array of bytes efficiently. This API is exposed
  9. via the global :ref:`bytes_to_var() <class_@GlobalScope_method_bytes_to_var>`
  10. and :ref:`var_to_bytes() <class_@GlobalScope_method_var_to_bytes>` functions,
  11. but it is also used in the ``get_var`` and ``store_var`` methods of
  12. :ref:`class_FileAccess` as well as the packet APIs for :ref:`class_PacketPeer`.
  13. This format is *not* used for binary scenes and resources.
  14. Full Objects vs Object instance IDs
  15. -----------------------------------
  16. If a variable is serialized with ``full_objects = true``, then any Objects
  17. contained in the variable will be serialized and included in the result. This
  18. is recursive.
  19. If ``full_objects = false``, then only the instance IDs will be serialized for
  20. any Objects contained in the variable.
  21. Packet specification
  22. --------------------
  23. The packet is designed to be always padded to 4 bytes. All values are
  24. little-endian-encoded. All packets have a 4-byte header representing an
  25. integer, specifying the type of data.
  26. The lowest value two bytes are used to determine the type, while the highest value
  27. two bytes contain flags::
  28. base_type = val & 0xFFFF;
  29. flags = val >> 16;
  30. +--------+--------------------------+
  31. | Type | Value |
  32. +========+==========================+
  33. | 0 | null |
  34. +--------+--------------------------+
  35. | 1 | bool |
  36. +--------+--------------------------+
  37. | 2 | integer |
  38. +--------+--------------------------+
  39. | 3 | float |
  40. +--------+--------------------------+
  41. | 4 | string |
  42. +--------+--------------------------+
  43. | 5 | vector2 |
  44. +--------+--------------------------+
  45. | 6 | rect2 |
  46. +--------+--------------------------+
  47. | 7 | vector3 |
  48. +--------+--------------------------+
  49. | 8 | transform2d |
  50. +--------+--------------------------+
  51. | 9 | plane |
  52. +--------+--------------------------+
  53. | 10 | quaternion |
  54. +--------+--------------------------+
  55. | 11 | aabb |
  56. +--------+--------------------------+
  57. | 12 | basis |
  58. +--------+--------------------------+
  59. | 13 | transform3d |
  60. +--------+--------------------------+
  61. | 14 | color |
  62. +--------+--------------------------+
  63. | 15 | node path |
  64. +--------+--------------------------+
  65. | 16 | rid |
  66. +--------+--------------------------+
  67. | 17 | object |
  68. +--------+--------------------------+
  69. | 18 | dictionary |
  70. +--------+--------------------------+
  71. | 19 | array |
  72. +--------+--------------------------+
  73. | 20 | raw array |
  74. +--------+--------------------------+
  75. | 21 | int32 array |
  76. +--------+--------------------------+
  77. | 22 | int64 array |
  78. +--------+--------------------------+
  79. | 23 | float32 array |
  80. +--------+--------------------------+
  81. | 24 | float64 array |
  82. +--------+--------------------------+
  83. | 25 | string array |
  84. +--------+--------------------------+
  85. | 26 | vector2 array |
  86. +--------+--------------------------+
  87. | 27 | vector3 array |
  88. +--------+--------------------------+
  89. | 28 | color array |
  90. +--------+--------------------------+
  91. | 29 | max |
  92. +--------+--------------------------+
  93. Following this is the actual packet contents, which varies for each type of
  94. packet. Note that this assumes Godot is compiled with single-precision floats,
  95. which is the default. If Godot was compiled with double-precision floats, the
  96. length of "Float" fields within data structures should be 8, and the offset
  97. should be ``(offset - 4) * 2 + 4``. The "float" type itself always uses double
  98. precision.
  99. 0: null
  100. ^^^^^^^
  101. 1: :ref:`bool<class_bool>`
  102. ^^^^^^^^^^^^^^^^^^^^^^^^^^
  103. +----------+-------+-----------+---------------------------+
  104. | Offset | Len | Type | Description |
  105. +==========+=======+===========+===========================+
  106. | 4 | 4 | Integer | 0 for False, 1 for True |
  107. +----------+-------+-----------+---------------------------+
  108. 2: :ref:`int<class_int>`
  109. ^^^^^^^^^^^^^^^^^^^^^^^^
  110. If no flags are set (flags == 0), the integer is sent as a 32 bit integer:
  111. +----------+-------+-----------+--------------------------+
  112. | Offset | Len | Type | Description |
  113. +==========+=======+===========+==========================+
  114. | 4 | 4 | Integer | 32-bit signed integer |
  115. +----------+-------+-----------+--------------------------+
  116. If flag ``ENCODE_FLAG_64`` is set (``flags & 1 == 1``), the integer is sent as
  117. a 64-bit integer:
  118. +----------+-------+-----------+--------------------------+
  119. | Offset | Len | Type | Description |
  120. +==========+=======+===========+==========================+
  121. | 4 | 8 | Integer | 64-bit signed integer |
  122. +----------+-------+-----------+--------------------------+
  123. 3: :ref:`float<class_float>`
  124. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  125. If no flags are set (flags == 0), the float is sent as a 32 bit single precision:
  126. +----------+-------+---------+-----------------------------------+
  127. | Offset | Len | Type | Description |
  128. +==========+=======+=========+===================================+
  129. | 4 | 4 | Float | IEEE 754 single-precision float |
  130. +----------+-------+---------+-----------------------------------+
  131. If flag ``ENCODE_FLAG_64`` is set (``flags & 1 == 1``), the float is sent as
  132. a 64-bit double precision number:
  133. +----------+-------+---------+-----------------------------------+
  134. | Offset | Len | Type | Description |
  135. +==========+=======+=========+===================================+
  136. | 4 | 8 | Float | IEEE 754 double-precision float |
  137. +----------+-------+---------+-----------------------------------+
  138. 4: :ref:`String<class_string>`
  139. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  140. +----------+-------+-----------+----------------------------+
  141. | Offset | Len | Type | Description |
  142. +==========+=======+===========+============================+
  143. | 4 | 4 | Integer | String length (in bytes) |
  144. +----------+-------+-----------+----------------------------+
  145. | 8 | X | Bytes | UTF-8 encoded string |
  146. +----------+-------+-----------+----------------------------+
  147. This field is padded to 4 bytes.
  148. 5: :ref:`Vector2<class_vector2>`
  149. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  150. +----------+-------+---------+----------------+
  151. | Offset | Len | Type | Description |
  152. +==========+=======+=========+================+
  153. | 4 | 4 | Float | X coordinate |
  154. +----------+-------+---------+----------------+
  155. | 8 | 4 | Float | Y coordinate |
  156. +----------+-------+---------+----------------+
  157. 6: :ref:`Rect2<class_rect2>`
  158. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  159. +----------+-------+---------+----------------+
  160. | Offset | Len | Type | Description |
  161. +==========+=======+=========+================+
  162. | 4 | 4 | Float | X coordinate |
  163. +----------+-------+---------+----------------+
  164. | 8 | 4 | Float | Y coordinate |
  165. +----------+-------+---------+----------------+
  166. | 12 | 4 | Float | X size |
  167. +----------+-------+---------+----------------+
  168. | 16 | 4 | Float | Y size |
  169. +----------+-------+---------+----------------+
  170. 7: :ref:`Vector3<class_vector3>`
  171. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  172. +----------+-------+---------+----------------+
  173. | Offset | Len | Type | Description |
  174. +==========+=======+=========+================+
  175. | 4 | 4 | Float | X coordinate |
  176. +----------+-------+---------+----------------+
  177. | 8 | 4 | Float | Y coordinate |
  178. +----------+-------+---------+----------------+
  179. | 12 | 4 | Float | Z coordinate |
  180. +----------+-------+---------+----------------+
  181. 8: :ref:`Transform2D<class_transform2d>`
  182. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  183. +----------+-------+---------+---------------------------------------------------------------+
  184. | Offset | Len | Type | Description |
  185. +==========+=======+=========+===============================================================+
  186. | 4 | 4 | Float | The X component of the X column vector, accessed via [0][0] |
  187. +----------+-------+---------+---------------------------------------------------------------+
  188. | 8 | 4 | Float | The Y component of the X column vector, accessed via [0][1] |
  189. +----------+-------+---------+---------------------------------------------------------------+
  190. | 12 | 4 | Float | The X component of the Y column vector, accessed via [1][0] |
  191. +----------+-------+---------+---------------------------------------------------------------+
  192. | 16 | 4 | Float | The Y component of the Y column vector, accessed via [1][1] |
  193. +----------+-------+---------+---------------------------------------------------------------+
  194. | 20 | 4 | Float | The X component of the origin vector, accessed via [2][0] |
  195. +----------+-------+---------+---------------------------------------------------------------+
  196. | 24 | 4 | Float | The Y component of the origin vector, accessed via [2][1] |
  197. +----------+-------+---------+---------------------------------------------------------------+
  198. 9: :ref:`Plane<class_plane>`
  199. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  200. +----------+-------+---------+---------------+
  201. | Offset | Len | Type | Description |
  202. +==========+=======+=========+===============+
  203. | 4 | 4 | Float | Normal X |
  204. +----------+-------+---------+---------------+
  205. | 8 | 4 | Float | Normal Y |
  206. +----------+-------+---------+---------------+
  207. | 12 | 4 | Float | Normal Z |
  208. +----------+-------+---------+---------------+
  209. | 16 | 4 | Float | Distance |
  210. +----------+-------+---------+---------------+
  211. 10: :ref:`Quaternion<class_quaternion>`
  212. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  213. +----------+-------+---------+---------------+
  214. | Offset | Len | Type | Description |
  215. +==========+=======+=========+===============+
  216. | 4 | 4 | Float | Imaginary X |
  217. +----------+-------+---------+---------------+
  218. | 8 | 4 | Float | Imaginary Y |
  219. +----------+-------+---------+---------------+
  220. | 12 | 4 | Float | Imaginary Z |
  221. +----------+-------+---------+---------------+
  222. | 16 | 4 | Float | Real W |
  223. +----------+-------+---------+---------------+
  224. 11: :ref:`AABB<class_aabb>`
  225. ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  226. +----------+-------+---------+----------------+
  227. | Offset | Len | Type | Description |
  228. +==========+=======+=========+================+
  229. | 4 | 4 | Float | X coordinate |
  230. +----------+-------+---------+----------------+
  231. | 8 | 4 | Float | Y coordinate |
  232. +----------+-------+---------+----------------+
  233. | 12 | 4 | Float | Z coordinate |
  234. +----------+-------+---------+----------------+
  235. | 16 | 4 | Float | X size |
  236. +----------+-------+---------+----------------+
  237. | 20 | 4 | Float | Y size |
  238. +----------+-------+---------+----------------+
  239. | 24 | 4 | Float | Z size |
  240. +----------+-------+---------+----------------+
  241. 12: :ref:`Basis<class_basis>`
  242. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  243. +----------+-------+---------+---------------------------------------------------------------+
  244. | Offset | Len | Type | Description |
  245. +==========+=======+=========+===============================================================+
  246. | 4 | 4 | Float | The X component of the X column vector, accessed via [0][0] |
  247. +----------+-------+---------+---------------------------------------------------------------+
  248. | 8 | 4 | Float | The Y component of the X column vector, accessed via [0][1] |
  249. +----------+-------+---------+---------------------------------------------------------------+
  250. | 12 | 4 | Float | The Z component of the X column vector, accessed via [0][2] |
  251. +----------+-------+---------+---------------------------------------------------------------+
  252. | 16 | 4 | Float | The X component of the Y column vector, accessed via [1][0] |
  253. +----------+-------+---------+---------------------------------------------------------------+
  254. | 20 | 4 | Float | The Y component of the Y column vector, accessed via [1][1] |
  255. +----------+-------+---------+---------------------------------------------------------------+
  256. | 24 | 4 | Float | The Z component of the Y column vector, accessed via [1][2] |
  257. +----------+-------+---------+---------------------------------------------------------------+
  258. | 28 | 4 | Float | The X component of the Z column vector, accessed via [2][0] |
  259. +----------+-------+---------+---------------------------------------------------------------+
  260. | 32 | 4 | Float | The Y component of the Z column vector, accessed via [2][1] |
  261. +----------+-------+---------+---------------------------------------------------------------+
  262. | 36 | 4 | Float | The Z component of the Z column vector, accessed via [2][2] |
  263. +----------+-------+---------+---------------------------------------------------------------+
  264. 13: :ref:`Transform3D<class_transform3d>`
  265. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  266. +----------+-------+---------+---------------------------------------------------------------+
  267. | Offset | Len | Type | Description |
  268. +==========+=======+=========+===============================================================+
  269. | 4 | 4 | Float | The X component of the X column vector, accessed via [0][0] |
  270. +----------+-------+---------+---------------------------------------------------------------+
  271. | 8 | 4 | Float | The Y component of the X column vector, accessed via [0][1] |
  272. +----------+-------+---------+---------------------------------------------------------------+
  273. | 12 | 4 | Float | The Z component of the X column vector, accessed via [0][2] |
  274. +----------+-------+---------+---------------------------------------------------------------+
  275. | 16 | 4 | Float | The X component of the Y column vector, accessed via [1][0] |
  276. +----------+-------+---------+---------------------------------------------------------------+
  277. | 20 | 4 | Float | The Y component of the Y column vector, accessed via [1][1] |
  278. +----------+-------+---------+---------------------------------------------------------------+
  279. | 24 | 4 | Float | The Z component of the Y column vector, accessed via [1][2] |
  280. +----------+-------+---------+---------------------------------------------------------------+
  281. | 28 | 4 | Float | The X component of the Z column vector, accessed via [2][0] |
  282. +----------+-------+---------+---------------------------------------------------------------+
  283. | 32 | 4 | Float | The Y component of the Z column vector, accessed via [2][1] |
  284. +----------+-------+---------+---------------------------------------------------------------+
  285. | 36 | 4 | Float | The Z component of the Z column vector, accessed via [2][2] |
  286. +----------+-------+---------+---------------------------------------------------------------+
  287. | 40 | 4 | Float | The X component of the origin vector, accessed via [3][0] |
  288. +----------+-------+---------+---------------------------------------------------------------+
  289. | 44 | 4 | Float | The Y component of the origin vector, accessed via [3][1] |
  290. +----------+-------+---------+---------------------------------------------------------------+
  291. | 48 | 4 | Float | The Z component of the origin vector, accessed via [3][2] |
  292. +----------+-------+---------+---------------------------------------------------------------+
  293. 14: :ref:`Color<class_color>`
  294. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  295. +----------+-------+---------+--------------------------------------------------------------+
  296. | Offset | Len | Type | Description |
  297. +==========+=======+=========+==============================================================+
  298. | 4 | 4 | Float | Red (typically 0..1, can be above 1 for overbright colors) |
  299. +----------+-------+---------+--------------------------------------------------------------+
  300. | 8 | 4 | Float | Green (typically 0..1, can be above 1 for overbright colors) |
  301. +----------+-------+---------+--------------------------------------------------------------+
  302. | 12 | 4 | Float | Blue (typically 0..1, can be above 1 for overbright colors) |
  303. +----------+-------+---------+--------------------------------------------------------------+
  304. | 16 | 4 | Float | Alpha (0..1) |
  305. +----------+-------+---------+--------------------------------------------------------------+
  306. 15: :ref:`NodePath<class_nodepath>`
  307. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  308. +----------+-------+-----------+-----------------------------------------------------------------------------------------+
  309. | Offset | Len | Type | Description |
  310. +==========+=======+===========+=========================================================================================+
  311. | 4 | 4 | Integer | String length, or new format (val&0x80000000!=0 and NameCount=val&0x7FFFFFFF) |
  312. +----------+-------+-----------+-----------------------------------------------------------------------------------------+
  313. For old format:
  314. ^^^^^^^^^^^^^^^
  315. +----------+-------+---------+------------------------+
  316. | Offset | Len | Type | Description |
  317. +==========+=======+=========+========================+
  318. | 8 | X | Bytes | UTF-8 encoded string |
  319. +----------+-------+---------+------------------------+
  320. Padded to 4 bytes.
  321. For new format:
  322. ^^^^^^^^^^^^^^^
  323. +----------+-------+-----------+-------------------------------------+
  324. | Offset | Len | Type | Description |
  325. +==========+=======+===========+=====================================+
  326. | 4 | 4 | Integer | Sub-name count |
  327. +----------+-------+-----------+-------------------------------------+
  328. | 8 | 4 | Integer | Flags (absolute: val&1 != 0 ) |
  329. +----------+-------+-----------+-------------------------------------+
  330. For each Name and Sub-Name
  331. +----------+-------+-----------+------------------------+
  332. | Offset | Len | Type | Description |
  333. +==========+=======+===========+========================+
  334. | X+0 | 4 | Integer | String length |
  335. +----------+-------+-----------+------------------------+
  336. | X+4 | X | Bytes | UTF-8 encoded string |
  337. +----------+-------+-----------+------------------------+
  338. Every name string is padded to 4 bytes.
  339. 16: :ref:`RID<class_rid>` (unsupported)
  340. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  341. 17: :ref:`Object<class_object>`
  342. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  343. An Object could be serialized in three different ways: as a null value, with
  344. ``full_objects = false``, or with ``full_objects = true``.
  345. A null value
  346. """"""""""""
  347. +----------+-------+------------+-------------------------------------------------+
  348. | Offset | Len | Type | Description |
  349. +==========+=======+============+=================================================+
  350. | 4 | 4 | Integer | Zero (32-bit signed integer) |
  351. +----------+-------+------------+-------------------------------------------------+
  352. ``full_objects`` disabled
  353. """""""""""""""""""""""""
  354. +----------+-------+------------+-------------------------------------------------+
  355. | Offset | Len | Type | Description |
  356. +==========+=======+============+=================================================+
  357. | 4 | 8 | Integer | The Object instance ID (64-bit signed integer) |
  358. +----------+-------+------------+-------------------------------------------------+
  359. ``full_objects`` enabled
  360. """"""""""""""""""""""""
  361. +----------+-------+----------------+----------------------------------------------------------+
  362. | Offset | Len | Type | Description |
  363. +==========+=======+================+==========================================================+
  364. | 4 | 4 | Integer | Class name (String length) |
  365. +----------+-------+----------------+----------------------------------------------------------+
  366. | 8 | X | Bytes | Class name (UTF-8 encoded string) |
  367. +----------+-------+----------------+----------------------------------------------------------+
  368. | X+8 | 4 | Integer | The number of properties that are serialized |
  369. +----------+-------+----------------+----------------------------------------------------------+
  370. For each property:
  371. +----------+-------+----------------+----------------------------------------------------------+
  372. | Offset | Len | Type | Description |
  373. +==========+=======+================+==========================================================+
  374. | Y | 4 | Integer | Property name (String length) |
  375. +----------+-------+----------------+----------------------------------------------------------+
  376. | Y+4 | Z | Bytes | Property name (UTF-8 encoded string) |
  377. +----------+-------+----------------+----------------------------------------------------------+
  378. | Y+4+Z | W | <variable> | Property value, using this same format |
  379. +----------+-------+----------------+----------------------------------------------------------+
  380. .. Note::
  381. Not all properties are included. Only properties that are configured with the
  382. :ref:`PROPERTY_USAGE_STORAGE<class_@GlobalScope_constant_PROPERTY_USAGE_STORAGE>`
  383. flag set will be serialized. You can add a new usage flag to a property by overriding the
  384. :ref:`_get_property_list<class_Object_method__get_property_list>`
  385. method in your class. You can also check how property usage is configured by
  386. calling ``Object._get_property_list`` See
  387. :ref:`PropertyUsageFlags<enum_@GlobalScope_PropertyUsageFlags>` for the
  388. possible usage flags.
  389. 18: :ref:`Dictionary<class_dictionary>`
  390. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  391. +----------+-------+-----------+---------------------------------------------------------------------+
  392. | Offset | Len | Type | Description |
  393. +==========+=======+===========+=====================================================================+
  394. | 4 | 4 | Integer | val&0x7FFFFFFF = elements, val&0x80000000 = shared (bool) |
  395. +----------+-------+-----------+---------------------------------------------------------------------+
  396. Then what follows is, for amount of "elements", pairs of key and value,
  397. one after the other, using this same format.
  398. 19: :ref:`Array<class_array>`
  399. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  400. +----------+-------+-----------+---------------------------------------------------------------------+
  401. | Offset | Len | Type | Description |
  402. +==========+=======+===========+=====================================================================+
  403. | 4 | 4 | Integer | val&0x7FFFFFFF = elements, val&0x80000000 = shared (bool) |
  404. +----------+-------+-----------+---------------------------------------------------------------------+
  405. Then what follows is, for amount of "elements", values one after the
  406. other, using this same format.
  407. 20: :ref:`PackedByteArray<class_PackedByteArray>`
  408. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  409. +---------------+-------+-----------+------------------------+
  410. | Offset | Len | Type | Description |
  411. +===============+=======+===========+========================+
  412. | 4 | 4 | Integer | Array length (Bytes) |
  413. +---------------+-------+-----------+------------------------+
  414. | 8..8+length | 1 | Byte | Byte (0..255) |
  415. +---------------+-------+-----------+------------------------+
  416. The array data is padded to 4 bytes.
  417. 21: :ref:`PackedInt32Array<class_PackedInt32Array>`
  418. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  419. +------------------+-------+-----------+---------------------------+
  420. | Offset | Len | Type | Description |
  421. +==================+=======+===========+===========================+
  422. | 4 | 4 | Integer | Array length (Integers) |
  423. +------------------+-------+-----------+---------------------------+
  424. | 8..8+length\*4 | 4 | Integer | 32-bit signed integer |
  425. +------------------+-------+-----------+---------------------------+
  426. 22: :ref:`PackedInt64Array<class_PackedInt64Array>`
  427. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  428. +------------------+-------+-----------+---------------------------+
  429. | Offset | Len | Type | Description |
  430. +==================+=======+===========+===========================+
  431. | 4 | 8 | Integer | Array length (Integers) |
  432. +------------------+-------+-----------+---------------------------+
  433. | 8..8+length\*8 | 8 | Integer | 64-bit signed integer |
  434. +------------------+-------+-----------+---------------------------+
  435. 23: :ref:`PackedFloat32Array<class_PackedFloat32Array>`
  436. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  437. +------------------+-------+-----------+-------------------------------------------+
  438. | Offset | Len | Type | Description |
  439. +==================+=======+===========+===========================================+
  440. | 4 | 4 | Integer | Array length (Floats) |
  441. +------------------+-------+-----------+-------------------------------------------+
  442. | 8..8+length\*4 | 4 | Integer | 32-bit IEEE 754 single-precision float |
  443. +------------------+-------+-----------+-------------------------------------------+
  444. 24: :ref:`PackedFloat64Array<class_PackedFloat64Array>`
  445. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  446. +------------------+-------+-----------+-------------------------------------------+
  447. | Offset | Len | Type | Description |
  448. +==================+=======+===========+===========================================+
  449. | 4 | 4 | Integer | Array length (Floats) |
  450. +------------------+-------+-----------+-------------------------------------------+
  451. | 8..8+length\*8 | 8 | Integer | 64-bit IEEE 754 double-precision float |
  452. +------------------+-------+-----------+-------------------------------------------+
  453. 25: :ref:`PackedStringArray<class_PackedStringArray>`
  454. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  455. +----------+-------+-----------+--------------------------+
  456. | Offset | Len | Type | Description |
  457. +==========+=======+===========+==========================+
  458. | 4 | 4 | Integer | Array length (Strings) |
  459. +----------+-------+-----------+--------------------------+
  460. For each String:
  461. +----------+-------+-----------+------------------------+
  462. | Offset | Len | Type | Description |
  463. +==========+=======+===========+========================+
  464. | X+0 | 4 | Integer | String length |
  465. +----------+-------+-----------+------------------------+
  466. | X+4 | X | Bytes | UTF-8 encoded string |
  467. +----------+-------+-----------+------------------------+
  468. Every string is padded to 4 bytes.
  469. 26: :ref:`PackedVector2Array<class_PackedVector2Array>`
  470. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  471. +-------------------+-------+-----------+----------------+
  472. | Offset | Len | Type | Description |
  473. +===================+=======+===========+================+
  474. | 4 | 4 | Integer | Array length |
  475. +-------------------+-------+-----------+----------------+
  476. | 8..8+length\*8 | 4 | Float | X coordinate |
  477. +-------------------+-------+-----------+----------------+
  478. | 8..12+length\*8 | 4 | Float | Y coordinate |
  479. +-------------------+-------+-----------+----------------+
  480. 27: :ref:`PackedVector3Array<class_PackedVector3Array>`
  481. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  482. +--------------------+-------+-----------+----------------+
  483. | Offset | Len | Type | Description |
  484. +====================+=======+===========+================+
  485. | 4 | 4 | Integer | Array length |
  486. +--------------------+-------+-----------+----------------+
  487. | 8..8+length\*12 | 4 | Float | X coordinate |
  488. +--------------------+-------+-----------+----------------+
  489. | 8..12+length\*12 | 4 | Float | Y coordinate |
  490. +--------------------+-------+-----------+----------------+
  491. | 8..16+length\*12 | 4 | Float | Z coordinate |
  492. +--------------------+-------+-----------+----------------+
  493. 28: :ref:`PackedColorArray<class_PackedColorArray>`
  494. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  495. +--------------------+-------+-----------+--------------------------------------------------------------+
  496. | Offset | Len | Type | Description |
  497. +====================+=======+===========+==============================================================+
  498. | 4 | 4 | Integer | Array length |
  499. +--------------------+-------+-----------+--------------------------------------------------------------+
  500. | 8..8+length\*16 | 4 | Float | Red (typically 0..1, can be above 1 for overbright colors) |
  501. +--------------------+-------+-----------+--------------------------------------------------------------+
  502. | 8..12+length\*16 | 4 | Float | Green (typically 0..1, can be above 1 for overbright colors) |
  503. +--------------------+-------+-----------+--------------------------------------------------------------+
  504. | 8..16+length\*16 | 4 | Float | Blue (typically 0..1, can be above 1 for overbright colors) |
  505. +--------------------+-------+-----------+--------------------------------------------------------------+
  506. | 8..20+length\*16 | 4 | Float | Alpha (0..1) |
  507. +--------------------+-------+-----------+--------------------------------------------------------------+