mirror of
https://github.com/godotengine/godot-docs-l10n.git
synced 2025-12-31 09:49:22 +03:00
399 lines
20 KiB
ReStructuredText
399 lines
20 KiB
ReStructuredText
:github_url: hide
|
|
|
|
.. _class_GLTFNode:
|
|
|
|
GLTFNode
|
|
========
|
|
|
|
**Eredita:** :ref:`Resource<class_Resource>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
|
|
|
|
Classe per un nodo glTF.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Descrizione
|
|
----------------------
|
|
|
|
Rappresenta un nodo glTF. I nodi glTF possono avere nomi, trasformazioni, figli (altri nodi glTF) e proprietà più specializzate (rappresentate dalle proprie classi).
|
|
|
|
I nodi glTF in genere esistono all'interno di :ref:`GLTFState<class_GLTFState>` che rappresenta tutti i dati di un file glTF. La maggior parte delle proprietà di glTFNode sono indici di altri dati nel file glTF. È possibile estendere un nodo glTF con proprietà aggiuntive tramite :ref:`get_additional_data()<class_GLTFNode_method_get_additional_data>` e :ref:`set_additional_data()<class_GLTFNode_method_set_additional_data>`.
|
|
|
|
.. rst-class:: classref-introduction-group
|
|
|
|
Tutorial
|
|
----------------
|
|
|
|
- :doc:`Caricamento e salvataggio di file a tempo di esecuzione <../tutorials/io/runtime_file_loading_and_saving>`
|
|
|
|
- `Specifiche di scene e nodi glTF <https://github.com/KhronosGroup/glTF-Tutorials/blob/master/gltfTutorial/gltfTutorial_004_ScenesNodes.md">`__
|
|
|
|
.. rst-class:: classref-reftable-group
|
|
|
|
Proprietà
|
|
------------------
|
|
|
|
.. 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:`String<class_String>` | :ref:`original_name<class_GLTFNode_property_original_name>` | ``""`` |
|
|
+-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
|
|
| :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:`bool<class_bool>` | :ref:`visible<class_GLTFNode_property_visible>` | ``true`` |
|
|
+-------------------------------------------------+-------------------------------------------------------------+-----------------------------------------------------+
|
|
| :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
|
|
|
|
Metodi
|
|
------------
|
|
|
|
.. table::
|
|
:widths: auto
|
|
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`append_child_index<class_GLTFNode_method_append_child_index>`\ (\ child_index\: :ref:`int<class_int>`\ ) |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`Variant<class_Variant>` | :ref:`get_additional_data<class_GLTFNode_method_get_additional_data>`\ (\ extension_name\: :ref:`StringName<class_StringName>`\ ) |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| :ref:`NodePath<class_NodePath>` | :ref:`get_scene_node_path<class_GLTFNode_method_get_scene_node_path>`\ (\ gltf_state\: :ref:`GLTFState<class_GLTFState>`, handle_skeletons\: :ref:`bool<class_bool>` = true\ ) |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
| |void| | :ref:`set_additional_data<class_GLTFNode_method_set_additional_data>`\ (\ extension_name\: :ref:`StringName<class_StringName>`, additional_data\: :ref:`Variant<class_Variant>`\ ) |
|
|
+---------------------------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Descrizioni delle proprietà
|
|
------------------------------------------------------
|
|
|
|
.. _class_GLTFNode_property_camera:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **camera** = ``-1`` :ref:`🔗<class_GLTFNode_property_camera>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_camera**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_camera**\ (\ )
|
|
|
|
Se questo nodo glTF è una telecamera, l'indice della :ref:`GLTFCamera<class_GLTFCamera>` nel :ref:`GLTFState<class_GLTFState>` che descrive le proprietà della telecamera. Se ``-1``, questo nodo non è una telecamera.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFNode_property_children:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`PackedInt32Array<class_PackedInt32Array>` **children** = ``PackedInt32Array()`` :ref:`🔗<class_GLTFNode_property_children>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_children**\ (\ value\: :ref:`PackedInt32Array<class_PackedInt32Array>`\ )
|
|
- :ref:`PackedInt32Array<class_PackedInt32Array>` **get_children**\ (\ )
|
|
|
|
Gli indici dei nodi figlio nel :ref:`GLTFState<class_GLTFState>`. Se questo nodo glTF non ha figli, questo sarà un array vuoto.
|
|
|
|
**Note:** The returned array is *copied* and any changes to it will not update the original property value. See :ref:`PackedInt32Array<class_PackedInt32Array>` for more details.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFNode_property_height:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **height** = ``-1`` :ref:`🔗<class_GLTFNode_property_height>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_height**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_height**\ (\ )
|
|
|
|
La profondità di questo nodo nella gerarchia dei nodi. Un nodo radice avrà un'altezza di 0, i suoi figli avranno un'altezza di 1 e così via. Se -1, l'altezza non è stata calcolata.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFNode_property_light:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **light** = ``-1`` :ref:`🔗<class_GLTFNode_property_light>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_light**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_light**\ (\ )
|
|
|
|
Se questo nodo glTF è una luce, l'indice della :ref:`GLTFLight<class_GLTFLight>` nel :ref:`GLTFState<class_GLTFState>` che descrive le proprietà della luce. Se -1, questo nodo non è una luce.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFNode_property_mesh:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **mesh** = ``-1`` :ref:`🔗<class_GLTFNode_property_mesh>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_mesh**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_mesh**\ (\ )
|
|
|
|
Se questo nodo glTF è una mesh, l'indice della :ref:`GLTFMesh<class_GLTFMesh>` nel :ref:`GLTFState<class_GLTFState>` che descrive le proprietà della mesh. Se -1, questo nodo non è una mesh.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFNode_property_original_name:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`String<class_String>` **original_name** = ``""`` :ref:`🔗<class_GLTFNode_property_original_name>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_original_name**\ (\ value\: :ref:`String<class_String>`\ )
|
|
- :ref:`String<class_String>` **get_original_name**\ (\ )
|
|
|
|
Il nome originale del nodo.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFNode_property_parent:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **parent** = ``-1`` :ref:`🔗<class_GLTFNode_property_parent>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_parent**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_parent**\ (\ )
|
|
|
|
L'indice del nodo padre nel :ref:`GLTFState<class_GLTFState>`. Se -1, questo nodo è un nodo radice.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFNode_property_position:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Vector3<class_Vector3>` **position** = ``Vector3(0, 0, 0)`` :ref:`🔗<class_GLTFNode_property_position>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_position**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
|
|
- :ref:`Vector3<class_Vector3>` **get_position**\ (\ )
|
|
|
|
La posizione del nodo glTF rispetto al suo genitore.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFNode_property_rotation:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Quaternion<class_Quaternion>` **rotation** = ``Quaternion(0, 0, 0, 1)`` :ref:`🔗<class_GLTFNode_property_rotation>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_rotation**\ (\ value\: :ref:`Quaternion<class_Quaternion>`\ )
|
|
- :ref:`Quaternion<class_Quaternion>` **get_rotation**\ (\ )
|
|
|
|
La rotazione del nodo glTF rispetto al suo genitore.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFNode_property_scale:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`Vector3<class_Vector3>` **scale** = ``Vector3(1, 1, 1)`` :ref:`🔗<class_GLTFNode_property_scale>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_scale**\ (\ value\: :ref:`Vector3<class_Vector3>`\ )
|
|
- :ref:`Vector3<class_Vector3>` **get_scale**\ (\ )
|
|
|
|
La scala del nodo glTF rispetto al suo genitore.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFNode_property_skeleton:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **skeleton** = ``-1`` :ref:`🔗<class_GLTFNode_property_skeleton>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_skeleton**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_skeleton**\ (\ )
|
|
|
|
Se questo nodo glTF ha uno scheletro, l'indice dello :ref:`GLTFSkeleton<class_GLTFSkeleton>` nel :ref:`GLTFState<class_GLTFState>` che descrive le proprietà dello scheletro. Se -1, questo nodo non ha uno scheletro.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFNode_property_skin:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`int<class_int>` **skin** = ``-1`` :ref:`🔗<class_GLTFNode_property_skin>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_skin**\ (\ value\: :ref:`int<class_int>`\ )
|
|
- :ref:`int<class_int>` **get_skin**\ (\ )
|
|
|
|
Se questo nodo glTF ha una skin, l'indice della :ref:`GLTFSkin<class_GLTFSkin>` nel :ref:`GLTFState<class_GLTFState>` che descrive le proprietà della skin. Se -1, questo nodo non ha una skin.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFNode_property_visible:
|
|
|
|
.. rst-class:: classref-property
|
|
|
|
:ref:`bool<class_bool>` **visible** = ``true`` :ref:`🔗<class_GLTFNode_property_visible>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_visible**\ (\ value\: :ref:`bool<class_bool>`\ )
|
|
- :ref:`bool<class_bool>` **get_visible**\ (\ )
|
|
|
|
If ``true``, the GLTF node is visible. If ``false``, the GLTF node is not visible. This is converted to the :ref:`Node3D.visible<class_Node3D_property_visible>` property in the Godot scene, and is exported to ``KHR_node_visibility`` when ``false``.
|
|
|
|
.. 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)`` :ref:`🔗<class_GLTFNode_property_xform>`
|
|
|
|
.. rst-class:: classref-property-setget
|
|
|
|
- |void| **set_xform**\ (\ value\: :ref:`Transform3D<class_Transform3D>`\ )
|
|
- :ref:`Transform3D<class_Transform3D>` **get_xform**\ (\ )
|
|
|
|
La trasformazione del nodo glTF rispetto al suo genitore. Questa proprietà è solitamente inutilizzata poiché sono preferite le proprietà di posizione, rotazione e scala.
|
|
|
|
.. rst-class:: classref-section-separator
|
|
|
|
----
|
|
|
|
.. rst-class:: classref-descriptions-group
|
|
|
|
Descrizioni dei metodi
|
|
--------------------------------------------
|
|
|
|
.. _class_GLTFNode_method_append_child_index:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **append_child_index**\ (\ child_index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_GLTFNode_method_append_child_index>`
|
|
|
|
Accoda l'indice del nodo figlio specificato all'array :ref:`children<class_GLTFNode_property_children>`.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFNode_method_get_additional_data:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`Variant<class_Variant>` **get_additional_data**\ (\ extension_name\: :ref:`StringName<class_StringName>`\ ) :ref:`🔗<class_GLTFNode_method_get_additional_data>`
|
|
|
|
Ottiene ulteriori dati arbitrari in questa istanza **GLTFNode**. Può essere utilizzato per mantenere i dati di stato per ogni nodo nelle classi :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>`, il che è importante perché sono stateless.
|
|
|
|
L'argomento dovrebbe essere il nome del :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>` (non deve corrispondere al nome dell'estensione nel file glTF) e il valore restituito può essere qualsiasi cosa tu imposti. Se niente è stato impostato, il valore restituito è ``null``.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFNode_method_get_scene_node_path:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
:ref:`NodePath<class_NodePath>` **get_scene_node_path**\ (\ gltf_state\: :ref:`GLTFState<class_GLTFState>`, handle_skeletons\: :ref:`bool<class_bool>` = true\ ) :ref:`🔗<class_GLTFNode_method_get_scene_node_path>`
|
|
|
|
Restituisce il :ref:`NodePath<class_NodePath>` che questo nodo GLTF avrà nell'albero di scene di Godot dopo essere stato importato. Ciò è utile quando si importano puntatori al modello d'oggetto glTF con :ref:`GLTFObjectModelProperty<class_GLTFObjectModelProperty>`, per gestire estensioni come ``KHR_animation_pointer`` o ``KHR_interactivity``.
|
|
|
|
Se ``handle_skeletons`` è ``true``, i percorsi verso i nodi glTF delle ossa di uno scheletro verranno risolti correttamente. Ad esempio, un percorso che sarebbe ``^"A/B/C/Bone1/Bone2/Bone3"`` se ``false`` diventerà ``^"A/B/C/Skeleton3D:Bone3"``.
|
|
|
|
.. rst-class:: classref-item-separator
|
|
|
|
----
|
|
|
|
.. _class_GLTFNode_method_set_additional_data:
|
|
|
|
.. rst-class:: classref-method
|
|
|
|
|void| **set_additional_data**\ (\ extension_name\: :ref:`StringName<class_StringName>`, additional_data\: :ref:`Variant<class_Variant>`\ ) :ref:`🔗<class_GLTFNode_method_set_additional_data>`
|
|
|
|
Imposta ulteriori dati arbitrari in questa istanza **GLTFNode**. Può essere utilizzato per mantenere i dati di stato per ogni nodo nelle classi :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>`, il che è importante perché sono stateless.
|
|
|
|
Il primo argomento dovrebbe essere il nome del :ref:`GLTFDocumentExtension<class_GLTFDocumentExtension>` (non deve corrispondere al nome dell'estensione nel file glTF) e il secondo argomento può essere qualsiasi cosa tu voglia.
|
|
|
|
.. |virtual| replace:: :abbr:`virtual (Questo metodo dovrebbe solitamente essere sovrascritto dall'utente per aver un effetto.)`
|
|
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
|
|
.. |const| replace:: :abbr:`const (Questo metodo non ha effetti collaterali. Non modifica alcuna variabile appartenente all'istanza.)`
|
|
.. |vararg| replace:: :abbr:`vararg (Questo metodo accetta qualsiasi numero di argomenti oltre a quelli descritti qui.)`
|
|
.. |constructor| replace:: :abbr:`constructor (Questo metodo è utilizzato per creare un tipo.)`
|
|
.. |static| replace:: :abbr:`static (Questo metodo non necessita di alcun'istanza per essere chiamato, quindi può essere chiamato direttamente usando il nome della classe.)`
|
|
.. |operator| replace:: :abbr:`operator (Questo metodo descrive un operatore valido da usare con questo tipo come operando di sinistra.)`
|
|
.. |bitfield| replace:: :abbr:`BitField (Questo valore è un intero composto da una maschera di bit dei seguenti flag.)`
|
|
.. |void| replace:: :abbr:`void (Nessun valore restituito.)`
|