Files
godot-docs-l10n/classes/zh_CN/class_gltfnode.rst

332 lines
14 KiB
ReStructuredText
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/4.2/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/4.2/modules/gltf/doc_classes/GLTFNode.xml.
.. _class_GLTFNode:
GLTFNode
========
**继承:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
GLTF 节点类。
.. rst-class:: classref-introduction-group
描述
----
代表 GLTF 节点。GLTF 节点中可以包含名称、变换、子节点GLTF 节点)以及其他专门的属性(由各自不同的类表示)。
GLTF 节点通常存在于表示 GLTF 文件中的所有数据的 :ref:`GLTFState<class_GLTFState>` 内部。大多数 GLTFNode 的属性都是 GLTF 文件中其他数据的索引。你可以使用 :ref:`get_additional_data<class_GLTFNode_method_get_additional_data>`:ref:`set_additional_data<class_GLTFNode_method_set_additional_data>` 来添加额外的属性,扩展 GLTF 节点。
.. rst-class:: classref-introduction-group
教程
----
- :doc:`运行时文件加载与保存 <../tutorials/io/runtime_file_loading_and_saving>`
- `GLTF 场景和节点规格 <https://github.com/KhronosGroup/glTF-Tutorials/blob/master/gltfTutorial/gltfTutorial_004_ScenesNodes.md">`__
.. rst-class:: classref-reftable-group
属性
----
.. table::
:widths: auto
+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :ref:`int<class_int>` | :ref:`camera<class_GLTFNode_property_camera>` | ``-1`` |
+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :ref:`PackedInt32Array<class_PackedInt32Array>` | :ref:`children<class_GLTFNode_property_children>` | ``PackedInt32Array()`` |
+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :ref:`int<class_int>` | :ref:`height<class_GLTFNode_property_height>` | ``-1`` |
+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :ref:`int<class_int>` | :ref:`light<class_GLTFNode_property_light>` | ``-1`` |
+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :ref:`int<class_int>` | :ref:`mesh<class_GLTFNode_property_mesh>` | ``-1`` |
+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :ref:`int<class_int>` | :ref:`parent<class_GLTFNode_property_parent>` | ``-1`` |
+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`position<class_GLTFNode_property_position>` | ``Vector3(0, 0, 0)`` |
+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :ref:`Quaternion<class_Quaternion>` | :ref:`rotation<class_GLTFNode_property_rotation>` | ``Quaternion(0, 0, 0, 1)`` |
+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :ref:`Vector3<class_Vector3>` | :ref:`scale<class_GLTFNode_property_scale>` | ``Vector3(1, 1, 1)`` |
+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :ref:`int<class_int>` | :ref:`skeleton<class_GLTFNode_property_skeleton>` | ``-1`` |
+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :ref:`int<class_int>` | :ref:`skin<class_GLTFNode_property_skin>` | ``-1`` |
+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
| :ref:`Transform3D<class_Transform3D>` | :ref:`xform<class_GLTFNode_property_xform>` | ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)`` |
+-------------------------------------------------+---------------------------------------------------+-----------------------------------------------------+
.. rst-class:: classref-reftable-group
方法
----
.. table::
:widths: auto
+-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Variant<class_Variant>` | :ref:`get_additional_data<class_GLTFNode_method_get_additional_data>` **(** :ref:`StringName<class_StringName>` extension_name **)** |
+-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`set_additional_data<class_GLTFNode_method_set_additional_data>` **(** :ref:`StringName<class_StringName>` extension_name, :ref:`Variant<class_Variant>` additional_data **)** |
+-------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
属性说明
--------
.. _class_GLTFNode_property_camera:
.. rst-class:: classref-property
:ref:`int<class_int>` **camera** = ``-1``
.. rst-class:: classref-property-setget
- void **set_camera** **(** :ref:`int<class_int>` value **)**
- :ref:`int<class_int>` **get_camera** **(** **)**
如果该 GLTF 节点是一个相机,则 :ref:`GLTFState<class_GLTFState>`:ref:`GLTFCamera<class_GLTFCamera>` 的索引将描述该相机的属性。如果为 -1则该节点不是相机。
.. rst-class:: classref-item-separator
----
.. _class_GLTFNode_property_children:
.. rst-class:: classref-property
:ref:`PackedInt32Array<class_PackedInt32Array>` **children** = ``PackedInt32Array()``
.. rst-class:: classref-property-setget
- void **set_children** **(** :ref:`PackedInt32Array<class_PackedInt32Array>` value **)**
- :ref:`PackedInt32Array<class_PackedInt32Array>` **get_children** **(** **)**
:ref:`GLTFState<class_GLTFState>` 中子节点的索引。如果该 GLTF 节点没有子节点,则这将是一个空数组。
.. rst-class:: classref-item-separator
----
.. _class_GLTFNode_property_height:
.. rst-class:: classref-property
:ref:`int<class_int>` **height** = ``-1``
.. rst-class:: classref-property-setget
- void **set_height** **(** :ref:`int<class_int>` value **)**
- :ref:`int<class_int>` **get_height** **(** **)**
该节点在节点层次结构中的深度。根节点的高度为 0其子节点的高度为 1依此类推。如果为 -1则尚未计算高度。
.. rst-class:: classref-item-separator
----
.. _class_GLTFNode_property_light:
.. rst-class:: classref-property
:ref:`int<class_int>` **light** = ``-1``
.. rst-class:: classref-property-setget
- void **set_light** **(** :ref:`int<class_int>` value **)**
- :ref:`int<class_int>` **get_light** **(** **)**
如果该 GLTF 节点是一盏灯,则 :ref:`GLTFState<class_GLTFState>`:ref:`GLTFLight<class_GLTFLight>` 的索引将描述该灯的属性。如果为 -1则该节点不是灯。
.. rst-class:: classref-item-separator
----
.. _class_GLTFNode_property_mesh:
.. rst-class:: classref-property
:ref:`int<class_int>` **mesh** = ``-1``
.. rst-class:: classref-property-setget
- void **set_mesh** **(** :ref:`int<class_int>` value **)**
- :ref:`int<class_int>` **get_mesh** **(** **)**
如果该 GLTF 节点是网格,则 :ref:`GLTFState<class_GLTFState>`:ref:`GLTFMesh<class_GLTFMesh>` 的索引将描述该网格的属性。如果为 -1则该节点不是网格。
.. rst-class:: classref-item-separator
----
.. _class_GLTFNode_property_parent:
.. rst-class:: classref-property
:ref:`int<class_int>` **parent** = ``-1``
.. rst-class:: classref-property-setget
- void **set_parent** **(** :ref:`int<class_int>` value **)**
- :ref:`int<class_int>` **get_parent** **(** **)**
:ref:`GLTFState<class_GLTFState>` 中父节点的索引。如果为 -1则该节点为根节点。
.. rst-class:: classref-item-separator
----
.. _class_GLTFNode_property_position:
.. rst-class:: classref-property
:ref:`Vector3<class_Vector3>` **position** = ``Vector3(0, 0, 0)``
.. rst-class:: classref-property-setget
- void **set_position** **(** :ref:`Vector3<class_Vector3>` value **)**
- :ref:`Vector3<class_Vector3>` **get_position** **(** **)**
该 GLTF 节点相对于其父节点的位置。
.. rst-class:: classref-item-separator
----
.. _class_GLTFNode_property_rotation:
.. rst-class:: classref-property
:ref:`Quaternion<class_Quaternion>` **rotation** = ``Quaternion(0, 0, 0, 1)``
.. rst-class:: classref-property-setget
- void **set_rotation** **(** :ref:`Quaternion<class_Quaternion>` value **)**
- :ref:`Quaternion<class_Quaternion>` **get_rotation** **(** **)**
该 GLTF 节点相对于其父节点的旋转。
.. rst-class:: classref-item-separator
----
.. _class_GLTFNode_property_scale:
.. rst-class:: classref-property
:ref:`Vector3<class_Vector3>` **scale** = ``Vector3(1, 1, 1)``
.. rst-class:: classref-property-setget
- void **set_scale** **(** :ref:`Vector3<class_Vector3>` value **)**
- :ref:`Vector3<class_Vector3>` **get_scale** **(** **)**
该 GLTF 节点相对于其父节点的缩放。
.. rst-class:: classref-item-separator
----
.. _class_GLTFNode_property_skeleton:
.. rst-class:: classref-property
:ref:`int<class_int>` **skeleton** = ``-1``
.. rst-class:: classref-property-setget
- void **set_skeleton** **(** :ref:`int<class_int>` value **)**
- :ref:`int<class_int>` **get_skeleton** **(** **)**
如果该 GLTF 节点具有骨架,则 :ref:`GLTFState<class_GLTFState>` 中的 :ref:`GLTFSkeleton<class_GLTFSkeleton>` 的索引将描述骨架的属性。如果为 -1则该节点没有骨架。
.. rst-class:: classref-item-separator
----
.. _class_GLTFNode_property_skin:
.. rst-class:: classref-property
:ref:`int<class_int>` **skin** = ``-1``
.. rst-class:: classref-property-setget
- void **set_skin** **(** :ref:`int<class_int>` value **)**
- :ref:`int<class_int>` **get_skin** **(** **)**
如果该 GLTF 节点有皮肤,则 :ref:`GLTFState<class_GLTFState>` 中的 :ref:`GLTFSkin<class_GLTFSkin>` 的索引将描述皮肤的属性。如果为 -1则该节点没有皮肤。
.. rst-class:: classref-item-separator
----
.. _class_GLTFNode_property_xform:
.. rst-class:: classref-property
:ref:`Transform3D<class_Transform3D>` **xform** = ``Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)``
.. rst-class:: classref-property-setget
- void **set_xform** **(** :ref:`Transform3D<class_Transform3D>` value **)**
- :ref:`Transform3D<class_Transform3D>` **get_xform** **(** **)**
GLTF 节点相对于其父节点的变换。由于通常首选位置、旋转和缩放属性,因此不使用该属性。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
方法说明
--------
.. _class_GLTFNode_method_get_additional_data:
.. rst-class:: classref-method
:ref:`Variant<class_Variant>` **get_additional_data** **(** :ref:`StringName<class_StringName>` extension_name **)**
在这个 **GLTFNode** 实例中获取额外的任意数据。这可以用来保持 :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>` 类中每个节点的状态数据,这很重要,因为它们是无状态的。
参数应该是 :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>` 的名字(不必与 GLTF 文件中的扩展名相匹配),而该返回值可以是你设置的任何值。如果没有设置任何值,则返回值为 null。
.. rst-class:: classref-item-separator
----
.. _class_GLTFNode_method_set_additional_data:
.. rst-class:: classref-method
void **set_additional_data** **(** :ref:`StringName<class_StringName>` extension_name, :ref:`Variant<class_Variant>` additional_data **)**
在这个 **GLTFNode** 实例中设置额外的任意数据。这可以用来保持 :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>` 类中每个节点的状态数据,这很重要,因为它们是无状态的。
第一个参数应该是 :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>` 的名字(不必与 GLTF 文件中的扩展名相匹配),第二个参数可以是任何你想要的东西。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |const| replace:: :abbr:`const (本方法没有副作用。不会修改该实例的任何成员变量。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了在此处描述的参数外,还能够继续接受任意数量的参数。)`
.. |constructor| replace:: :abbr:`constructor (本方法用于构造某个类型。)`
.. |static| replace:: :abbr:`static (调用本方法无需实例,所以可以直接使用类名调用。)`
.. |operator| replace:: :abbr:`operator (本方法描述的是使用本类型作为左操作数的有效操作符。)`
.. |bitfield| replace:: :abbr:`BitField (这个值是由下列标志构成的位掩码整数。)`