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...
GLTFState
Eredita: Resource < RefCounted < Object
Ereditato da: FBXState
Rappresenta tutti i dati di un file glTF.
Descrizione
Contiene tutti i nodi e le risorse di un file glTF. Questo è utilizzato da GLTFDocument come archivio dati, che consente a GLTFDocument e a tutte le classi GLTFDocumentExtension di rimanere stateless.
GLTFState può essere popolato da GLTFDocument leggendo un file o convertendo una scena di Godot. Successivamente, è possibile utilizzare i dati per creare una scena di Godot o salvarli in un file glTF. Il codice che converte in/da una scena di Godot può essere intercettato in punti arbitrari dalle classi GLTFDocumentExtension. Ciò consente di memorizzare dati personalizzati nel file glTF o di convertire dati personalizzati in/da nodi di Godot.
Tutorial
Proprietà
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Metodi
Enumerazioni
enum HandleBinaryImageMode: 🔗
HandleBinaryImageMode HANDLE_BINARY_IMAGE_MODE_DISCARD_TEXTURES = 0
When importing a glTF file with embedded binary images, discards all images and uses untextured materials in their place. Images stored as separate files in the res:// folder are not affected by this; those will be used as Godot imported them.
HandleBinaryImageMode HANDLE_BINARY_IMAGE_MODE_EXTRACT_TEXTURES = 1
When importing a glTF file with embedded binary images, extracts them and saves them to their own files. This allows the image to be imported by Godot's image importer, which can then have their import options customized by the user, including optionally compressing the image to VRAM texture formats.
This will save the images's bytes exactly as-is, without recompression. For image formats supplied by glTF extensions, the file will have a filename ending with the file extension supplied by GLTFDocumentExtension._get_image_file_extension() of the extension class.
Note: This option is editor-only. At runtime, this acts the same as HANDLE_BINARY_IMAGE_MODE_EMBED_AS_UNCOMPRESSED.
HandleBinaryImageMode HANDLE_BINARY_IMAGE_MODE_EMBED_AS_BASISU = 2
When importing a glTF file with embedded binary images, embeds textures VRAM compressed with Basis Universal into the generated scene. Images stored as separate files in the res:// folder are not affected by this; those will be used as Godot imported them.
HandleBinaryImageMode HANDLE_BINARY_IMAGE_MODE_EMBED_AS_UNCOMPRESSED = 3
When importing a glTF file with embedded binary images, embeds textures compressed losslessly into the generated scene. Images stored as separate files in the res:// folder are not affected by this; those will be used as Godot imported them.
Costanti
HANDLE_BINARY_DISCARD_TEXTURES = 0 🔗
Deprecato: Use HANDLE_BINARY_IMAGE_MODE_DISCARD_TEXTURES instead.
Scarta tutte le texture incorporate e utilizza materiali senza texture.
HANDLE_BINARY_EXTRACT_TEXTURES = 1 🔗
Deprecato: Use HANDLE_BINARY_IMAGE_MODE_EXTRACT_TEXTURES instead.
Estrae le texture incorporate per essere reimportate e compresse. Solo per l'editor. Si comporta come non compresso in fase di esecuzione.
HANDLE_BINARY_EMBED_AS_BASISU = 2 🔗
Deprecato: Use HANDLE_BINARY_IMAGE_MODE_EMBED_AS_BASISU instead.
Incorpora texture VRAM compresse con Basis Universal nella scena generata.
HANDLE_BINARY_EMBED_AS_UNCOMPRESSED = 3 🔗
Deprecato: Use HANDLE_BINARY_IMAGE_MODE_EMBED_AS_UNCOMPRESSED instead.
Incorpora texture compresse senza perdita di dati nella scena generata, il che corrisponde al comportamento in passato.
Descrizioni delle proprietà
Gli FPS di elaborazione dell'animazione per l'importazione o l'esportazione.
Il percorso della cartella associato a questi dati glTF. Serve per trovare altri file a cui fa riferimento il file glTF, come immagini o buffer binari. Sarà impostato durante l'importazione quando si aggiunge da un file e sarà impostato durante l'esportazione quando si scrive su un file.
Array[PackedByteArray] buffers = [] 🔗
void set_buffers(value: Array[PackedByteArray])
Array[PackedByteArray] get_buffers()
There is currently no description for this property. Please help us by contributing one!
La stringa del copyright nell'intestazione dei contenuti del file glTF. Questa è impostata durante l'importazione se presente e durante l'esportazione se non è vuota. Consulta la documentazione dell'intestazione dei contenuti glTF per ulteriori informazioni.
bool create_animations = true 🔗
There is currently no description for this property. Please help us by contributing one!
Il nome del file associato a questi dati glTF. Se termina con .gltf, questo è un glTF basato su testo, altrimenti è GLB binario. Sarà impostato durante l'importazione quando si aggiunge da un file e durante l'esportazione quando si scrive su un file. Se si scrive su un buffer, sarà una stringa vuota.
PackedByteArray glb_data = PackedByteArray() 🔗
void set_glb_data(value: PackedByteArray)
PackedByteArray get_glb_data()
Il buffer binario allegato a un file .glb.
Note: The returned array is copied and any changes to it will not update the original property value. See PackedByteArray for more details.
HandleBinaryImageMode handle_binary_image_mode = 1 🔗
void set_handle_binary_image_mode(value: HandleBinaryImageMode)
HandleBinaryImageMode get_handle_binary_image_mode()
When importing a glTF file with unimported raw binary images embedded inside of binary blob buffers, in data URIs, or separate files not imported by Godot, this controls how the images are handled. Images can be discarded, saved as separate files, or embedded in the scene lossily or losslessly. See HandleBinaryImageMode for options.
This property does nothing for image files in the res:// folder imported by Godot, as those are handled by Godot's image importer directly, and then the Godot scene generated from the glTF file will use the images as Godot imported them.
bool import_as_skeleton_bones = false 🔗
Se true, forza tutti i GLTFNode nel documento a essere ossa di un singolo nodo Skeleton3D di Godot.
Dictionary json = {} 🔗
void set_json(value: Dictionary)
Dictionary get_json()
Il documento JSON originale non elaborato corrispondente a questo GLTFState.
There is currently no description for this property. Please help us by contributing one!
There is currently no description for this property. Please help us by contributing one!
PackedInt32Array root_nodes = PackedInt32Array() 🔗
void set_root_nodes(value: PackedInt32Array)
PackedInt32Array get_root_nodes()
I nodi radice del file glTF. In genere, un file glTF avrà solo una scena e quindi un solo nodo radice. Tuttavia, un file glTF può avere più scene e quindi più nodi radice, che saranno generati come fratelli l'uno dell'altro e come figli del nodo radice della scena generata di Godot.
Note: The returned array is copied and any changes to it will not update the original property value. See PackedInt32Array for more details.
Il nome della scena. Quando si importa, se non specificato, questo sarà il nome del file. Quando si esporta, se specificato, il nome della scena sarà salvato nel file glTF.
bool use_named_skin_binds = false 🔗
There is currently no description for this property. Please help us by contributing one!
Descrizioni dei metodi
void add_used_extension(extension_name: String, required: bool) 🔗
Aggiunge un'estensione alla lista delle estensioni utilizzate da questo file glTF durante la serializzazione. Se required è true, l'estensione sarà aggiunta anche alla lista delle estensioni obbligatorie. Non eseguirlo in GLTFDocumentExtension._export_post(), poiché durante questa fase è troppo tardi per aggiungere estensioni. La lista finale è ordinata alfabeticamente.
int append_data_to_buffers(data: PackedByteArray, deduplication: bool) 🔗
Aggiunge i dati dell'array di byte specificato ai buffer e crea un GLTFBufferView per esso. Viene restituito l'indice della GLTFBufferView di destinazione. Se deduplication è true, i buffer saranno prima analizzati per dati duplicati, altrimenti saranno sempre aggiunti nuovi byte.
int append_gltf_node(gltf_node: GLTFNode, godot_scene_node: Node, parent_node_index: int) 🔗
Aggiungi il GLTFNode fornito allo stato e restituisci il suo nuovo indice. Questo può essere usato per esportare un nodo di Godot come più nodi glTF o per iniettare nuovi nodi glTF al momento dell'importazione. All'importazione, è necessario chiamare questo metodo prima che GLTFDocumentExtension._generate_scene_node() termini per il nodo padre. All'esportazione, è necessario chiamarlo prima che GLTFDocumentExtension._export_node() sia eseguito per il nodo padre.
Il parametro godot_scene_node è il nodo di scena di Godot che corrisponde a questo nodo glTF. Si consiglia vivamente di impostarlo su un nodo valido, ma potrebbe essere null se non esiste un nodo di scena di Godot corrispondente. Un nodo di scena di Godot può essere usato per più nodi glTF, quindi se si esportano più nodi glTF per un nodo di scena di Godot, usa lo stesso nodo di scena di Godot per ciascuno.
Il parametro parent_node_index è l'indice del GLTFNode padre nello stato. Se -1, il nodo sarà un nodo radice, altrimenti il nuovo nodo verrà aggiunto alla lista dei figli del padre. L'indice verrà anche scritto nella proprietà GLTFNode.parent del nuovo nodo.
Array[GLTFAccessor] get_accessors() const 🔗
There is currently no description for this method. Please help us by contributing one!
Variant get_additional_data(extension_name: StringName) const 🔗
Ottiene ulteriori dati arbitrari in questa istanza GLTFState. Può essere utilizzato per mantenere i dati di stato per ogni file nelle classi GLTFDocumentExtension, il che è importante perché sono stateless.
L'argomento dovrebbe essere il nome del 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.
AnimationPlayer get_animation_player(anim_player_index: int) const 🔗
Restituisce il nodo AnimationPlayer con l'indice specificato. Questi nodi sono utilizzati solo durante il processo di esportazione quando si convertono i nodi AnimationPlayer di Godot in animazioni glTF.
int get_animation_players_count(anim_player_index: int) const 🔗
Restituisce il numero di nodi AnimationPlayer in questo GLTFState. Questi nodi sono utilizzati solo durante il processo di esportazione quando si convertono i nodi AnimationPlayer di Godot in animazioni glTF.
Array[GLTFAnimation] get_animations() const 🔗
Restituisce un array di tutti i GLTFAnimation nel file glTF. Durante l'importazione, questi saranno generati come animazioni in un nodo AnimationPlayer. Durante l'esportazione, questi saranno generati dai nodi AnimationPlayer di Godot.
Array[GLTFBufferView] get_buffer_views() const 🔗
There is currently no description for this method. Please help us by contributing one!
Array[GLTFCamera] get_cameras() const 🔗
Restituisce un array di tutte le GLTFCamera nel file glTF. Queste sono le telecamere a cui fa riferimento l'indice GLTFNode.camera.
int get_handle_binary_image() const 🔗
Deprecato: Use handle_binary_image_mode instead.
Deprecated untyped alias for handle_binary_image_mode. When importing a glTF file with unimported raw binary images embedded inside of binary blob buffers, in data URIs, or separate files not imported by Godot, this controls how the images are handled.
Array[Texture2D] get_images() const 🔗
Ottiene le immagini del file glTF come un array di Texture2D. Queste sono le immagini a cui fa riferimento l'indice GLTFTexture.src_image.
Array[GLTFLight] get_lights() const 🔗
Restituisce un array di tutte le GLTFLight nel file glTF. Queste sono le luci a cui fa riferimento l'indice GLTFNode.light.
Array[Material] get_materials() const 🔗
There is currently no description for this method. Please help us by contributing one!
Array[GLTFMesh] get_meshes() const 🔗
Restituisce un array di tutte le GLTFMesh nel file glTF. Queste sono le mesh a cui fa riferimento l'indice GLTFNode.mesh.
int get_node_index(scene_node: Node) const 🔗
Restituisce l'indice del GLTFNode corrispondente a questo nodo di scena di Godot. Questo è l'inverso di get_scene_node(). Utile durante il processo di esportazione.
Nota: Non tutti i nodi di scena di Godot avranno un GLTFNode corrispondente e non tutti i GLTFNode avranno un nodo di scena generato. Se non c'è un indice GLTFNode per questo nodo di scena, viene restituito -1.
Array[GLTFNode] get_nodes() const 🔗
Restituisce un array di tutti i GLTFNode nel file glTF. Questi sono i nodi a cui fanno riferimento GLTFNode.children e root_nodes. Ciò include i nodi che potrebbero non essere generati nella scena di Godot o i nodi che potrebbero generare più nodi di scena di Godot.
Node get_scene_node(gltf_node_index: int) const 🔗
Restituisce il nodo di scena di Godot che corrisponde allo stesso indice del GLTFNode da cui è stato generato. Questo è l'inverso di get_node_index(). Utile durante il processo di importazione.
Nota: Non tutti i GLTFNode avranno un nodo di scena generato e non tutti i nodi di scena generati avranno un GLTFNode corrispondente. Se non c'è alcun nodo di scena per questo indice di GLTFNode, viene restituito null.
Array[GLTFSkeleton] get_skeletons() const 🔗
Restituisce un array di tutti i GLTFSkeleton nel file glTF. Questi sono gli scheletri a cui fa riferimento l'indice GLTFNode.skeleton.
Array[GLTFSkin] get_skins() const 🔗
Restituisce un array di tutte le GLTFSkin nel file glTF. Queste sono le skin a cui fa riferimento l'indice GLTFNode.skin.
Array[GLTFTextureSampler] get_texture_samplers() const 🔗
Recupera l'array dei campionatori di texture utilizzati dalle texture contenute nel glTF.
Array[GLTFTexture] get_textures() const 🔗
There is currently no description for this method. Please help us by contributing one!
Array[String] get_unique_animation_names() const 🔗
Restituisce un array di nomi univoci di animazione. È utilizzato solo durante il processo di importazione.
Array[String] get_unique_names() const 🔗
Restituisce un array di nomi univoci di nodi. È utilizzato sia nel processo di importazione sia in quello di esportazione.
void set_accessors(accessors: Array[GLTFAccessor]) 🔗
There is currently no description for this method. Please help us by contributing one!
void set_additional_data(extension_name: StringName, additional_data: Variant) 🔗
Imposta ulteriori dati arbitrari in questa istanza GLTFState. Può essere utilizzato per mantenere i dati di stato per ogni file nelle classi GLTFDocumentExtension, il che è importante perché sono stateless.
Il primo argomento dovrebbe essere il nome del GLTFDocumentExtension (non deve corrispondere al nome dell'estensione nel file glTF) e il secondo argomento può essere qualsiasi cosa tu voglia.
void set_animations(animations: Array[GLTFAnimation]) 🔗
Imposta le GLTFAnimation nello stato. Durante l'importazione, queste saranno generate come animazioni in un nodo AnimationPlayer. Durante l'esportazione, queste saranno generate dai nodi AnimationPlayer di Godot.
void set_buffer_views(buffer_views: Array[GLTFBufferView]) 🔗
There is currently no description for this method. Please help us by contributing one!
void set_cameras(cameras: Array[GLTFCamera]) 🔗
Imposta le GLTFCamera nello stato. Queste sono le telecamere a cui fa riferimento l'indice GLTFNode.camera.
void set_handle_binary_image(method: int) 🔗
Deprecato: Use handle_binary_image_mode instead.
Deprecated untyped alias for handle_binary_image_mode. When importing a glTF file with unimported raw binary images embedded inside of binary blob buffers, in data URIs, or separate files not imported by Godot, this controls how the images are handled.
void set_images(images: Array[Texture2D]) 🔗
Imposta le immagini nello stato memorizzato come un array di Texture2D. Può essere utilizzato durante l'esportazione. Queste sono le immagini a cui fa riferimento l'indice GLTFTexture.src_image.
void set_lights(lights: Array[GLTFLight]) 🔗
Imposta i GLTFLight nello stato. Queste sono le luci a cui fa riferimento l'indice GLTFNode.light.
void set_materials(materials: Array[Material]) 🔗
There is currently no description for this method. Please help us by contributing one!
void set_meshes(meshes: Array[GLTFMesh]) 🔗
Imposta le GLTFMesh nello stato. Queste sono le mesh a cui fa riferimento l'indice GLTFNode.mesh.
void set_nodes(nodes: Array[GLTFNode]) 🔗
Imposta i GLTFNode nello stato. Questi sono i nodi a cui fanno riferimento GLTFNode.children e root_nodes. Alcuni dei nodi impostati qui potrebbero non essere generati nella scena di Godot o potrebbero generare più nodi di scena di Godot.
void set_skeletons(skeletons: Array[GLTFSkeleton]) 🔗
Imposta i GLTFSkeleton nello stato. Questi sono gli scheletri a cui fa riferimento l'indice GLTFNode.skeleton.
void set_skins(skins: Array[GLTFSkin]) 🔗
Imposta le GLTFSkin nello stato. Queste sono le skin a cui fa riferimento l'indice GLTFNode.skin.
void set_texture_samplers(texture_samplers: Array[GLTFTextureSampler]) 🔗
Imposta l'array dei campionatori di texture utilizzati dalle texture contenute nel glTF.
void set_textures(textures: Array[GLTFTexture]) 🔗
There is currently no description for this method. Please help us by contributing one!
void set_unique_animation_names(unique_animation_names: Array[String]) 🔗
Imposta i nomi univoci delle animazioni nello stato. È utilizzato solo durante il processo di importazione.
void set_unique_names(unique_names: Array[String]) 🔗
Imposta i nomi univoci dei nodi nello stato. È utilizzato sia nel processo di importazione sia in quello di esportazione.