binary_serialization_api.rst 31 KB

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