GLTFNode

Inherits: Resource < Reference < Object

GLTF node class.

Description

Represents a GLTF node. GLTF nodes may have names, transforms, children (other GLTF nodes), and more specialized properties (represented by their own classes).

Note: This class is only compiled in editor builds. Run-time glTF loading and saving is not available in exported projects. References to GLTFNode within a script will cause an error in an exported project.

Tutorials

Properties

int

camera

-1

PoolIntArray

children

PoolIntArray(  )

int

height

-1

bool

joint

false

int

light

-1

int

mesh

-1

int

parent

-1

Quat

rotation

Quat( 0, 0, 0, 1 )

Vector3

scale

Vector3( 1, 1, 1 )

int

skeleton

-1

int

skin

-1

Vector3

translation

Vector3( 0, 0, 0 )

Transform

xform

Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )

Methods

Variant

get_additional_data ( String extension_name )

void

set_additional_data ( String extension_name, Variant additional_data )


Property Descriptions

int camera = -1

  • void set_camera ( int value )

  • int get_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.


PoolIntArray children = PoolIntArray(  )

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


int height = -1

  • void set_height ( int value )

  • 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.


bool joint = false

  • void set_joint ( bool value )

  • bool get_joint ( )

This property is unused and does nothing.


int light = -1

  • void set_light ( int value )

  • int get_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.


int mesh = -1

  • void set_mesh ( int value )

  • int get_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.


int parent = -1

  • void set_parent ( int value )

  • int get_parent ( )

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


Quat rotation = Quat( 0, 0, 0, 1 )

  • void set_rotation ( Quat value )

  • Quat get_rotation ( )

The rotation of the GLTF node relative to its parent.


Vector3 scale = Vector3( 1, 1, 1 )

The scale of the GLTF node relative to its parent.


int skeleton = -1

  • void set_skeleton ( int value )

  • int get_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.


int skin = -1

  • void set_skin ( int value )

  • int get_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.


Vector3 translation = Vector3( 0, 0, 0 )

The position of the GLTF node relative to its parent.


Transform xform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0 )

The transform of the GLTF node relative to its parent. This property is usually unused since the position, rotation, and scale properties are preferred.


Method Descriptions

Variant get_additional_data ( String extension_name )

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.


void set_additional_data ( String extension_name, Variant additional_data )

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.