Attention: Here be dragons
This is the
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Class for importing and exporting glTF files in and out of Godot.
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.
String image_format =
The user-friendly name of the export image format. This is used when exporting the GLTF file, including writing to a file and writing to a byte array.
By default, Godot allows the following options: "None", "PNG", "JPEG", "Lossless WebP", and "Lossy WebP". Support for more image formats can be added in GLTFDocumentExtension classes.
float lossy_quality =
If image_format is a lossy image format, this determines the lossy quality of the image. On a range of
0.0 is the lowest quality and
1.0 is the highest quality. A lossy quality of
1.0 is not the same as lossless.
base_path 被 append_from_buffer 用作依赖关系的查找路径，可以为空。
接收一个 GLTF 文件的路径，并通过
state 参数将该文件路径上的数据导入到给定的 GLTFState 对象。
base_path 被 append_from_file 用作依赖关系的查找路径，可以为空。
接收一个 Godot 引擎的场景节点，并通过
state 参数将其及其后代导出到给定的 GLTFState 对象。
state 参数接收一个 GLTFState 对象，并返回一个 Godot 引擎的场景节点。
使用 GLTFDocument 注册给定的 GLTFDocumentExtension 实例。如果
first_priority 为 true，则该扩展将被首先运行。否则，它将被最后运行。