EditorInspectorPlugin
Plugin for adding custom property editors on the inspector.
EditorInspectorPlugin.swift:24class EditorInspectorPlugin
EditorInspectorPlugin
allows adding custom property editors to EditorInspector
.
When an object is edited, the _canHandle(object:)
function is called and must return true
if the object type is supported.
If supported, the function _parseBegin(object:)
will be called, allowing to place custom controls at the beginning of the class.
Subsequently, the _parseCategory(object:category:)
and _parseProperty(object:type:name:hintType:hintString:usageFlags:wide:)
are called for every category and property. They offer the ability to add custom controls to the inspector too.
Finally, _parseEnd(object:)
will be called.
On each of these calls, the “add” functions can be called.
To use EditorInspectorPlugin
, register it using the addInspectorPlugin(_:)
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
func addCustomControl(Control?
) Adds a custom control, which is not necessarily a property editor.
func addPropertyEditor(property: String, editor: Control?, addToEnd: Bool
) Adds a property editor for an individual property. The
editor
control must extendEditorProperty
.func addPropertyEditorForMultipleProperties(label: String, properties: PackedStringArray, editor: Control?
) Adds an editor that allows modifying multiple properties. The
editor
control must extendEditorProperty
.
Show implementation details (6)
Hide implementation details
func _canHandle(object: Object?
) -> Bool Returns
true
if this object can be handled by this plugin.func _parseBegin(object: Object?
) Called to allow adding controls at the beginning of the property list for
object
.func _parseCategory(object: Object?, category: String
) Called to allow adding controls at the beginning of a category in the property list for
object
.func _parseEnd(object: Object?
) Called to allow adding controls at the end of the property list for
object
.func _parseGroup(object: Object?, group: String
) Called to allow adding controls at the beginning of a group or a sub-group in the property list for
object
.func _parseProperty(object: Object?, type: Variant.GType, name: String, hintType: PropertyHint, hintString: String, usageFlags: PropertyUsageFlags, wide: Bool
) -> Bool Called to allow adding property-specific editors to the property list for
object
. The added editor control must extendEditorProperty
. Returningtrue
removes the built-in editor for this property, otherwise allows to insert a custom editor before the built-in one.