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¶
Inherits: Resource < RefCounted < Object
Represents all data of a GLTF file.
Description¶
Contains all nodes and resources of a GLTF file. This is used by GLTFDocument as data storage, which allows GLTFDocument and all GLTFDocumentExtension classes to remain stateless.
GLTFState can be populated by GLTFDocument reading a file or by converting a Godot scene. Then the data can either be used to create a Godot scene or save to a GLTF file. The code that converts to/from a Godot scene can be intercepted at arbitrary points by GLTFDocumentExtension classes. This allows for custom data to be stored in the GLTF file or for custom data to be converted to/from Godot nodes.
Tutorials¶
Properties¶
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
Methods¶
Constants¶
HANDLE_BINARY_DISCARD_TEXTURES = 0
Discards all embedded textures and uses untextured materials.
HANDLE_BINARY_EXTRACT_TEXTURES = 1
Extracts embedded textures to be reimported and compressed. Editor only. Acts as uncompressed at runtime.
HANDLE_BINARY_EMBED_AS_BASISU = 2
Embeds textures VRAM compressed with Basis Universal into the generated scene.
HANDLE_BINARY_EMBED_AS_UNCOMPRESSED = 3
Embeds textures compressed losslessly into the generated scene, matching old behavior.
Property Descriptions¶
String base_path = ""
The folder path associated with this GLTF data. This is used to find other files the GLTF file references, like images or binary buffers. This will be set during import when appending from a file, and will be set during export when writing to a file.
PackedByteArray[] buffers = []
void set_buffers ( PackedByteArray[] value )
PackedByteArray[] get_buffers ( )
There is currently no description for this property. Please help us by contributing one!
String copyright = ""
The copyright string in the asset header of the GLTF file. This is set during import if present and export if non-empty. See the GLTF asset header documentation for more information.
bool create_animations = true
There is currently no description for this property. Please help us by contributing one!
String filename = ""
The file name associated with this GLTF data. If it ends with .gltf
, this is text-based GLTF, otherwise this is binary GLB. This will be set during import when appending from a file, and will be set during export when writing to a file. If writing to a buffer, this will be an empty string.
PackedByteArray glb_data = PackedByteArray()
void set_glb_data ( PackedByteArray value )
PackedByteArray get_glb_data ( )
There is currently no description for this property. Please help us by contributing one!
Dictionary json = {}
void set_json ( Dictionary value )
Dictionary get_json ( )
There is currently no description for this property. Please help us by contributing one!
int major_version = 0
There is currently no description for this property. Please help us by contributing one!
int minor_version = 0
There is currently no description for this property. Please help us by contributing one!
PackedInt32Array root_nodes = PackedInt32Array()
void set_root_nodes ( PackedInt32Array value )
PackedInt32Array get_root_nodes ( )
The root nodes of the GLTF file. Typically, a GLTF file will only have one scene, and therefore one root node. However, a GLTF file may have multiple scenes and therefore multiple root nodes, which will be generated as siblings of each other and as children of the root node of the generated Godot scene.
String scene_name = ""
The name of the scene. When importing, if not specified, this will be the file name. When exporting, if specified, the scene name will be saved to the GLTF file.
bool use_named_skin_binds = false
There is currently no description for this property. Please help us by contributing one!
Method Descriptions¶
void add_used_extension ( String extension_name, bool required )
Appends an extension to the list of extensions used by this GLTF file during serialization. If required
is true, the extension will also be added to the list of required extensions. Do not run this in GLTFDocumentExtension._export_post, as that stage is too late to add extensions. The final list is sorted alphabetically.
GLTFAccessor[] get_accessors ( )
There is currently no description for this method. Please help us by contributing one!
Variant get_additional_data ( StringName extension_name )
Gets additional arbitrary data in this GLTFState instance. This can be used to keep per-file state data in GLTFDocumentExtension classes, which is important because they are stateless.
The argument should be the GLTFDocumentExtension name (does not have to match the extension name in the GLTF file), and the return value can be anything you set. If nothing was set, the return value is null.
AnimationPlayer get_animation_player ( int idx )
Returns the AnimationPlayer node with the given index. These nodes are only used during the export process when converting Godot AnimationPlayer nodes to GLTF animations.
int get_animation_players_count ( int idx )
Returns the number of AnimationPlayer nodes in this GLTFState. These nodes are only used during the export process when converting Godot AnimationPlayer nodes to GLTF animations.
GLTFAnimation[] get_animations ( )
Returns an array of all GLTFAnimations in the GLTF file. When importing, these will be generated as animations in an AnimationPlayer node. When exporting, these will be generated from Godot AnimationPlayer nodes.
GLTFBufferView[] get_buffer_views ( )
There is currently no description for this method. Please help us by contributing one!
GLTFCamera[] get_cameras ( )
Returns an array of all GLTFCameras in the GLTF file. These are the cameras that the GLTFNode.camera index refers to.
int get_handle_binary_image ( )
There is currently no description for this method. Please help us by contributing one!