2021-09-21 03:24:31 +02:00
<?xml version="1.0" encoding="UTF-8" ?>
2023-07-05 22:07:03 +02:00
<class name= "GLTFDocumentExtension" inherits= "Resource" version= "4.2" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation= "../../../doc/class.xsd" >
2021-09-21 03:24:31 +02:00
<brief_description >
2022-09-18 05:16:22 +02:00
[GLTFDocument] extension class.
2021-09-21 03:24:31 +02:00
</brief_description>
<description >
2022-09-18 05:16:22 +02:00
Extends the functionality of the [GLTFDocument] class by allowing you to run arbitrary code at various stages of GLTF import or export.
2022-09-19 03:35:13 +02:00
To use, make a new class extending GLTFDocumentExtension, override any methods you need, make an instance of your class, and register it using [method GLTFDocument.register_gltf_document_extension].
[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].
2021-09-21 03:24:31 +02:00
</description>
<tutorials >
</tutorials>
<methods >
2022-09-18 00:48:06 +02:00
<method name= "_convert_scene_node" qualifiers= "virtual" >
<return type= "void" />
<param index= "0" name= "state" type= "GLTFState" />
<param index= "1" name= "gltf_node" type= "GLTFNode" />
<param index= "2" name= "scene_node" type= "Node" />
<description >
Part of the export process. This method is run after [method _export_preflight] and before [method _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 [method _export_node].
</description>
</method>
2022-04-09 11:35:50 +02:00
<method name= "_export_node" qualifiers= "virtual" >
2023-01-15 20:33:20 +01:00
<return type= "int" enum= "Error" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "state" type= "GLTFState" />
<param index= "1" name= "gltf_node" type= "GLTFNode" />
<param index= "2" name= "json" type= "Dictionary" />
<param index= "3" name= "node" type= "Node" />
2021-09-21 03:24:31 +02:00
<description >
2022-09-18 00:48:06 +02:00
Part of the export process. This method is run after [method _convert_scene_node] and before [method _export_post].
This method can be used to modify the final JSON of each node.
2021-09-21 03:24:31 +02:00
</description>
</method>
2022-04-09 11:35:50 +02:00
<method name= "_export_post" qualifiers= "virtual" >
2023-01-15 20:33:20 +01:00
<return type= "int" enum= "Error" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "state" type= "GLTFState" />
2021-09-21 03:24:31 +02:00
<description >
2022-09-18 00:48:06 +02:00
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.
2021-09-21 03:24:31 +02:00
</description>
</method>
2022-04-09 11:35:50 +02:00
<method name= "_export_preflight" qualifiers= "virtual" >
2023-01-15 20:33:20 +01:00
<return type= "int" enum= "Error" />
2022-12-11 07:27:57 +01:00
<param index= "0" name= "state" type= "GLTFState" />
<param index= "1" name= "root" type= "Node" />
2021-09-21 03:24:31 +02:00
<description >
2022-09-18 00:48:06 +02:00
Part of the export process. This method is run first, before all other parts of the export process.
2022-11-29 07:50:26 +01:00
The return value is used to determine if this [GLTFDocumentExtension] instance should be used for exporting a given GLTF file. If [constant OK], the export will use this [GLTFDocumentExtension] instance. If not overridden, [constant OK] is returned.
2022-09-18 00:48:06 +02:00
</description>
</method>
<method name= "_generate_scene_node" qualifiers= "virtual" >
<return type= "Node3D" />
<param index= "0" name= "state" type= "GLTFState" />
<param index= "1" name= "gltf_node" type= "GLTFNode" />
<param index= "2" name= "scene_parent" type= "Node" />
<description >
Part of the import process. This method is run after [method _parse_node_extensions] and before [method _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.
2021-09-21 03:24:31 +02:00
</description>
</method>
2022-09-19 03:35:13 +02:00
<method name= "_get_supported_extensions" qualifiers= "virtual" >
<return type= "PackedStringArray" />
<description >
2022-09-18 00:48:06 +02:00
Part of the import process. This method is run after [method _import_preflight] and before [method _parse_node_extensions].
2022-09-19 03:35:13 +02:00
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.
</description>
</method>
2022-04-09 11:35:50 +02:00
<method name= "_import_node" qualifiers= "virtual" >
2023-01-15 20:33:20 +01:00
<return type= "int" enum= "Error" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "state" type= "GLTFState" />
<param index= "1" name= "gltf_node" type= "GLTFNode" />
<param index= "2" name= "json" type= "Dictionary" />
<param index= "3" name= "node" type= "Node" />
2021-09-21 03:24:31 +02:00
<description >
2022-09-18 00:48:06 +02:00
Part of the import process. This method is run after [method _import_post_parse] and before [method _import_post].
This method can be used to make modifications to each of the generated Godot scene nodes.
2021-09-21 03:24:31 +02:00
</description>
</method>
2022-04-09 11:35:50 +02:00
<method name= "_import_post" qualifiers= "virtual" >
2023-01-15 20:33:20 +01:00
<return type= "int" enum= "Error" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "state" type= "GLTFState" />
<param index= "1" name= "root" type= "Node" />
2021-09-21 03:24:31 +02:00
<description >
2022-09-18 00:48:06 +02:00
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.
2021-09-21 03:24:31 +02:00
</description>
</method>
2022-04-09 11:35:50 +02:00
<method name= "_import_post_parse" qualifiers= "virtual" >
2023-01-15 20:33:20 +01:00
<return type= "int" enum= "Error" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "state" type= "GLTFState" />
2021-09-21 03:24:31 +02:00
<description >
2022-09-18 00:48:06 +02:00
Part of the import process. This method is run after [method _generate_scene_node] and before [method _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.
2021-09-21 03:24:31 +02:00
</description>
</method>
2022-04-09 11:35:50 +02:00
<method name= "_import_preflight" qualifiers= "virtual" >
2023-01-15 20:33:20 +01:00
<return type= "int" enum= "Error" />
2022-08-06 20:11:48 +02:00
<param index= "0" name= "state" type= "GLTFState" />
2022-09-19 03:35:13 +02:00
<param index= "1" name= "extensions" type= "PackedStringArray" />
2021-09-21 03:24:31 +02:00
<description >
2022-09-18 00:48:06 +02:00
Part of the import process. This method is run first, before all other parts of the import process.
2022-11-29 07:50:26 +01:00
The return value is used to determine if this [GLTFDocumentExtension] instance should be used for importing a given GLTF file. If [constant OK], the import will use this [GLTFDocumentExtension] instance. If not overridden, [constant OK] is returned.
2022-09-18 00:48:06 +02:00
</description>
</method>
2023-05-10 04:28:40 +02:00
<method name= "_parse_image_data" qualifiers= "virtual" >
<return type= "int" enum= "Error" />
<param index= "0" name= "state" type= "GLTFState" />
<param index= "1" name= "image_data" type= "PackedByteArray" />
<param index= "2" name= "mime_type" type= "String" />
<param index= "3" name= "ret_image" type= "Image" />
<description >
Part of the import process. This method is run after [method _parse_node_extensions] and before [method _parse_texture_json].
Runs when parsing image data from a GLTF file. The data could be sourced from a separate file, a URI, or a buffer, and then is passed as a byte array.
</description>
</method>
2022-09-18 00:48:06 +02:00
<method name= "_parse_node_extensions" qualifiers= "virtual" >
2023-01-15 20:33:20 +01:00
<return type= "int" enum= "Error" />
2022-09-18 00:48:06 +02:00
<param index= "0" name= "state" type= "GLTFState" />
<param index= "1" name= "gltf_node" type= "GLTFNode" />
<param index= "2" name= "extensions" type= "Dictionary" />
<description >
Part of the import process. This method is run after [method _get_supported_extensions] and before [method _generate_scene_node].
2022-11-29 07:50:26 +01:00
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 [method _generate_scene_node]. The return value should be a member of the [enum Error] enum.
2021-09-21 03:24:31 +02:00
</description>
</method>
2023-05-10 04:28:40 +02:00
<method name= "_parse_texture_json" qualifiers= "virtual" >
<return type= "int" enum= "Error" />
<param index= "0" name= "state" type= "GLTFState" />
<param index= "1" name= "texture_json" type= "Dictionary" />
<param index= "2" name= "ret_gltf_texture" type= "GLTFTexture" />
<description >
Part of the import process. This method is run after [method _parse_image_data] and before [method _generate_scene_node].
Runs when parsing the texture JSON from the GLTF textures array. This can be used to set the source image index to use as the texture.
</description>
</method>
2021-09-21 03:24:31 +02:00
</methods>
</class>