EditorResourceConversionPlugin
Plugin for adding custom converters from one resource format to another in the editor resource picker context menu; for example, converting a StandardMaterial3D
to a ShaderMaterial
.
class EditorResourceConversionPlugin
EditorResourceConversionPlugin
is invoked when the context menu is brought up for a resource in the editor inspector. Relevant conversion plugins will appear as menu options to convert the given resource to a target type.
Below shows an example of a basic plugin that will convert an ImageTexture
to a PortableCompressedTexture2D
.
To use an EditorResourceConversionPlugin
, register it using the addResourceConversionPlugin(_:)
method first.
Superclasses
class RefCounted
Base class for reference-counted 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 (3)
Hide implementation details
func _convert(resource: Resource?
) -> Resource? Takes an input
Resource
and converts it to the type given in_convertsTo
. The returnedResource
is the result of the conversion, and the inputResource
remains unchanged.func _convertsTo(
) -> String Returns the class name of the target type of
Resource
that this plugin converts source resources to.func _handles(resource: Resource?
) -> Bool Called to determine whether a particular
Resource
can be converted to the target resource type by this plugin.