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
Costanti
HANDLE_BINARY_DISCARD_TEXTURES = 0 🔗
Scarta tutte le texture incorporate e utilizza materiali senza texture.
HANDLE_BINARY_EXTRACT_TEXTURES = 1 🔗
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 🔗
Incorpora texture VRAM compresse con Basis Universal nella scena generata.
HANDLE_BINARY_EMBED_AS_UNCOMPRESSED = 3 🔗
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.
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) 🔗
Appends the given byte array data to the buffers and creates a GLTFBufferView for it. The index of the destination GLTFBufferView is returned. If deduplication is true, the buffers are first searched for duplicate data, otherwise new bytes are always appended.
int append_gltf_node(gltf_node: GLTFNode, godot_scene_node: Node, parent_node_index: int) 🔗
Appends the given GLTFNode to the state, and returns its new index. This can be used to export one Godot node as multiple glTF nodes, or inject new glTF nodes at import time. On import, this must be called before GLTFDocumentExtension._generate_scene_node() finishes for the parent node. On export, this must be called before GLTFDocumentExtension._export_node() runs for the parent node.
The godot_scene_node parameter is the Godot scene node that corresponds to this glTF node. This is highly recommended to be set to a valid node, but may be null if there is no corresponding Godot scene node. One Godot scene node may be used for multiple glTF nodes, so if exporting multiple glTF nodes for one Godot scene node, use the same Godot scene node for each.
The parent_node_index parameter is the index of the parent GLTFNode in the state. If -1, the node will be a root node, otherwise the new node will be added to the parent's list of children. The index will also be written to the GLTFNode.parent property of the new node.
Array[GLTFAccessor] get_accessors() 🔗
There is currently no description for this method. Please help us by contributing one!
Variant get_additional_data(extension_name: StringName) 🔗
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(idx: int) 🔗
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(idx: int) 🔗
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() 🔗
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() 🔗
There is currently no description for this method. Please help us by contributing one!
Array[GLTFCamera] get_cameras() 🔗
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() 🔗
There is currently no description for this method. Please help us by contributing one!
Array[Texture2D] get_images() 🔗
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() 🔗
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() 🔗
There is currently no description for this method. Please help us by contributing one!
Array[GLTFMesh] get_meshes() 🔗
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) 🔗
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.
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(idx: int) 🔗
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() 🔗
Restituisce un array di tutti i GLTFSkeleton nel file glTF. Questi sono gli scheletri a cui fa riferimento l'indice GLTFNode.skeleton.
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() 🔗
Recupera l'array dei campionatori di texture utilizzati dalle texture contenute nel glTF.
Array[GLTFTexture] get_textures() 🔗
There is currently no description for this method. Please help us by contributing one!
Array[String] get_unique_animation_names() 🔗
Restituisce un array di nomi univoci di animazione. È utilizzato solo durante il processo di importazione.
Array[String] get_unique_names() 🔗
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) 🔗
There is currently no description for this method. Please help us by contributing one!
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.