Merge pull request #93842 from raulsntos/3.x-gltf-document-extension-2

[3.x] Fix type hints in GLTFDocumentExtension virtual methods
This commit is contained in:
lawnjelly 2024-07-02 11:59:58 +01:00 committed by GitHub
commit 47a27839cb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 31 additions and 31 deletions

View file

@ -12,9 +12,9 @@
<methods> <methods>
<method name="_convert_scene_node" qualifiers="virtual"> <method name="_convert_scene_node" qualifiers="virtual">
<return type="void" /> <return type="void" />
<argument index="0" name="state" type="Object" /> <argument index="0" name="state" type="GLTFState" />
<argument index="1" name="gltf_node" type="Object" /> <argument index="1" name="gltf_node" type="GLTFNode" />
<argument index="2" name="scene_node" type="Object" /> <argument index="2" name="scene_node" type="Node" />
<description> <description>
Part of the export process. This method is run after [method _export_preflight] and before [method _export_node]. 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]. 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].
@ -22,10 +22,10 @@
</method> </method>
<method name="_export_node" qualifiers="virtual"> <method name="_export_node" qualifiers="virtual">
<return type="int" /> <return type="int" />
<argument index="0" name="state" type="Object" /> <argument index="0" name="state" type="GLTFState" />
<argument index="1" name="gltf_node" type="Object" /> <argument index="1" name="gltf_node" type="GLTFNode" />
<argument index="2" name="json" type="Dictionary" /> <argument index="2" name="json" type="Dictionary" />
<argument index="3" name="node" type="Object" /> <argument index="3" name="node" type="Node" />
<description> <description>
Part of the export process. This method is run after [method _convert_scene_node] and before [method _export_post]. 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. This method can be used to modify the final JSON of each node.
@ -33,7 +33,7 @@
</method> </method>
<method name="_export_post" qualifiers="virtual"> <method name="_export_post" qualifiers="virtual">
<return type="int" /> <return type="int" />
<argument index="0" name="state" type="Object" /> <argument index="0" name="state" type="GLTFState" />
<description> <description>
Part of the export process. This method is run last, after all other parts of the export process. 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. This method can be used to modify the final JSON of the generated GLTF file.
@ -41,8 +41,8 @@
</method> </method>
<method name="_export_preflight" qualifiers="virtual"> <method name="_export_preflight" qualifiers="virtual">
<return type="int" /> <return type="int" />
<argument index="0" name="state" type="Object" /> <argument index="0" name="state" type="GLTFState" />
<argument index="1" name="root" type="Object" /> <argument index="1" name="root" type="Node" />
<description> <description>
Part of the export process. This method is run first, before all other parts of the export process. 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 [constant OK], the export will use this [GLTFDocumentExtension] instance. If not overridden, [constant OK] is returned. 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.
@ -50,9 +50,9 @@
</method> </method>
<method name="_generate_scene_node" qualifiers="virtual"> <method name="_generate_scene_node" qualifiers="virtual">
<return type="Object" /> <return type="Object" />
<argument index="0" name="state" type="Object" /> <argument index="0" name="state" type="GLTFState" />
<argument index="1" name="gltf_node" type="Object" /> <argument index="1" name="gltf_node" type="GLTFNode" />
<argument index="2" name="scene_parent" type="Object" /> <argument index="2" name="scene_parent" type="Node" />
<description> <description>
Part of the import process. This method is run after [method _parse_node_extensions] and before [method _import_post_parse]. 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. 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.
@ -67,10 +67,10 @@
</method> </method>
<method name="_import_node" qualifiers="virtual"> <method name="_import_node" qualifiers="virtual">
<return type="int" /> <return type="int" />
<argument index="0" name="state" type="Object" /> <argument index="0" name="state" type="GLTFState" />
<argument index="1" name="gltf_node" type="Object" /> <argument index="1" name="gltf_node" type="GLTFNode" />
<argument index="2" name="json" type="Dictionary" /> <argument index="2" name="json" type="Dictionary" />
<argument index="3" name="node" type="Object" /> <argument index="3" name="node" type="Node" />
<description> <description>
Part of the import process. This method is run after [method _import_post_parse] and before [method _import_post]. 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. This method can be used to make modifications to each of the generated Godot scene nodes.
@ -78,8 +78,8 @@
</method> </method>
<method name="_import_post" qualifiers="virtual"> <method name="_import_post" qualifiers="virtual">
<return type="int" /> <return type="int" />
<argument index="0" name="state" type="Object" /> <argument index="0" name="state" type="GLTFState" />
<argument index="1" name="root" type="Object" /> <argument index="1" name="root" type="Node" />
<description> <description>
Part of the import process. This method is run last, after all other parts of the import process. 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. This method can be used to modify the final Godot scene generated by the import process.
@ -87,7 +87,7 @@
</method> </method>
<method name="_import_post_parse" qualifiers="virtual"> <method name="_import_post_parse" qualifiers="virtual">
<return type="int" /> <return type="int" />
<argument index="0" name="state" type="Object" /> <argument index="0" name="state" type="GLTFState" />
<description> <description>
Part of the import process. This method is run after [method _generate_scene_node] and before [method _import_node]. 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. 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.
@ -95,7 +95,7 @@
</method> </method>
<method name="_import_preflight" qualifiers="virtual"> <method name="_import_preflight" qualifiers="virtual">
<return type="int" /> <return type="int" />
<argument index="0" name="state" type="Object" /> <argument index="0" name="state" type="GLTFState" />
<argument index="1" name="extensions" type="PoolStringArray" /> <argument index="1" name="extensions" type="PoolStringArray" />
<description> <description>
Part of the import process. This method is run first, before all other parts of the import process. Part of the import process. This method is run first, before all other parts of the import process.
@ -104,8 +104,8 @@
</method> </method>
<method name="_parse_node_extensions" qualifiers="virtual"> <method name="_parse_node_extensions" qualifiers="virtual">
<return type="int" /> <return type="int" />
<argument index="0" name="state" type="Object" /> <argument index="0" name="state" type="GLTFState" />
<argument index="1" name="gltf_node" type="Object" /> <argument index="1" name="gltf_node" type="GLTFNode" />
<argument index="2" name="extensions" type="Dictionary" /> <argument index="2" name="extensions" type="Dictionary" />
<description> <description>
Part of the import process. This method is run after [method _get_supported_extensions] and before [method _generate_scene_node]. Part of the import process. This method is run after [method _get_supported_extensions] and before [method _generate_scene_node].

