GLTFDocumentExtension

Inherits: Resource < Reference < Object

GLTFDocument extension class.

Description

Extends the functionality of the GLTFDocument class by allowing you to run arbitrary code at various stages of GLTF import or export.

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 GLTFState or GLTFNode.

Methods

void

_convert_scene_node ( GLTFState state, GLTFNode gltf_node, Node scene_node ) virtual

int

_export_node ( GLTFState state, GLTFNode gltf_node, Dictionary json, Node node ) virtual

int

_export_post ( GLTFState state ) virtual

int

_export_preflight ( GLTFState state, Node root ) virtual

Object

_generate_scene_node ( GLTFState state, GLTFNode gltf_node, Node scene_parent ) virtual

Array

_get_supported_extensions ( ) virtual

int

_import_node ( GLTFState state, GLTFNode gltf_node, Dictionary json, Node node ) virtual

int

_import_post ( GLTFState state, Node root ) virtual

int

_import_post_parse ( GLTFState state ) virtual

int

_import_preflight ( GLTFState state, PoolStringArray extensions ) virtual

int

_parse_node_extensions ( GLTFState state, GLTFNode gltf_node, Dictionary extensions ) virtual


Method Descriptions

void _convert_scene_node ( GLTFState state, GLTFNode gltf_node, Node scene_node ) virtual

Part of the export process. This method is run after _export_preflight and before _export_node.

Runs when converting the data from a Godot scene node. This method can be used to process the Godot scene node data into a format that can be used by _export_node.


int _export_node ( GLTFState state, GLTFNode gltf_node, Dictionary json, Node node ) virtual

Part of the export process. This method is run after _convert_scene_node and before _export_post.

This method can be used to modify the final JSON of each node.


int _export_post ( GLTFState state ) virtual

Part of the export process. This method is run last, after all other parts of the export process.

This method can be used to modify the final JSON of the generated GLTF file.


int _export_preflight ( GLTFState state, Node root ) virtual

Part of the export process. This method is run first, before all other parts of the export process.

The return value is used to determine if this GLTFDocumentExtension instance should be used for exporting a given GLTF file. If @GlobalScope.OK, the export will use this GLTFDocumentExtension instance. If not overridden, @GlobalScope.OK is returned.


Object _generate_scene_node ( GLTFState state, GLTFNode gltf_node, Node scene_parent ) virtual

Part of the import process. This method is run after _parse_node_extensions and before _import_post_parse.

Runs when generating a Godot scene node from a GLTFNode. The returned node will be added to the scene tree. Multiple nodes can be generated in this step if they are added as a child of the returned node.


Array _get_supported_extensions ( ) virtual

Part of the import process. This method is run after _import_preflight and before _parse_node_extensions.

Returns an array of the GLTF extensions supported by this GLTFDocumentExtension class. This is used to validate if a GLTF file with required extensions can be loaded.


int _import_node ( GLTFState state, GLTFNode gltf_node, Dictionary json, Node node ) virtual

Part of the import process. This method is run after _import_post_parse and before _import_post.

This method can be used to make modifications to each of the generated Godot scene nodes.


int _import_post ( GLTFState state, Node root ) virtual

Part of the import process. This method is run last, after all other parts of the import process.

This method can be used to modify the final Godot scene generated by the import process.


int _import_post_parse ( GLTFState state ) virtual

Part of the import process. This method is run after _generate_scene_node and before _import_node.

This method can be used to modify any of the data imported so far, including any scene nodes, before running the final per-node import step.


int _import_preflight ( GLTFState state, PoolStringArray extensions ) virtual

Part of the import process. This method is run first, before all other parts of the import process.

The return value is used to determine if this GLTFDocumentExtension instance should be used for importing a given GLTF file. If @GlobalScope.OK, the import will use this GLTFDocumentExtension instance. If not overridden, @GlobalScope.OK is returned.


int _parse_node_extensions ( GLTFState state, GLTFNode gltf_node, Dictionary extensions ) virtual

Part of the import process. This method is run after _get_supported_extensions and before _generate_scene_node.

Runs when parsing the node extensions of a GLTFNode. This method can be used to process the extension JSON data into a format that can be used by _generate_scene_node. The return value should be a member of the Error enum.