:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/4.0/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/4.0/modules/gltf/doc_classes/GLTFDocument.xml. .. _class_GLTFDocument: GLTFDocument ============ **Inherits:** :ref:`Resource` **<** :ref:`RefCounted` **<** :ref:`Object` .. rst-class:: classref-introduction-group Description ----------- Append a glTF2 3d format from a file, buffer or scene and then write to the filesystem, buffer or scene. .. rst-class:: classref-reftable-group Methods ------- .. table:: :widths: auto +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`append_from_buffer` **(** :ref:`PackedByteArray` bytes, :ref:`String` base_path, :ref:`GLTFState` state, :ref:`int` flags=0 **)** | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`append_from_file` **(** :ref:`String` path, :ref:`GLTFState` state, :ref:`int` flags=0, :ref:`String` base_path="" **)** | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`append_from_scene` **(** :ref:`Node` node, :ref:`GLTFState` state, :ref:`int` flags=0 **)** | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`PackedByteArray` | :ref:`generate_buffer` **(** :ref:`GLTFState` state **)** | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Node` | :ref:`generate_scene` **(** :ref:`GLTFState` state, :ref:`float` bake_fps=30, :ref:`bool` trimming=false, :ref:`bool` remove_immutable_tracks=true **)** | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`register_gltf_document_extension` **(** :ref:`GLTFDocumentExtension` extension, :ref:`bool` first_priority=false **)** |static| | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | void | :ref:`unregister_gltf_document_extension` **(** :ref:`GLTFDocumentExtension` extension **)** |static| | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | :ref:`Error` | :ref:`write_to_filesystem` **(** :ref:`GLTFState` state, :ref:`String` path **)** | +-----------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Method Descriptions ------------------- .. _class_GLTFDocument_method_append_from_buffer: .. rst-class:: classref-method :ref:`Error` **append_from_buffer** **(** :ref:`PackedByteArray` bytes, :ref:`String` base_path, :ref:`GLTFState` state, :ref:`int` flags=0 **)** Takes a :ref:`PackedByteArray` defining a GLTF and imports the data to the given :ref:`GLTFState` object through the ``state`` parameter. \ **Note:** The ``base_path`` tells :ref:`append_from_buffer` where to find dependencies and can be empty. .. rst-class:: classref-item-separator ---- .. _class_GLTFDocument_method_append_from_file: .. rst-class:: classref-method :ref:`Error` **append_from_file** **(** :ref:`String` path, :ref:`GLTFState` state, :ref:`int` flags=0, :ref:`String` base_path="" **)** Takes a path to a GLTF file and imports the data at that file path to the given :ref:`GLTFState` object through the ``state`` parameter. \ **Note:** The ``base_path`` tells :ref:`append_from_file` where to find dependencies and can be empty. .. rst-class:: classref-item-separator ---- .. _class_GLTFDocument_method_append_from_scene: .. rst-class:: classref-method :ref:`Error` **append_from_scene** **(** :ref:`Node` node, :ref:`GLTFState` state, :ref:`int` flags=0 **)** Takes a Godot Engine scene node and exports it and its descendants to the given :ref:`GLTFState` object through the ``state`` parameter. .. rst-class:: classref-item-separator ---- .. _class_GLTFDocument_method_generate_buffer: .. rst-class:: classref-method :ref:`PackedByteArray` **generate_buffer** **(** :ref:`GLTFState` state **)** Takes a :ref:`GLTFState` object through the ``state`` parameter and returns a GLTF :ref:`PackedByteArray`. .. rst-class:: classref-item-separator ---- .. _class_GLTFDocument_method_generate_scene: .. rst-class:: classref-method :ref:`Node` **generate_scene** **(** :ref:`GLTFState` state, :ref:`float` bake_fps=30, :ref:`bool` trimming=false, :ref:`bool` remove_immutable_tracks=true **)** Takes a :ref:`GLTFState` object through the ``state`` parameter and returns a Godot Engine scene node. .. rst-class:: classref-item-separator ---- .. _class_GLTFDocument_method_register_gltf_document_extension: .. rst-class:: classref-method void **register_gltf_document_extension** **(** :ref:`GLTFDocumentExtension` extension, :ref:`bool` first_priority=false **)** |static| Registers the given :ref:`GLTFDocumentExtension` instance with GLTFDocument. If ``first_priority`` is true, this extension will be run first. Otherwise, it will be run last. \ **Note:** Like GLTFDocument itself, all GLTFDocumentExtension classes must be stateless in order to function properly. If you need to store data, use the ``set_additional_data`` and ``get_additional_data`` methods in :ref:`GLTFState` or :ref:`GLTFNode`. .. rst-class:: classref-item-separator ---- .. _class_GLTFDocument_method_unregister_gltf_document_extension: .. rst-class:: classref-method void **unregister_gltf_document_extension** **(** :ref:`GLTFDocumentExtension` extension **)** |static| Unregisters the given :ref:`GLTFDocumentExtension` instance. .. rst-class:: classref-item-separator ---- .. _class_GLTFDocument_method_write_to_filesystem: .. rst-class:: classref-method :ref:`Error` **write_to_filesystem** **(** :ref:`GLTFState` state, :ref:`String` path **)** Takes a :ref:`GLTFState` object through the ``state`` parameter and writes a glTF file to the filesystem. \ **Note:** The extension of the glTF file determines if it is a .glb binary file or a .gltf file. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`