:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/modules/gltf/doc_classes/GLTFNode.xml. .. _class_GLTFNode: GLTFNode ======== **Inherits:** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` glTF node class. .. rst-class:: classref-introduction-group Description ----------- Represents a glTF node. glTF nodes may have names, transforms, children (other glTF nodes), and more specialized properties (represented by their own classes). glTF nodes generally exist inside of :ref:`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` and :ref:`set_additional_data`. .. rst-class:: classref-introduction-group Tutorials --------- - :doc:`Runtime file loading and saving <../tutorials/io/runtime_file_loading_and_saving>` - `glTF scene and node spec `__ .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+ | :ref:`int` | :ref:`camera` | ``-1`` | +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+ | :ref:`PackedInt32Array` | :ref:`children` | ``PackedInt32Array()`` | +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+ | :ref:`int` | :ref:`height` | ``-1`` | +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+ | :ref:`int` | :ref:`light` | ``-1`` | +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+ | :ref:`int` | :ref:`mesh` | ``-1`` | +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+ | :ref:`String` | :ref:`original_name` | ``""`` | +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+ | :ref:`int` | :ref:`parent` | ``-1`` | +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+ | :ref:`Vector3` | :ref:`position` | ``Vector3(0, 0, 0)`` | +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+ | :ref:`Quaternion` | :ref:`rotation` | ``Quaternion(0, 0, 0, 1)`` | +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+ | :ref:`Vector3` | :ref:`scale` | ``Vector3(1, 1, 1)`` | +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+ | :ref:`int` | :ref:`skeleton` | ``-1`` | +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+ | :ref:`int` | :ref:`skin` | ``-1`` | +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+ | :ref:`Transform3D` | :ref:`xform` | ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` | +-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+ .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`append_child_index`\ (\ child_index\: :ref:`int`\ ) | +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Variant` | :ref:`get_additional_data`\ (\ extension_name\: :ref:`StringName`\ ) | +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`NodePath` | :ref:`get_scene_node_path`\ (\ gltf_state\: :ref:`GLTFState`, handle_skeletons\: :ref:`bool` = true\ ) | +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | |void| | :ref:`set_additional_data`\ (\ extension_name\: :ref:`StringName`, additional_data\: :ref:`Variant`\ ) | +---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_GLTFNode_property_camera: .. rst-class:: classref-property :ref:`int` **camera** = ``-1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_camera**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_camera**\ (\ ) If this glTF node is a camera, the index of the :ref:`GLTFCamera` in the :ref:`GLTFState` that describes the camera's properties. If -1, this node is not a camera. .. rst-class:: classref-item-separator ---- .. _class_GLTFNode_property_children: .. rst-class:: classref-property :ref:`PackedInt32Array` **children** = ``PackedInt32Array()`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_children**\ (\ value\: :ref:`PackedInt32Array`\ ) - :ref:`PackedInt32Array` **get_children**\ (\ ) The indices of the child nodes in the :ref:`GLTFState`. If this glTF node has no children, this will be an empty array. **Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedInt32Array` for more details. .. rst-class:: classref-item-separator ---- .. _class_GLTFNode_property_height: .. rst-class:: classref-property :ref:`int` **height** = ``-1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_height**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_height**\ (\ ) 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. .. rst-class:: classref-item-separator ---- .. _class_GLTFNode_property_light: .. rst-class:: classref-property :ref:`int` **light** = ``-1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_light**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_light**\ (\ ) If this glTF node is a light, the index of the :ref:`GLTFLight` in the :ref:`GLTFState` that describes the light's properties. If -1, this node is not a light. .. rst-class:: classref-item-separator ---- .. _class_GLTFNode_property_mesh: .. rst-class:: classref-property :ref:`int` **mesh** = ``-1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_mesh**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_mesh**\ (\ ) If this glTF node is a mesh, the index of the :ref:`GLTFMesh` in the :ref:`GLTFState` that describes the mesh's properties. If -1, this node is not a mesh. .. rst-class:: classref-item-separator ---- .. _class_GLTFNode_property_original_name: .. rst-class:: classref-property :ref:`String` **original_name** = ``""`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_original_name**\ (\ value\: :ref:`String`\ ) - :ref:`String` **get_original_name**\ (\ ) The original name of the node. .. rst-class:: classref-item-separator ---- .. _class_GLTFNode_property_parent: .. rst-class:: classref-property :ref:`int` **parent** = ``-1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_parent**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_parent**\ (\ ) The index of the parent node in the :ref:`GLTFState`. If -1, this node is a root node. .. rst-class:: classref-item-separator ---- .. _class_GLTFNode_property_position: .. rst-class:: classref-property :ref:`Vector3` **position** = ``Vector3(0, 0, 0)`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_position**\ (\ value\: :ref:`Vector3`\ ) - :ref:`Vector3` **get_position**\ (\ ) The position of the glTF node relative to its parent. .. rst-class:: classref-item-separator ---- .. _class_GLTFNode_property_rotation: .. rst-class:: classref-property :ref:`Quaternion` **rotation** = ``Quaternion(0, 0, 0, 1)`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_rotation**\ (\ value\: :ref:`Quaternion`\ ) - :ref:`Quaternion` **get_rotation**\ (\ ) The rotation of the glTF node relative to its parent. .. rst-class:: classref-item-separator ---- .. _class_GLTFNode_property_scale: .. rst-class:: classref-property :ref:`Vector3` **scale** = ``Vector3(1, 1, 1)`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_scale**\ (\ value\: :ref:`Vector3`\ ) - :ref:`Vector3` **get_scale**\ (\ ) The scale of the glTF node relative to its parent. .. rst-class:: classref-item-separator ---- .. _class_GLTFNode_property_skeleton: .. rst-class:: classref-property :ref:`int` **skeleton** = ``-1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_skeleton**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_skeleton**\ (\ ) If this glTF node has a skeleton, the index of the :ref:`GLTFSkeleton` in the :ref:`GLTFState` that describes the skeleton's properties. If -1, this node does not have a skeleton. .. rst-class:: classref-item-separator ---- .. _class_GLTFNode_property_skin: .. rst-class:: classref-property :ref:`int` **skin** = ``-1`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_skin**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_skin**\ (\ ) If this glTF node has a skin, the index of the :ref:`GLTFSkin` in the :ref:`GLTFState` that describes the skin's properties. If -1, this node does not have a skin. .. rst-class:: classref-item-separator ---- .. _class_GLTFNode_property_xform: .. rst-class:: classref-property :ref:`Transform3D` **xform** = ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_xform**\ (\ value\: :ref:`Transform3D`\ ) - :ref:`Transform3D` **get_xform**\ (\ ) The transform of the glTF node relative to its parent. This property is usually unused since the position, rotation, and scale properties are preferred. .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_GLTFNode_method_append_child_index: .. rst-class:: classref-method |void| **append_child_index**\ (\ child_index\: :ref:`int`\ ) :ref:`🔗` Appends the given child node index to the :ref:`children` array. .. rst-class:: classref-item-separator ---- .. _class_GLTFNode_method_get_additional_data: .. rst-class:: classref-method :ref:`Variant` **get_additional_data**\ (\ extension_name\: :ref:`StringName`\ ) :ref:`🔗` Gets additional arbitrary data in this **GLTFNode** instance. This can be used to keep per-node state data in :ref:`GLTFDocumentExtension` classes, which is important because they are stateless. The argument should be the :ref:`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``. .. rst-class:: classref-item-separator ---- .. _class_GLTFNode_method_get_scene_node_path: .. rst-class:: classref-method :ref:`NodePath` **get_scene_node_path**\ (\ gltf_state\: :ref:`GLTFState`, handle_skeletons\: :ref:`bool` = true\ ) :ref:`🔗` Returns the :ref:`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`, for handling extensions such as ``KHR_animation_pointer`` or ``KHR_interactivity``. 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"``. .. rst-class:: classref-item-separator ---- .. _class_GLTFNode_method_set_additional_data: .. rst-class:: classref-method |void| **set_additional_data**\ (\ extension_name\: :ref:`StringName`, additional_data\: :ref:`Variant`\ ) :ref:`🔗` Sets additional arbitrary data in this **GLTFNode** instance. This can be used to keep per-node state data in :ref:`GLTFDocumentExtension` classes, which is important because they are stateless. The first argument should be the :ref:`GLTFDocumentExtension` name (does not have to match the extension name in the glTF file), and the second argument can be anything you want. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`