Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
GLTFNode
继承: Resource < RefCounted < Object
glTF 节点类。
描述
代表 glTF 节点。glTF 节点中可以包含名称、变换、子节点(glTF 节点)以及其他专门的属性(由各自不同的类表示)。
glTF 节点通常存在于表示 glTF 文件中的所有数据的 GLTFState 内部。大多数 GLTFNode 的属性都是 glTF 文件中其他数据的索引。你可以使用 get_additional_data() 和 set_additional_data() 来添加额外的属性,扩展 glTF 节点。
教程
属性
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
方法
void |
append_child_index(child_index: int) |
get_additional_data(extension_name: StringName) |
|
get_scene_node_path(gltf_state: GLTFState, handle_skeletons: bool = true) |
|
void |
set_additional_data(extension_name: StringName, additional_data: Variant) |
属性说明
如果该 glTF 节点是一个相机,则 GLTFState 中 GLTFCamera 的索引将描述该相机的属性。如果为 -1,则该节点不是相机。
PackedInt32Array children = PackedInt32Array()
🔗
void set_children(value: PackedInt32Array)
PackedInt32Array get_children()
GLTFState 中子节点的索引。如果该 glTF 节点没有子节点,则这将是一个空数组。
Note: The returned array is copied and any changes to it will not update the original property value. See PackedInt32Array for more details.
该节点在节点层次结构中的深度。根节点的高度为 0,其子节点的高度为 1,依此类推。如果为 -1,则尚未计算高度。
如果该 glTF 节点是一盏灯,则 GLTFState 中 GLTFLight 的索引将描述该灯的属性。如果为 -1,则该节点不是灯。
如果该 glTF 节点是网格,则 GLTFState 中 GLTFMesh 的索引将描述该网格的属性。如果为 -1,则该节点不是网格。
节点的原名。
GLTFState 中父节点的索引。如果为 -1,则该节点为根节点。
Vector3 position = Vector3(0, 0, 0)
🔗
该 glTF 节点相对于其父节点的位置。
Quaternion rotation = Quaternion(0, 0, 0, 1)
🔗
void set_rotation(value: Quaternion)
Quaternion get_rotation()
该 glTF 节点相对于其父节点的旋转。
Vector3 scale = Vector3(1, 1, 1)
🔗
该 glTF 节点相对于其父节点的缩放。
如果该 glTF 节点具有骨架,则 GLTFState 中的 GLTFSkeleton 的索引将描述骨架的属性。如果为 -1,则该节点没有骨架。
如果该 glTF 节点有皮肤,则 GLTFState 中的 GLTFSkin 的索引将描述皮肤的属性。如果为 -1,则该节点没有皮肤。
Transform3D xform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)
🔗
void set_xform(value: Transform3D)
Transform3D get_xform()
glTF 节点相对于其父节点的变换。由于通常首选位置、旋转和缩放属性,因此不使用该属性。
方法说明
void append_child_index(child_index: int) 🔗
将给定的子节点索引附加到 children 数组。
Variant get_additional_data(extension_name: StringName) 🔗
在这个 GLTFNode 实例中获取额外的任意数据。这可以用来保持 GLTFDocumentExtension 类中每个节点的状态数据,这很重要,因为它们是无状态的。
参数应该是 GLTFDocumentExtension 的名字(不必与 glTF 文件中的扩展名相匹配),而该返回值可以是你设置的任何值。如果没有设置任何值,则返回值为 null
。
NodePath get_scene_node_path(gltf_state: GLTFState, handle_skeletons: bool = true) 🔗
返回该 GLTF 节点导入后在 Godot 场景树中的 NodePath。这在使用 GLTFObjectModelProperty 导入 glTF 对象模型指针时非常有用,可以处理 KHR_animation_pointer
、KHR_interactivity
等扩展。
如果 handle_skeletons
为 true
,则会正确解析骨骼 glTF 节点的路径。例如为 false
时为 ^"A/B/C/Bone1/Bone2/Bone3"
的路径在为 true
时会变成 ^"A/B/C/Skeleton3D:Bone3"
。
void set_additional_data(extension_name: StringName, additional_data: Variant) 🔗
在这个 GLTFNode 实例中设置额外的任意数据。这可以用来保持 GLTFDocumentExtension 类中每个节点的状态数据,这很重要,因为它们是无状态的。
第一个参数应该是 GLTFDocumentExtension 的名字(不必与 glTF 文件中的扩展名相匹配),第二个参数可以是任何你想要的东西。