GLTFNode¶
继承: Resource < RefCounted < Object
glTF 节点类。
描述¶
表示glTF节点。glTF节点可以具有名称、转换、子节点(其他glTF结点)和更专门的属性(由它们自己的类表示)。
glTF节点通常存在于GLTFState中,该文件表示glTF文件的所有数据。GLTFNode的大多数属性是glTF文件中其他数据的索引。通过使用get_additional_data()和set_additional_data()。
属性¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
方法¶
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 节点没有子节点,则这将是一个空数组。
注意:返回的数组为 副本,对其进行的任何修改均不会影响原始属性值。详见 PackedInt32Array。
该节点在节点层次结构中的深度。根节点的高度为 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。
ItemPath get_scene_node_path(gltf_state: GLTFState, handle_skeletons: bool = true) 🔗
返回此GLTF节点在导入i3D场景树后将拥有的 ItemPath 路径。该功能在使用 GLTFObjectModelProperty 导入glTF对象模型指针时特别有用,可用于处理 KHR_animation_pointer 或 KHR_interactivity 等扩展。
若 handle_skeletons 参数为 true ,将正确解析骨骼节点的路径。例如:当设为 false 时返回 ^"A/B/C/Bone1/Bone2/Bone3" 的路径,设为 true 后会转换为 ^"A/B/C/SkeletonMesh:Bone3" 格式。
void set_additional_data(extension_name: StringName, additional_data: Variant) 🔗
在此 GLTFNode 实例中设置附加自定义数据。该功能可用于在无状态的 GLTFDocumentExtension 扩展类中维护每个节点的状态数据(此功能非常重要,因为这些扩展类本身是无状态的)。
第一个参数应为 GLTFDocumentExtension 扩展类名称(无需与glTF文件中的扩展名匹配),第二个参数可以是您需要的任何数据。