View file

@ -34,18 +34,18 @@
void GLTFDocumentExtension::_bind_methods() { void GLTFDocumentExtension::_bind_methods() {
// Import process. // Import process.
BIND_VMETHOD(MethodInfo(Variant::INT, "_import_preflight", PropertyInfo(Variant::OBJECT, "state"), PropertyInfo(Variant::POOL_STRING_ARRAY, "extensions"))); BIND_VMETHOD(MethodInfo(Variant::INT, "_import_preflight", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "GLTFState"), PropertyInfo(Variant::POOL_STRING_ARRAY, "extensions")));
BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_supported_extensions")); BIND_VMETHOD(MethodInfo(Variant::ARRAY, "_get_supported_extensions"));
BIND_VMETHOD(MethodInfo(Variant::INT, "_parse_node_extensions", PropertyInfo(Variant::OBJECT, "state"), PropertyInfo(Variant::OBJECT, "gltf_node"), PropertyInfo(Variant::DICTIONARY, "extensions"))); BIND_VMETHOD(MethodInfo(Variant::INT, "_parse_node_extensions", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "GLTFState"), PropertyInfo(Variant::OBJECT, "gltf_node", PROPERTY_HINT_RESOURCE_TYPE, "GLTFNode"), PropertyInfo(Variant::DICTIONARY, "extensions")));
BIND_VMETHOD(MethodInfo(Variant::OBJECT, "_generate_scene_node", PropertyInfo(Variant::OBJECT, "state"), PropertyInfo(Variant::OBJECT, "gltf_node"), PropertyInfo(Variant::OBJECT, "scene_parent"))); BIND_VMETHOD(MethodInfo(Variant::OBJECT, "_generate_scene_node", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "GLTFState"), PropertyInfo(Variant::OBJECT, "gltf_node", PROPERTY_HINT_RESOURCE_TYPE, "GLTFNode"), PropertyInfo(Variant::OBJECT, "scene_parent", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
BIND_VMETHOD(MethodInfo(Variant::INT, "_import_post_parse", PropertyInfo(Variant::OBJECT, "state"))); BIND_VMETHOD(MethodInfo(Variant::INT, "_import_post_parse", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "GLTFState")));
BIND_VMETHOD(MethodInfo(Variant::INT, "_import_node", PropertyInfo(Variant::OBJECT, "state"), PropertyInfo(Variant::OBJECT, "gltf_node"), PropertyInfo(Variant::DICTIONARY, "json"), PropertyInfo(Variant::OBJECT, "node"))); BIND_VMETHOD(MethodInfo(Variant::INT, "_import_node", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "GLTFState"), PropertyInfo(Variant::OBJECT, "gltf_node", PROPERTY_HINT_RESOURCE_TYPE, "GLTFNode"), PropertyInfo(Variant::DICTIONARY, "json"), PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
BIND_VMETHOD(MethodInfo(Variant::INT, "_import_post", PropertyInfo(Variant::OBJECT, "state"), PropertyInfo(Variant::OBJECT, "root"))); BIND_VMETHOD(MethodInfo(Variant::INT, "_import_post", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "GLTFState"), PropertyInfo(Variant::OBJECT, "root", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
// Export process. // Export process.
BIND_VMETHOD(MethodInfo(Variant::INT, "_export_preflight", PropertyInfo(Variant::OBJECT, "state"), PropertyInfo(Variant::OBJECT, "root"))); BIND_VMETHOD(MethodInfo(Variant::INT, "_export_preflight", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "GLTFState"), PropertyInfo(Variant::OBJECT, "root", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
BIND_VMETHOD(MethodInfo("_convert_scene_node", PropertyInfo(Variant::OBJECT, "state"), PropertyInfo(Variant::OBJECT, "gltf_node"), PropertyInfo(Variant::OBJECT, "scene_node"))); BIND_VMETHOD(MethodInfo("_convert_scene_node", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "GLTFState"), PropertyInfo(Variant::OBJECT, "gltf_node", PROPERTY_HINT_RESOURCE_TYPE, "GLTFNode"), PropertyInfo(Variant::OBJECT, "scene_node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
BIND_VMETHOD(MethodInfo(Variant::INT, "_export_node", PropertyInfo(Variant::OBJECT, "state"), PropertyInfo(Variant::OBJECT, "gltf_node"), PropertyInfo(Variant::DICTIONARY, "json"), PropertyInfo(Variant::OBJECT, "node"))); BIND_VMETHOD(MethodInfo(Variant::INT, "_export_node", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "GLTFState"), PropertyInfo(Variant::OBJECT, "gltf_node", PROPERTY_HINT_RESOURCE_TYPE, "GLTFNode"), PropertyInfo(Variant::DICTIONARY, "json"), PropertyInfo(Variant::OBJECT, "node", PROPERTY_HINT_RESOURCE_TYPE, "Node")));
BIND_VMETHOD(MethodInfo(Variant::INT, "_export_post", PropertyInfo(Variant::OBJECT, "state"))); BIND_VMETHOD(MethodInfo(Variant::INT, "_export_post", PropertyInfo(Variant::OBJECT, "state", PROPERTY_HINT_RESOURCE_TYPE, "GLTFState")));
} }
// Import process. // Import process.