Table of Contents

Class GLTFNode

glTF node class.

Inheritance
GLTFNode

Remarks

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 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 GLTFNode.get_additional_data and GLTFNode.set_additional_data.

See Also

Properties

camera

If this glTF node is a camera, the index of the GLTFCamera in the GLTFState that describes the camera's properties. If -1, this node is not a camera.

var camera : int = -1

Property Value

int

Remarks

  • void set_camera(int value)
  • int get_camera

children

The indices of the child nodes in the GLTFState. If this glTF node has no children, this will be an empty array.

var children : PackedInt32Array = PackedInt32Array()

Property Value

PackedInt32Array

Remarks

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.

var height : int = -1

Property Value

int

Remarks

  • void set_height(int value)
  • int get_height

light

If this glTF node is a light, the index of the GLTFLight in the GLTFState that describes the light's properties. If -1, this node is not a light.

var light : int = -1

Property Value

int

Remarks

  • void set_light(int value)
  • int get_light

mesh

If this glTF node is a mesh, the index of the GLTFMesh in the GLTFState that describes the mesh's properties. If -1, this node is not a mesh.

var mesh : int = -1

Property Value

int

Remarks

  • void set_mesh(int value)
  • int get_mesh

original_name

The original name of the node.

var original_name : String = ""

Property Value

String

Remarks

  • void set_original_name(String value)
  • String get_original_name

parent

The index of the parent node in the GLTFState. If -1, this node is a root node.

var parent : int = -1

Property Value

int

Remarks

  • void set_parent(int value)
  • int get_parent

position

The position of the glTF node relative to its parent.

var position : Vector3 = Vector3(0, 0, 0)

Property Value

Vector3

Remarks

rotation

The rotation of the glTF node relative to its parent.

var rotation : Quaternion = Quaternion(0, 0, 0, 1)

Property Value

Quaternion

Remarks

scale

The scale of the glTF node relative to its parent.

var scale : Vector3 = Vector3(1, 1, 1)

Property Value

Vector3

Remarks

skeleton

If this glTF node has a skeleton, the index of the GLTFSkeleton in the GLTFState that describes the skeleton's properties. If -1, this node does not have a skeleton.

var skeleton : int = -1

Property Value

int

Remarks

  • void set_skeleton(int value)
  • int get_skeleton

skin

If this glTF node has a skin, the index of the GLTFSkin in the GLTFState that describes the skin's properties. If -1, this node does not have a skin.

var skin : int = -1

Property Value

int

Remarks

  • void set_skin(int value)
  • int get_skin

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.

var xform : Transform3D = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)

Property Value

Transform3D

Remarks

Methods

append_child_index(int)

Appends the given child node index to the children array.

void append_child_index(int child_index)

Parameters

child_index int

get_additional_data(StringName)

Gets additional arbitrary data in this GLTFNode instance. This can be used to keep per-node state data in GLTFDocumentExtension classes, which is important because they are stateless.

The argument should be the 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.

Variant get_additional_data(StringName extension_name)

Parameters

extension_name StringName

get_scene_node_path(GLTFState, bool)

Returns the 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 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".

NodePath get_scene_node_path(GLTFState gltf_state, bool handle_skeletons)

Parameters

gltf_state GLTFState
handle_skeletons bool

set_additional_data(StringName, Variant)

Sets additional arbitrary data in this GLTFNode instance. This can be used to keep per-node state data in GLTFDocumentExtension classes, which is important because they are stateless.

The first argument should be the GLTFDocumentExtension name (does not have to match the extension name in the glTF file), and the second argument can be anything you want.

void set_additional_data(StringName extension_name, Variant additional_data)

Parameters

extension_name StringName
additional_data Variant