class_gltfnode.rst 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  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. - :doc:`Runtime file loading and saving <../tutorials/io/runtime_file_loading_and_saving>`
  20. - `glTF scene and node spec <https://github.com/KhronosGroup/glTF-Tutorials/blob/master/gltfTutorial/gltfTutorial_004_ScenesNodes.md">`__
  21. .. rst-class:: classref-reftable-group
  22. Properties
  23. ----------
  24. .. table::
  25. :widths: auto
  26. +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
  27. | :ref:`int<class_int>` | :ref:`camera<class_GLTFNode_property_camera>` | ``-1`` |
  28. +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
  29. | :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`children<class_GLTFNode_property_children>` | ``PackedInt32Array()`` |
  30. +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
  31. | :ref:`int<class_int>` | :ref:`height<class_GLTFNode_property_height>` | ``-1`` |
  32. +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
  33. | :ref:`int<class_int>` | :ref:`light<class_GLTFNode_property_light>` | ``-1`` |
  34. +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
  35. | :ref:`int<class_int>` | :ref:`mesh<class_GLTFNode_property_mesh>` | ``-1`` |
  36. +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
  37. | :ref:`String<class_String>` | :ref:`original_name<class_GLTFNode_property_original_name>` | ``""`` |
  38. +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
  39. | :ref:`int<class_int>` | :ref:`parent<class_GLTFNode_property_parent>` | ``-1`` |
  40. +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
  41. | :ref:`Vector3<class_Vector3>` | :ref:`position<class_GLTFNode_property_position>` | ``Vector3(0, 0, 0)`` |
  42. +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
  43. | :ref:`Quaternion<class_Quaternion>` | :ref:`rotation<class_GLTFNode_property_rotation>` | ``Quaternion(0, 0, 0, 1)`` |
  44. +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
  45. | :ref:`Vector3<class_Vector3>` | :ref:`scale<class_GLTFNode_property_scale>` | ``Vector3(1, 1, 1)`` |
  46. +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
  47. | :ref:`int<class_int>` | :ref:`skeleton<class_GLTFNode_property_skeleton>` | ``-1`` |
  48. +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
  49. | :ref:`int<class_int>` | :ref:`skin<class_GLTFNode_property_skin>` | ``-1`` |
  50. +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
  51. | :ref:`Transform3D<class_Transform3D>` | :ref:`xform<class_GLTFNode_property_xform>` | ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` |
  52. +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
  53. .. rst-class:: classref-reftable-group
  54. Methods
  55. -------
  56. .. table::
  57. :widths: auto
  58. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  59. | |void| | :ref:`append_child_index<class_GLTFNode_method_append_child_index>`\ (\ child_index\: :ref:`int<class_int>`\ ) |
  60. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  61. | :ref:`Variant<class_Variant>` | :ref:`get_additional_data<class_GLTFNode_method_get_additional_data>`\ (\ extension_name\: :ref:`StringName<class_StringName>`\ ) |
  62. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  63. | :ref:`NodePath<class_NodePath>` | :ref:`get_scene_node_path<class_GLTFNode_method_get_scene_node_path>`\ (\ gltf_state\: :ref:`GLTFState<class_GLTFState>`, handle_skeletons\: :ref:`bool<class_bool>` = true\ ) |
  64. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  65. | |void| | :ref:`set_additional_data<class_GLTFNode_method_set_additional_data>`\ (\ extension_name\: :ref:`StringName<class_StringName>`, additional_data\: :ref:`Variant<class_Variant>`\ ) |
  66. +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  67. .. rst-class:: classref-section-separator
  68. ----
  69. .. rst-class:: classref-descriptions-group
  70. Property Descriptions
  71. ---------------------
  72. .. _class_GLTFNode_property_camera:
  73. .. rst-class:: classref-property
  74. :ref:`int<class_int>` **camera** = ``-1`` :ref:`🔗<class_GLTFNode_property_camera>`
  75. .. rst-class:: classref-property-setget
  76. - |void| **set_camera**\ (\ value\: :ref:`int<class_int>`\ )
  77. - :ref:`int<class_int>` **get_camera**\ (\ )
  78. 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.
  79. .. rst-class:: classref-item-separator
  80. ----
  81. .. _class_GLTFNode_property_children:
  82. .. rst-class:: classref-property
  83. :ref:`PackedInt32Array<class_PackedInt32Array>` **children** = ``PackedInt32Array()`` :ref:`🔗<class_GLTFNode_property_children>`
  84. .. rst-class:: classref-property-setget
  85. - |void| **set_children**\ (\ value\: :ref:`PackedInt32Array<class_PackedInt32Array>`\ )
  86. - :ref:`PackedInt32Array<class_PackedInt32Array>` **get_children**\ (\ )
  87. The indices of the child nodes in the :ref:`GLTFState<class_GLTFState>`. If this glTF node has no children, this will be an empty array.
  88. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedInt32Array<class_PackedInt32Array>` for more details.
  89. .. rst-class:: classref-item-separator
  90. ----
  91. .. _class_GLTFNode_property_height:
  92. .. rst-class:: classref-property
  93. :ref:`int<class_int>` **height** = ``-1`` :ref:`🔗<class_GLTFNode_property_height>`
  94. .. rst-class:: classref-property-setget
  95. - |void| **set_height**\ (\ value\: :ref:`int<class_int>`\ )
  96. - :ref:`int<class_int>` **get_height**\ (\ )
  97. 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.
  98. .. rst-class:: classref-item-separator
  99. ----
  100. .. _class_GLTFNode_property_light:
  101. .. rst-class:: classref-property
  102. :ref:`int<class_int>` **light** = ``-1`` :ref:`🔗<class_GLTFNode_property_light>`
  103. .. rst-class:: classref-property-setget
  104. - |void| **set_light**\ (\ value\: :ref:`int<class_int>`\ )
  105. - :ref:`int<class_int>` **get_light**\ (\ )
  106. 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.
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_GLTFNode_property_mesh:
  110. .. rst-class:: classref-property
  111. :ref:`int<class_int>` **mesh** = ``-1`` :ref:`🔗<class_GLTFNode_property_mesh>`
  112. .. rst-class:: classref-property-setget
  113. - |void| **set_mesh**\ (\ value\: :ref:`int<class_int>`\ )
  114. - :ref:`int<class_int>` **get_mesh**\ (\ )
  115. 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.
  116. .. rst-class:: classref-item-separator
  117. ----
  118. .. _class_GLTFNode_property_original_name:
  119. .. rst-class:: classref-property
  120. :ref:`String<class_String>` **original_name** = ``""`` :ref:`🔗<class_GLTFNode_property_original_name>`
  121. .. rst-class:: classref-property-setget
  122. - |void| **set_original_name**\ (\ value\: :ref:`String<class_String>`\ )
  123. - :ref:`String<class_String>` **get_original_name**\ (\ )
  124. The original name of the node.
  125. .. rst-class:: classref-item-separator
  126. ----
  127. .. _class_GLTFNode_property_parent:
  128. .. rst-class:: classref-property
  129. :ref:`int<class_int>` **parent** = ``-1`` :ref:`🔗<class_GLTFNode_property_parent>`
  130. .. rst-class:: classref-property-setget
  131. - |void| **set_parent**\ (\ value\: :ref:`int<class_int>`\ )
  132. - :ref:`int<class_int>` **get_parent**\ (\ )
  133. The index of the parent node in the :ref:`GLTFState<class_GLTFState>`. If -1, this node is a root node.
  134. .. rst-class:: classref-item-separator
  135. ----
  136. .. _class_GLTFNode_property_position:
  137. .. rst-class:: classref-property
  138. :ref:`Vector3<class_Vector3>` **position** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_GLTFNode_property_position>`
  139. .. rst-class:: classref-property-setget
  140. - |void| **set_position**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  141. - :ref:`Vector3<class_Vector3>` **get_position**\ (\ )
  142. The position of the glTF node relative to its parent.
  143. .. rst-class:: classref-item-separator
  144. ----
  145. .. _class_GLTFNode_property_rotation:
  146. .. rst-class:: classref-property
  147. :ref:`Quaternion<class_Quaternion>` **rotation** = ``Quaternion(0, 0, 0, 1)`` :ref:`🔗<class_GLTFNode_property_rotation>`
  148. .. rst-class:: classref-property-setget
  149. - |void| **set_rotation**\ (\ value\: :ref:`Quaternion<class_Quaternion>`\ )
  150. - :ref:`Quaternion<class_Quaternion>` **get_rotation**\ (\ )
  151. The rotation of the glTF node relative to its parent.
  152. .. rst-class:: classref-item-separator
  153. ----
  154. .. _class_GLTFNode_property_scale:
  155. .. rst-class:: classref-property
  156. :ref:`Vector3<class_Vector3>` **scale** = ``Vector3(1, 1, 1)`` :ref:`🔗<class_GLTFNode_property_scale>`
  157. .. rst-class:: classref-property-setget
  158. - |void| **set_scale**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
  159. - :ref:`Vector3<class_Vector3>` **get_scale**\ (\ )
  160. The scale of the glTF node relative to its parent.
  161. .. rst-class:: classref-item-separator
  162. ----
  163. .. _class_GLTFNode_property_skeleton:
  164. .. rst-class:: classref-property
  165. :ref:`int<class_int>` **skeleton** = ``-1`` :ref:`🔗<class_GLTFNode_property_skeleton>`
  166. .. rst-class:: classref-property-setget
  167. - |void| **set_skeleton**\ (\ value\: :ref:`int<class_int>`\ )
  168. - :ref:`int<class_int>` **get_skeleton**\ (\ )
  169. 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.
  170. .. rst-class:: classref-item-separator
  171. ----
  172. .. _class_GLTFNode_property_skin:
  173. .. rst-class:: classref-property
  174. :ref:`int<class_int>` **skin** = ``-1`` :ref:`🔗<class_GLTFNode_property_skin>`
  175. .. rst-class:: classref-property-setget
  176. - |void| **set_skin**\ (\ value\: :ref:`int<class_int>`\ )
  177. - :ref:`int<class_int>` **get_skin**\ (\ )
  178. 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.
  179. .. rst-class:: classref-item-separator
  180. ----
  181. .. _class_GLTFNode_property_xform:
  182. .. rst-class:: classref-property
  183. :ref:`Transform3D<class_Transform3D>` **xform** = ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` :ref:`🔗<class_GLTFNode_property_xform>`
  184. .. rst-class:: classref-property-setget
  185. - |void| **set_xform**\ (\ value\: :ref:`Transform3D<class_Transform3D>`\ )
  186. - :ref:`Transform3D<class_Transform3D>` **get_xform**\ (\ )
  187. The transform of the glTF node relative to its parent. This property is usually unused since the position, rotation, and scale properties are preferred.
  188. .. rst-class:: classref-section-separator
  189. ----
  190. .. rst-class:: classref-descriptions-group
  191. Method Descriptions
  192. -------------------
  193. .. _class_GLTFNode_method_append_child_index:
  194. .. rst-class:: classref-method
  195. |void| **append_child_index**\ (\ child_index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_GLTFNode_method_append_child_index>`
  196. Appends the given child node index to the :ref:`children<class_GLTFNode_property_children>` array.
  197. .. rst-class:: classref-item-separator
  198. ----
  199. .. _class_GLTFNode_method_get_additional_data:
  200. .. rst-class:: classref-method
  201. :ref:`Variant<class_Variant>` **get_additional_data**\ (\ extension_name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_GLTFNode_method_get_additional_data>`
  202. 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.
  203. 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.
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_GLTFNode_method_get_scene_node_path:
  207. .. rst-class:: classref-method
  208. :ref:`NodePath<class_NodePath>` **get_scene_node_path**\ (\ gltf_state\: :ref:`GLTFState<class_GLTFState>`, handle_skeletons\: :ref:`bool<class_bool>` = true\ ) :ref:`🔗<class_GLTFNode_method_get_scene_node_path>`
  209. Returns the :ref:`NodePath<class_NodePath>` that this GLTF node will have in the Godot scene tree after being imported. This is useful when importing glTF object model pointers with :ref:`GLTFObjectModelProperty<class_GLTFObjectModelProperty>`, for handling extensions such as ``KHR_animation_pointer`` or ``KHR_interactivity``.
  210. If ``handle_skeletons`` is true, paths to skeleton bone glTF nodes will be resolved properly. For example, a path that would be ``^"A/B/C/Bone1/Bone2/Bone3"`` if false will become ``^"A/B/C/Skeleton3D:Bone3"``.
  211. .. rst-class:: classref-item-separator
  212. ----
  213. .. _class_GLTFNode_method_set_additional_data:
  214. .. rst-class:: classref-method
  215. |void| **set_additional_data**\ (\ extension_name\: :ref:`StringName<class_StringName>`, additional_data\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_GLTFNode_method_set_additional_data>`
  216. 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.
  217. 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.
  218. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  219. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  220. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  221. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  222. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  223. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  224. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  225. .. |void| replace:: :abbr:`void (No return value.)`