|
28 | 28 | <param index="2" name="json" type="Dictionary" />
|
29 | 29 | <param index="3" name="node" type="Node" />
|
30 | 30 | <description>
|
31 |
| - Part of the export process. This method is run after [method _export_preserialize] and before [method _export_post]. |
| 31 | + Part of the export process. This method is run after [method _get_saveable_image_formats] and before [method _export_post]. If this [GLTFDocumentExtension] is used for exporting images, this runs after [method _serialize_texture_json]. |
32 | 32 | This method can be used to modify the final JSON of each node.
|
33 | 33 | </description>
|
34 | 34 | </method>
|
|
53 | 53 | <return type="int" enum="Error" />
|
54 | 54 | <param index="0" name="state" type="GLTFState" />
|
55 | 55 | <description>
|
56 |
| - Part of the export process. This method is run after [method _convert_scene_node] and before [method _export_node]. |
| 56 | + Part of the export process. This method is run after [method _convert_scene_node] and before [method _get_saveable_image_formats]. |
57 | 57 | This method can be used to alter the state before performing serialization. It runs every time when generating a buffer with [method GLTFDocument.generate_buffer] or writing to the file system with [method GLTFDocument.write_to_filesystem].
|
58 | 58 | </description>
|
59 | 59 | </method>
|
|
73 | 73 | Returns the file extension to use for saving image data into, for example, [code]".png"[/code]. If defined, when this extension is used to handle images, and the images are saved to a separate file, the image bytes will be copied to a file with this extension. If this is set, there should be a [ResourceImporter] class able to import the file. If not defined or empty, Godot will save the image into a PNG file.
|
74 | 74 | </description>
|
75 | 75 | </method>
|
| 76 | + <method name="_get_saveable_image_formats" qualifiers="virtual"> |
| 77 | + <return type="PackedStringArray" /> |
| 78 | + <description> |
| 79 | + Part of the export process. This method is run after [method _convert_scene_node] and before [method _export_node]. |
| 80 | + Returns an array of the image formats that can be saved/exported by this extension. This extension will only be selected as the image exporter if the [GLTFDocument]'s [member GLTFDocument.image_format] is in this array. If this [GLTFDocumentExtension] is selected as the image exporter, one of the [method _save_image_at_path] or [method _serialize_image_to_bytes] methods will run next, otherwise [method _export_node] will run next. If the format name contains [code]"Lossy"[/code], the lossy quality slider will be displayed. |
| 81 | + </description> |
| 82 | + </method> |
76 | 83 | <method name="_get_supported_extensions" qualifiers="virtual">
|
77 | 84 | <return type="PackedStringArray" />
|
78 | 85 | <description>
|
|
148 | 155 | 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.
|
149 | 156 | </description>
|
150 | 157 | </method>
|
| 158 | + <method name="_save_image_at_path" qualifiers="virtual"> |
| 159 | + <return type="int" enum="Error" /> |
| 160 | + <param index="0" name="state" type="GLTFState" /> |
| 161 | + <param index="1" name="image" type="Image" /> |
| 162 | + <param index="2" name="file_path" type="String" /> |
| 163 | + <param index="3" name="image_format" type="String" /> |
| 164 | + <param index="4" name="lossy_quality" type="float" /> |
| 165 | + <description> |
| 166 | + Part of the export process. This method is run after [method _get_saveable_image_formats] and before [method _serialize_texture_json]. |
| 167 | + This method is run when saving images separately from the GLTF file. When images are embedded, [method _serialize_image_to_bytes] runs instead. Note that these methods only run when this [GLTFDocumentExtension] is selected as the image exporter. |
| 168 | + </description> |
| 169 | + </method> |
| 170 | + <method name="_serialize_image_to_bytes" qualifiers="virtual"> |
| 171 | + <return type="PackedByteArray" /> |
| 172 | + <param index="0" name="state" type="GLTFState" /> |
| 173 | + <param index="1" name="image" type="Image" /> |
| 174 | + <param index="2" name="image_dict" type="Dictionary" /> |
| 175 | + <param index="3" name="image_format" type="String" /> |
| 176 | + <param index="4" name="lossy_quality" type="float" /> |
| 177 | + <description> |
| 178 | + Part of the export process. This method is run after [method _get_saveable_image_formats] and before [method _serialize_texture_json]. |
| 179 | + This method is run when embedding images in the GLTF file. When images are saved separately, [method _save_image_at_path] runs instead. Note that these methods only run when this [GLTFDocumentExtension] is selected as the image exporter. |
| 180 | + This method must set the image MIME type in the [param image_dict] with the [code]"mimeType"[/code] key. For example, for a PNG image, it would be set to [code]"image/png"[/code]. The return value must be a [PackedByteArray] containing the image data. |
| 181 | + </description> |
| 182 | + </method> |
| 183 | + <method name="_serialize_texture_json" qualifiers="virtual"> |
| 184 | + <return type="int" enum="Error" /> |
| 185 | + <param index="0" name="state" type="GLTFState" /> |
| 186 | + <param index="1" name="texture_json" type="Dictionary" /> |
| 187 | + <param index="2" name="gltf_texture" type="GLTFTexture" /> |
| 188 | + <param index="3" name="image_format" type="String" /> |
| 189 | + <description> |
| 190 | + Part of the export process. This method is run after [method _save_image_at_path] or [method _serialize_image_to_bytes], and before [method _export_node]. Note that this method only runs when this [GLTFDocumentExtension] is selected as the image exporter. |
| 191 | + This method can be used to set up the extensions for the texture JSON by editing [param texture_json]. The extension must also be added as used extension with [method GLTFState.add_used_extension], be sure to set [code]required[/code] to [code]true[/code] if you are not providing a fallback. |
| 192 | + </description> |
| 193 | + </method> |
151 | 194 | </methods>
|
152 | 195 | </class>
|
0 commit comments