class_gltfnode.rst 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/modules/gltf/doc_classes/GLTFNode.xml.
  6. .. _class_GLTFNode:
  7. GLTFNode
  8. ========
  9. **Inherits:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. GLTF node class.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. Represents a GLTF node. GLTF nodes may have names, transforms, children (other GLTF nodes), and more specialized properties (represented by their own classes).
  15. GLTF nodes generally exist inside of :ref:`GLTFState<class_GLTFState>` which represents all data of a GLTF file. Most of GLTFNode's properties are indices of other data in the GLTF file. You can extend a GLTF node with additional properties by using :ref:`get_additional_data<class_GLTFNode_method_get_additional_data>` and :ref:`set_additional_data<class_GLTFNode_method_set_additional_data>`.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - `GLTF scene and node spec <https://github.com/KhronosGroup/glTF-Tutorials/blob/master/gltfTutorial/gltfTutorial_004_ScenesNodes.md">`__
  20. .. rst-class:: classref-reftable-group
  21. Properties
  22. ----------
  23. .. table::
  24. :widths: auto
  25. +-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
  26. | :ref:`int<class_int>` | :ref:`camera<class_GLTFNode_property_camera>` | ``-1`` |
  27. +-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
  28. | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`children<class_GLTFNode_property_children>` | ``PackedInt32Array()`` |
  29. +-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
  30. | :ref:`int<class_int>` | :ref:`height<class_GLTFNode_property_height>` | ``-1`` |
  31. +-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
  32. | :ref:`int<class_int>` | :ref:`light<class_GLTFNode_property_light>` | ``-1`` |
  33. +-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
  34. | :ref:`int<class_int>` | :ref:`mesh<class_GLTFNode_property_mesh>` | ``-1`` |
  35. +-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
  36. | :ref:`int<class_int>` | :ref:`parent<class_GLTFNode_property_parent>` | ``-1`` |
  37. +-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
  38. | :ref:`Vector3<class_Vector3>` | :ref:`position<class_GLTFNode_property_position>` | ``Vector3(0, 0, 0)`` |
  39. +-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
  40. | :ref:`Quaternion<class_Quaternion>` | :ref:`rotation<class_GLTFNode_property_rotation>` | ``Quaternion(0, 0, 0, 1)`` |
  41. +-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
  42. | :ref:`Vector3<class_Vector3>` | :ref:`scale<class_GLTFNode_property_scale>` | ``Vector3(1, 1, 1)`` |
  43. +-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
  44. | :ref:`int<class_int>` | :ref:`skeleton<class_GLTFNode_property_skeleton>` | ``-1`` |
  45. +-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
  46. | :ref:`int<class_int>` | :ref:`skin<class_GLTFNode_property_skin>` | ``-1`` |
  47. +-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
  48. | :ref:`Transform3D<class_Transform3D>` | :ref:`xform<class_GLTFNode_property_xform>` | ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` |
  49. +-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
  50. .. rst-class:: classref-reftable-group
  51. Methods
  52. -------
  53. .. table::
  54. :widths: auto
  55. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`Variant<class_Variant>` | :ref:`get_additional_data<class_GLTFNode_method_get_additional_data>` **(** :ref:`StringName<class_StringName>` extension_name **)** |
  57. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | void | :ref:`set_additional_data<class_GLTFNode_method_set_additional_data>` **(** :ref:`StringName<class_StringName>` extension_name, :ref:`Variant<class_Variant>` additional_data **)** |
  59. +-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. .. rst-class:: classref-section-separator
  61. ----
  62. .. rst-class:: classref-descriptions-group
  63. Property Descriptions
  64. ---------------------
  65. .. _class_GLTFNode_property_camera:
  66. .. rst-class:: classref-property
  67. :ref:`int<class_int>` **camera** = ``-1``
  68. .. rst-class:: classref-property-setget
  69. - void **set_camera** **(** :ref:`int<class_int>` value **)**
  70. - :ref:`int<class_int>` **get_camera** **(** **)**
  71. If this GLTF node is a camera, the index of the :ref:`GLTFCamera<class_GLTFCamera>` in the :ref:`GLTFState<class_GLTFState>` that describes the camera's properties. If -1, this node is not a camera.
  72. .. rst-class:: classref-item-separator
  73. ----
  74. .. _class_GLTFNode_property_children:
  75. .. rst-class:: classref-property
  76. :ref:`PackedInt32Array<class_PackedInt32Array>` **children** = ``PackedInt32Array()``
  77. .. rst-class:: classref-property-setget
  78. - void **set_children** **(** :ref:`PackedInt32Array<class_PackedInt32Array>` value **)**
  79. - :ref:`PackedInt32Array<class_PackedInt32Array>` **get_children** **(** **)**
  80. The indices of the children nodes in the :ref:`GLTFState<class_GLTFState>`. If this GLTF node has no children, this will be an empty array.
  81. .. rst-class:: classref-item-separator
  82. ----
  83. .. _class_GLTFNode_property_height:
  84. .. rst-class:: classref-property
  85. :ref:`int<class_int>` **height** = ``-1``
  86. .. rst-class:: classref-property-setget
  87. - void **set_height** **(** :ref:`int<class_int>` value **)**
  88. - :ref:`int<class_int>` **get_height** **(** **)**
  89. How deep into the node hierarchy this node is. A root node will have a height of 0, its children will have a height of 1, and so on. If -1, the height has not been calculated.
  90. .. rst-class:: classref-item-separator
  91. ----
  92. .. _class_GLTFNode_property_light:
  93. .. rst-class:: classref-property
  94. :ref:`int<class_int>` **light** = ``-1``
  95. .. rst-class:: classref-property-setget
  96. - void **set_light** **(** :ref:`int<class_int>` value **)**
  97. - :ref:`int<class_int>` **get_light** **(** **)**
  98. If this GLTF node is a light, the index of the :ref:`GLTFLight<class_GLTFLight>` in the :ref:`GLTFState<class_GLTFState>` that describes the light's properties. If -1, this node is not a light.
  99. .. rst-class:: classref-item-separator
  100. ----
  101. .. _class_GLTFNode_property_mesh:
  102. .. rst-class:: classref-property
  103. :ref:`int<class_int>` **mesh** = ``-1``
  104. .. rst-class:: classref-property-setget
  105. - void **set_mesh** **(** :ref:`int<class_int>` value **)**
  106. - :ref:`int<class_int>` **get_mesh** **(** **)**
  107. If this GLTF node is a mesh, the index of the :ref:`GLTFMesh<class_GLTFMesh>` in the :ref:`GLTFState<class_GLTFState>` that describes the mesh's properties. If -1, this node is not a mesh.
  108. .. rst-class:: classref-item-separator
  109. ----
  110. .. _class_GLTFNode_property_parent:
  111. .. rst-class:: classref-property
  112. :ref:`int<class_int>` **parent** = ``-1``
  113. .. rst-class:: classref-property-setget
  114. - void **set_parent** **(** :ref:`int<class_int>` value **)**
  115. - :ref:`int<class_int>` **get_parent** **(** **)**
  116. The index of the parent node in the :ref:`GLTFState<class_GLTFState>`. If -1, this node is a root node.
  117. .. rst-class:: classref-item-separator
  118. ----
  119. .. _class_GLTFNode_property_position:
  120. .. rst-class:: classref-property
  121. :ref:`Vector3<class_Vector3>` **position** = ``Vector3(0, 0, 0)``
  122. .. rst-class:: classref-property-setget
  123. - void **set_position** **(** :ref:`Vector3<class_Vector3>` value **)**
  124. - :ref:`Vector3<class_Vector3>` **get_position** **(** **)**
  125. The position of the GLTF node relative to its parent.
  126. .. rst-class:: classref-item-separator
  127. ----
  128. .. _class_GLTFNode_property_rotation:
  129. .. rst-class:: classref-property
  130. :ref:`Quaternion<class_Quaternion>` **rotation** = ``Quaternion(0, 0, 0, 1)``
  131. .. rst-class:: classref-property-setget
  132. - void **set_rotation** **(** :ref:`Quaternion<class_Quaternion>` value **)**
  133. - :ref:`Quaternion<class_Quaternion>` **get_rotation** **(** **)**
  134. The rotation of the GLTF node relative to its parent.
  135. .. rst-class:: classref-item-separator
  136. ----
  137. .. _class_GLTFNode_property_scale:
  138. .. rst-class:: classref-property
  139. :ref:`Vector3<class_Vector3>` **scale** = ``Vector3(1, 1, 1)``
  140. .. rst-class:: classref-property-setget
  141. - void **set_scale** **(** :ref:`Vector3<class_Vector3>` value **)**
  142. - :ref:`Vector3<class_Vector3>` **get_scale** **(** **)**
  143. The scale of the GLTF node relative to its parent.
  144. .. rst-class:: classref-item-separator
  145. ----
  146. .. _class_GLTFNode_property_skeleton:
  147. .. rst-class:: classref-property
  148. :ref:`int<class_int>` **skeleton** = ``-1``
  149. .. rst-class:: classref-property-setget
  150. - void **set_skeleton** **(** :ref:`int<class_int>` value **)**
  151. - :ref:`int<class_int>` **get_skeleton** **(** **)**
  152. If this GLTF node has a skeleton, the index of the :ref:`GLTFSkeleton<class_GLTFSkeleton>` in the :ref:`GLTFState<class_GLTFState>` that describes the skeleton's properties. If -1, this node does not have a skeleton.
  153. .. rst-class:: classref-item-separator
  154. ----
  155. .. _class_GLTFNode_property_skin:
  156. .. rst-class:: classref-property
  157. :ref:`int<class_int>` **skin** = ``-1``
  158. .. rst-class:: classref-property-setget
  159. - void **set_skin** **(** :ref:`int<class_int>` value **)**
  160. - :ref:`int<class_int>` **get_skin** **(** **)**
  161. If this GLTF node has a skin, the index of the :ref:`GLTFSkin<class_GLTFSkin>` in the :ref:`GLTFState<class_GLTFState>` that describes the skin's properties. If -1, this node does not have a skin.
  162. .. rst-class:: classref-item-separator
  163. ----
  164. .. _class_GLTFNode_property_xform:
  165. .. rst-class:: classref-property
  166. :ref:`Transform3D<class_Transform3D>` **xform** = ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)``
  167. .. rst-class:: classref-property-setget
  168. - void **set_xform** **(** :ref:`Transform3D<class_Transform3D>` value **)**
  169. - :ref:`Transform3D<class_Transform3D>` **get_xform** **(** **)**
  170. The transform of the GLTF node relative to its parent. This property is usually unused since the position, rotation, and scale properties are preferred.
  171. .. rst-class:: classref-section-separator
  172. ----
  173. .. rst-class:: classref-descriptions-group
  174. Method Descriptions
  175. -------------------
  176. .. _class_GLTFNode_method_get_additional_data:
  177. .. rst-class:: classref-method
  178. :ref:`Variant<class_Variant>` **get_additional_data** **(** :ref:`StringName<class_StringName>` extension_name **)**
  179. Gets additional arbitrary data in this **GLTFNode** instance. This can be used to keep per-node state data in :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>` classes, which is important because they are stateless.
  180. The argument should be the :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>` name (does not have to match the extension name in the GLTF file), and the return value can be anything you set. If nothing was set, the return value is null.
  181. .. rst-class:: classref-item-separator
  182. ----
  183. .. _class_GLTFNode_method_set_additional_data:
  184. .. rst-class:: classref-method
  185. void **set_additional_data** **(** :ref:`StringName<class_StringName>` extension_name, :ref:`Variant<class_Variant>` additional_data **)**
  186. Sets additional arbitrary data in this **GLTFNode** instance. This can be used to keep per-node state data in :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>` classes, which is important because they are stateless.
  187. The first argument should be the :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>` name (does not have to match the extension name in the GLTF file), and the second argument can be anything you want.
  188. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  189. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  190. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  191. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  192. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  193. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  194. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`