GLTFDocumentExtension
GLTFDocument
extension class.
class GLTFDocumentExtension
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 registerGltfDocumentExtension(_:firstPriority:)
.
Superclasses
class Resource
Base class for serializable objects.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
Show implementation details (19)
Hide implementation details
func _convertSceneNode(state: GLTFState?, gltfNode: GLTFNode?, sceneNode: Node?
) Part of the export process. This method is run after
_exportPreflight(state:root:)
and before_exportPreserialize(state:)
.func _exportNode(state: GLTFState?, gltfNode: GLTFNode?, json: GDictionary, node: Node?
) -> GodotError Part of the export process. This method is run after
_getSaveableImageFormats
and before_exportPost(state:)
. If thisGLTFDocumentExtension
is used for exporting images, this runs after_serializeTextureJson(state:textureJson:gltfTexture:imageFormat:)
.func _exportPost(state: GLTFState?
) -> GodotError Part of the export process. This method is run last, after all other parts of the export process.
func _exportPreflight(state: GLTFState?, root: Node?
) -> GodotError Part of the export process. This method is run first, before all other parts of the export process.
func _exportPreserialize(state: GLTFState?
) -> GodotError Part of the export process. This method is run after
_convertSceneNode(state:gltfNode:sceneNode:)
and before_getSaveableImageFormats
.func _generateSceneNode(state: GLTFState?, gltfNode: GLTFNode?, sceneParent: Node?
) -> Node3D? Part of the import process. This method is run after
_importPostParse(state:)
and before_importNode(state:gltfNode:json:node:)
.func _getImageFileExtension(
) -> String Returns the file extension to use for saving image data into, for example,
".png"
. 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 aResourceImporter
class able to import the file. If not defined or empty, Godot will save the image into a PNG file.func _getSaveableImageFormats(
) -> PackedStringArray Part of the export process. This method is run after
_convertSceneNode(state:gltfNode:sceneNode:)
and before_exportNode(state:gltfNode:json:node:)
.func _getSupportedExtensions(
) -> PackedStringArray Part of the import process. This method is run after
_importPreflight(state:extensions:)
and before_parseNodeExtensions(state:gltfNode:extensions:)
.func _importNode(state: GLTFState?, gltfNode: GLTFNode?, json: GDictionary, node: Node?
) -> GodotError Part of the import process. This method is run after
_generateSceneNode(state:gltfNode:sceneParent:)
and before_importPost(state:root:)
.func _importPost(state: GLTFState?, root: Node?
) -> GodotError Part of the import process. This method is run last, after all other parts of the import process.
func _importPostParse(state: GLTFState?
) -> GodotError Part of the import process. This method is run after
_parseNodeExtensions(state:gltfNode:extensions:)
and before_generateSceneNode(state:gltfNode:sceneParent:)
.func _importPreflight(state: GLTFState?, extensions: PackedStringArray
) -> GodotError Part of the import process. This method is run first, before all other parts of the import process.
func _parseImageData(state: GLTFState?, imageData: PackedByteArray, mimeType: String, retImage: Image?
) -> GodotError Part of the import process. This method is run after
_parseNodeExtensions(state:gltfNode:extensions:)
and before_parseTextureJson(state:textureJson:retGltfTexture:)
.func _parseNodeExtensions(state: GLTFState?, gltfNode: GLTFNode?, extensions: GDictionary
) -> GodotError Part of the import process. This method is run after
_getSupportedExtensions
and before_importPostParse(state:)
.func _parseTextureJson(state: GLTFState?, textureJson: GDictionary, retGltfTexture: GLTFTexture?
) -> GodotError Part of the import process. This method is run after
_parseImageData(state:imageData:mimeType:retImage:)
and before_generateSceneNode(state:gltfNode:sceneParent:)
.func _saveImageAtPath(state: GLTFState?, image: Image?, filePath: String, imageFormat: String, lossyQuality: Double
) -> GodotError Part of the export process. This method is run after
_getSaveableImageFormats
and before_serializeTextureJson(state:textureJson:gltfTexture:imageFormat:)
.func _serializeImageToBytes(state: GLTFState?, image: Image?, imageDict: GDictionary, imageFormat: String, lossyQuality: Double
) -> PackedByteArray Part of the export process. This method is run after
_getSaveableImageFormats
and before_serializeTextureJson(state:textureJson:gltfTexture:imageFormat:)
.func _serializeTextureJson(state: GLTFState?, textureJson: GDictionary, gltfTexture: GLTFTexture?, imageFormat: String
) -> GodotError Part of the export process. This method is run after
_saveImageAtPath(state:image:filePath:imageFormat:lossyQuality:)
or_serializeImageToBytes(state:image:imageDict:imageFormat:lossyQuality:)
, and before_exportNode(state:gltfNode:json:node:)
. Note that this method only runs when thisGLTFDocumentExtension
is selected as the image exporter.