2021-01-04 13:33:44 +00:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-06 08:08:05 +00:00
<class name= "GLTFDocument" inherits= "Resource" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../../../doc/class.xsd" >
2021-01-04 13:33:44 +00:00
<brief_description >
2023-08-03 06:18:45 +00:00
Class for importing and exporting glTF files in and out of Godot.
2021-01-04 13:33:44 +00:00
</brief_description>
<description >
2023-08-03 06:18:45 +00:00
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 can be extended with arbitrary functionality by extending the [GLTFDocumentExtension] class and registering it with GLTFDocument via [method register_gltf_document_extension]. This allows for custom data to be imported and exported.
2021-01-04 13:33:44 +00:00
</description>
<tutorials >
2023-08-03 06:18:45 +00:00
<link title= "glTF 'What the duck?' guide" > https://www.khronos.org/files/gltf20-reference-guide.pdf</link>
<link title= "Khronos glTF specification" > https://registry.khronos.org/glTF/</link>
2021-01-04 13:33:44 +00:00
</tutorials>
<methods >
2021-10-19 16:06:23 +00:00
<method name= "append_from_buffer" >
<return type= "int" enum= "Error" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "bytes" type= "PackedByteArray" />
<param index= "1" name= "base_path" type= "String" />
<param index= "2" name= "state" type= "GLTFState" />
<param index= "3" name= "flags" type= "int" default= "0" />
2021-10-19 16:06:23 +00:00
<description >
2023-01-15 20:26:12 +00:00
Takes a [PackedByteArray] defining a GLTF and imports the data to the given [GLTFState] object through the [param state] parameter.
2022-11-20 21:35:35 +00:00
[b]Note:[/b] The [param base_path] tells [method append_from_buffer] where to find dependencies and can be empty.
2021-10-19 16:06:23 +00:00
</description>
</method>
<method name= "append_from_file" >
<return type= "int" enum= "Error" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "path" type= "String" />
<param index= "1" name= "state" type= "GLTFState" />
<param index= "2" name= "flags" type= "int" default= "0" />
2022-11-14 19:14:52 +00:00
<param index= "3" name= "base_path" type= "String" default= """" />
2021-09-10 07:54:10 +00:00
<description >
2023-01-15 20:26:12 +00:00
Takes a path to a GLTF file and imports the data at that file path to the given [GLTFState] object through the [param state] parameter.
2022-11-20 21:35:35 +00:00
[b]Note:[/b] The [param base_path] tells [method append_from_file] where to find dependencies and can be empty.
2021-09-10 07:54:10 +00:00
</description>
</method>
2021-10-19 16:06:23 +00:00
<method name= "append_from_scene" >
2021-09-10 07:54:10 +00:00
<return type= "int" enum= "Error" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "node" type= "Node" />
<param index= "1" name= "state" type= "GLTFState" />
<param index= "2" name= "flags" type= "int" default= "0" />
2021-10-19 16:06:23 +00:00
<description >
2023-01-15 20:26:12 +00:00
Takes a Godot Engine scene node and exports it and its descendants to the given [GLTFState] object through the [param state] parameter.
2021-10-19 16:06:23 +00:00
</description>
</method>
<method name= "generate_buffer" >
<return type= "PackedByteArray" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "state" type= "GLTFState" />
2021-10-19 16:06:23 +00:00
<description >
2023-01-15 20:26:12 +00:00
Takes a [GLTFState] object through the [param state] parameter and returns a GLTF [PackedByteArray].
2021-10-19 16:06:23 +00:00
</description>
</method>
<method name= "generate_scene" >
<return type= "Node" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "state" type= "GLTFState" />
2022-11-14 19:14:52 +00:00
<param index= "1" name= "bake_fps" type= "float" default= "30" />
<param index= "2" name= "trimming" type= "bool" default= "false" />
2023-01-29 23:49:55 +00:00
<param index= "3" name= "remove_immutable_tracks" type= "bool" default= "true" />
2021-10-19 16:06:23 +00:00
<description >
2022-11-20 21:35:35 +00:00
Takes a [GLTFState] object through the [param state] parameter and returns a Godot Engine scene node.
2021-10-19 16:06:23 +00:00
</description>
</method>
2022-09-19 01:35:13 +00:00
<method name= "register_gltf_document_extension" qualifiers= "static" >
<return type= "void" />
<param index= "0" name= "extension" type= "GLTFDocumentExtension" />
<param index= "1" name= "first_priority" type= "bool" default= "false" />
<description >
2022-11-22 20:07:56 +00:00
Registers the given [GLTFDocumentExtension] instance with GLTFDocument. If [param first_priority] is true, this extension will be run first. Otherwise, it will be run last.
2022-09-19 01:35:13 +00:00
[b]Note:[/b] Like GLTFDocument itself, all GLTFDocumentExtension classes must be stateless in order to function properly. If you need to store data, use the [code]set_additional_data[/code] and [code]get_additional_data[/code] methods in [GLTFState] or [GLTFNode].
</description>
</method>
2022-11-22 20:07:56 +00:00
<method name= "unregister_gltf_document_extension" qualifiers= "static" >
<return type= "void" />
<param index= "0" name= "extension" type= "GLTFDocumentExtension" />
<description >
Unregisters the given [GLTFDocumentExtension] instance.
</description>
</method>
2021-10-19 16:06:23 +00:00
<method name= "write_to_filesystem" >
<return type= "int" enum= "Error" />
2022-08-06 18:11:48 +00:00
<param index= "0" name= "state" type= "GLTFState" />
<param index= "1" name= "path" type= "String" />
2021-09-10 07:54:10 +00:00
<description >
2022-11-20 21:35:35 +00:00
Takes a [GLTFState] object through the [param state] parameter and writes a glTF file to the filesystem.
[b]Note:[/b] The extension of the glTF file determines if it is a .glb binary file or a .gltf file.
2021-09-10 07:54:10 +00:00
</description>
</method>
2021-01-04 13:33:44 +00:00
</methods>
</class>