Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

GLTFDocument

Inherits: Resource < RefCounted < Object

Class for importing and exporting glTF files in and out of Godot.

Description

GLTFDocument supports reading data from a glTF file, buffer, or Godot scene. This data can then be written to the filesystem, buffer, or used to create a Godot scene.

All of the data in a GLTF scene is stored in the GLTFState class. GLTFDocument processes state objects, but does not contain any scene data itself. GLTFDocument has member variables to store export configuration settings such as the image format, but is otherwise stateless. Multiple scenes can be processed with the same settings using the same GLTFDocument object and different GLTFState objects.

GLTFDocument can be extended with arbitrary functionality by extending the GLTFDocumentExtension class and registering it with GLTFDocument via register_gltf_document_extension. This allows for custom data to be imported and exported.

Tutorials

Properties

String

image_format

"PNG"

float

lossy_quality

0.75

RootNodeMode

root_node_mode

0

Methods

Error

append_from_buffer ( PackedByteArray bytes, String base_path, GLTFState state, int flags=0 )

Error

append_from_file ( String path, GLTFState state, int flags=0, String base_path="" )

Error

append_from_scene ( Node node, GLTFState state, int flags=0 )

PackedByteArray