Change the way GLTFDocumentExtension classes are registered
Also move GLTFDocumentExtension into the extensions folder
This commit is contained in:
parent
dca5cb8e40
commit
73c673a614
11 changed files with 69 additions and 69 deletions
|
|
@ -50,6 +50,15 @@
|
|||
<description>
|
||||
</description>
|
||||
</method>
|
||||
<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>
|
||||
Registers this GLTFDocumentExtension instance with GLTFDocument. If [param first_priority] is true, this extension will be ran first. Otherwise, it will be ran last.
|
||||
[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>
|
||||
<method name="write_to_filesystem">
|
||||
<return type="int" enum="Error" />
|
||||
<param index="0" name="state" type="GLTFState" />
|
||||
|
|
@ -58,8 +67,4 @@
|
|||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
<members>
|
||||
<member name="extensions" type="GLTFDocumentExtension[]" setter="set_extensions" getter="get_extensions" default="[]">
|
||||
</member>
|
||||
</members>
|
||||
</class>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
</brief_description>
|
||||
<description>
|
||||
Extends the functionality of the [GLTFDocument] class by allowing you to run arbitrary code at various stages of GLTF import or export.
|
||||
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].
|
||||
</description>
|
||||
<tutorials>
|
||||
</tutorials>
|
||||
|
|
@ -61,7 +63,9 @@
|
|||
<method name="_import_preflight" qualifiers="virtual">
|
||||
<return type="int" />
|
||||
<param index="0" name="state" type="GLTFState" />
|
||||
<param index="1" name="extensions" type="PackedStringArray" />
|
||||
<description>
|
||||
This callback is run first. It is used to determine if this GLTFDocumentExtension class should be used for importing a given GLTF file. If [constant OK], the import will use this GLTFDocumentExtension class.
|
||||
</description>
|
||||
</method>
|
||||
</methods>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue