GLTFNode

继承: Resource < RefCounted < Object

glTF node class.

描述

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

属性

方法

voidappend_child_index ( child_index: int )
Variantget_additional_data ( extension_name: StringName )
NodePathget_scene_node_path ( gltf_state: GLTFState, handle_skeletons: bool = true )
voidset_additional_data ( extension_name: StringName, additional_data: Variant )

属性说明

int camera = -1

  • void set_camera ( value: int )
  • 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.


PackedInt32Array children = PackedInt32Array()

The indices of the child nodes in the 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 PackedInt32Array for more details.


int height = -1

  • void set_height ( value: int )
  • 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.


int light = -1

  • void set_light ( value: int )
  • 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 ( value: int )
  • 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.


String original_name = ""

  • void set_original_name ( value: String )
  • String get_original_name ( )

The original name of the node.


int parent = -1

  • void set_parent ( value: int )
  • int get_parent ( )

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


Vector3 position = Vector3(0, 0, 0)

The position of the glTF node relative to its parent.


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

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 ( value: int )
  • 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 ( value: int )
  • 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.


Transform3D xform = Transform3D(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.


方法说明

void append_child_index ( child_index: int )

Appends the given child node index to the children array.


Variant get_additional_data ( extension_name: 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.


NodePath get_scene_node_path ( gltf_state: GLTFState, handle_skeletons: bool = true )

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


void set_additional_data ( extension_name: StringName, additional_data: 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.

1

本方法通常需要用户覆盖才能生效。

2

本方法无副作用,不会修改该实例的任何成员变量。

3

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

4

本方法用于构造某个类型。

5

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。