Signal4
Signal support.
EditorPlugin.swift:1990class Signal4
Use the connect(flags:_:)
method to connect to the signal on the container object, and disconnect(_:)
to drop the connection.
You can also await the emitted
property for waiting for a single emission of the signal.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (80) members.
Types
enum AfterGUIInput
enum CustomControlContainer
enum DockSlot
class Signal1
Signal support.
class Signal2
Signal support.
class Signal3
Signal support.
Type members
Instance members
var mainScreenChanged: Signal3
Emitted when user changes the workspace (2D, 3D, Script, AssetLib). Also works with custom screens defined by plugins.
var projectSettingsChanged: SimpleSignal
Emitted when any project setting has changed.
var resourceSaved: Signal4
Emitted when the given
resource
was saved on disc.var sceneChanged: Signal1
Emitted when the scene is changed in the editor. The argument will return the root node of the scene that has just become active. If this scene is new and empty, the argument will be
null
.var sceneClosed: Signal2
Emitted when user closes a scene. The argument is file path to a closed scene.
func addAutoloadSingleton(name: String, path: String
) Adds a script at
path
to the Autoload list asname
.func addControlToBottomPanel(control: Control?, title: String
) -> Button? Adds a control to the bottom panel (together with Output, Debug, Animation, etc). Returns a reference to the button added. It’s up to you to hide/show the button when needed. When your plugin is deactivated, make sure to remove your custom control with
removeControlFromBottomPanel(control:)
and free it withqueueFree
.func addControlToContainer(EditorPlugin.CustomControlContainer, control: Control?
) Adds a custom control to a container (see
CustomControlContainer
). There are many locations where custom controls can be added in the editor UI.func addControlToDock(slot: EditorPlugin.DockSlot, control: Control?
) Adds the control to a specific dock slot (see
DockSlot
for options).func addCustomType(String, base: String, script: Script?, icon: Texture2D?
) Adds a custom type, which will appear in the list of nodes or resources. An icon can be optionally passed.
func addDebuggerPlugin(script: EditorDebuggerPlugin?
) Adds a
Script
as debugger plugin to the Debugger. The script must extendEditorDebuggerPlugin
.func addExportPlugin(EditorExportPlugin?
) Registers a new
EditorExportPlugin
. Export plugins are used to perform tasks when the project is being exported.func addImportPlugin(importer: EditorImportPlugin?, firstPriority: Bool
) Registers a new
EditorImportPlugin
. Import plugins are used to import custom and unsupported assets as a customResource
type.func addInspectorPlugin(EditorInspectorPlugin?
) Registers a new
EditorInspectorPlugin
. Inspector plugins are used to extendEditorInspector
and provide custom configuration tools for your object’s properties.func addNode3dGizmoPlugin(EditorNode3DGizmoPlugin?
) Registers a new
EditorNode3DGizmoPlugin
. Gizmo plugins are used to add custom gizmos to the 3D preview viewport for aNode3D
.func addResourceConversionPlugin(EditorResourceConversionPlugin?
) Registers a new
EditorResourceConversionPlugin
. Resource conversion plugins are used to add custom resource converters to the editor inspector.func addSceneFormatImporterPlugin(sceneFormatImporter: EditorSceneFormatImporter?, firstPriority: Bool
) Registers a new
EditorSceneFormatImporter
. Scene importers are used to import custom 3D asset formats as scenes.func addScenePostImportPlugin(sceneImportPlugin: EditorScenePostImportPlugin?, firstPriority: Bool
) Add a
EditorScenePostImportPlugin
. These plugins allow customizing the import process of 3D assets by adding new options to the import dialogs.func addToolMenuItem(name: String, callable: Callable
) Adds a custom menu item to Project > Tools named
name
. When clicked, the providedcallable
will be called.func addTranslationParserPlugin(parser: EditorTranslationParserPlugin?
) Registers a custom translation parser plugin for extracting translatable strings from custom files.
func addUndoRedoInspectorHookCallback(callable: Callable
) Hooks a callback into the undo/redo action creation when a property is modified in the inspector. This allows, for example, to save other properties that may be lost when a given property is modified.
func getEditorInterface(
) -> EditorInterface? Returns the
EditorInterface
singleton instance.func getExportAsMenu(
) -> PopupMenu? Returns the
PopupMenu
under Scene > Export As….func getPluginVersion(
) -> String Provide the version of the plugin declared in the
plugin.cfg
config file.func getScriptCreateDialog(
) -> ScriptCreateDialog? Gets the Editor’s dialog used for making scripts.
func getUndoRedo(
) -> EditorUndoRedoManager? Gets the undo/redo object. Most actions in the editor can be undoable, so use this object to make sure this happens when it’s worth it.
func hideBottomPanel(
) Minimizes the bottom panel.
func makeBottomPanelItemVisible(item: Control?
) Makes a specific item in the bottom panel visible.
func queueSaveLayout(
) Queue save the project’s editor layout.
func removeAutoloadSingleton(name: String
) Removes an Autoload
name
from the list.func removeControlFromBottomPanel(control: Control?
) Removes the control from the bottom panel. You have to manually
queueFree
the control.func removeControlFromContainer(EditorPlugin.CustomControlContainer, control: Control?
) Removes the control from the specified container. You have to manually
queueFree
the control.func removeControlFromDocks(control: Control?
) Removes the control from the dock. You have to manually
queueFree
the control.func removeCustomType(String
) Removes a custom type added by
addCustomType(_:base:script:icon:)
.func removeDebuggerPlugin(script: EditorDebuggerPlugin?
) Removes the debugger plugin with given script from the Debugger.
func removeExportPlugin(EditorExportPlugin?
) Removes an export plugin registered by
addExportPlugin(_:)
.func removeImportPlugin(importer: EditorImportPlugin?
) Removes an import plugin registered by
addImportPlugin(importer:firstPriority:)
.func removeInspectorPlugin(EditorInspectorPlugin?
) Removes an inspector plugin registered by
addImportPlugin(importer:firstPriority:)
func removeNode3dGizmoPlugin(EditorNode3DGizmoPlugin?
) Removes a gizmo plugin registered by
addNode3dGizmoPlugin(_:)
.func removeResourceConversionPlugin(EditorResourceConversionPlugin?
) Removes a resource conversion plugin registered by
addResourceConversionPlugin(_:)
.func removeSceneFormatImporterPlugin(sceneFormatImporter: EditorSceneFormatImporter?
) Removes a scene format importer registered by
addSceneFormatImporterPlugin(sceneFormatImporter:firstPriority:)
.func removeScenePostImportPlugin(sceneImportPlugin: EditorScenePostImportPlugin?
) Remove the
EditorScenePostImportPlugin
, added withaddScenePostImportPlugin(sceneImportPlugin:firstPriority:)
.func removeToolMenuItem(name: String
) Removes a menu
name
from Project > Tools.func removeTranslationParserPlugin(parser: EditorTranslationParserPlugin?
) Removes a custom translation parser plugin registered by
addTranslationParserPlugin(parser:)
.func removeUndoRedoInspectorHookCallback(callable: Callable
) Removes a callback previously added by
addUndoRedoInspectorHookCallback(callable:)
.func setForceDrawOverForwardingEnabled(
) Enables calling of
_forwardCanvasForceDrawOverViewport(viewportControl:)
for the 2D editor and_forward3dForceDrawOverViewport(viewportControl:)
for the 3D editor when their viewports are updated. You need to call this method only once and it will work permanently for this plugin.func setInputEventForwardingAlwaysEnabled(
) Use this method if you always want to receive inputs from 3D view screen inside
_forward3dGuiInput(viewportCamera:event:)
. It might be especially usable if your plugin will want to use raycast in the scene.func updateOverlays(
) -> Int32 Updates the overlays of the 2D and 3D editor viewport. Causes methods
_forwardCanvasDrawOverViewport(viewportControl:)
,_forwardCanvasForceDrawOverViewport(viewportControl:)
,_forward3dDrawOverViewport(viewportControl:)
and_forward3dForceDrawOverViewport(viewportControl:)
to be called.
Show implementation details (24)
Hide implementation details
func _applyChanges(
) This method is called when the editor is about to save the project, switch to another tab, etc. It asks the plugin to apply any pending state changes to ensure consistency.
func _build(
) -> Bool This method is called when the editor is about to run the project. The plugin can then perform required operations before the project runs.
func _clear(
) Clear all the state and reset the object being edited to zero. This ensures your plugin does not keep editing a currently existing node, or a node from the wrong scene.
func _disablePlugin(
) Called by the engine when the user disables the
EditorPlugin
in the Plugin tab of the project settings window.func _edit(object: Object?
) This function is used for plugins that edit specific object types (nodes or resources). It requests the editor to edit the given object.
func _enablePlugin(
) Called by the engine when the user enables the
EditorPlugin
in the Plugin tab of the project settings window.func _forward3dDrawOverViewport(viewportControl: Control?
) Called by the engine when the 3D editor’s viewport is updated. Use the
overlay
Control
for drawing. You can update the viewport manually by callingupdateOverlays
.func _forward3dForceDrawOverViewport(viewportControl: Control?
) This method is the same as
_forward3dDrawOverViewport(viewportControl:)
, except it draws on top of everything. Useful when you need an extra layer that shows over anything else.func _forward3dGuiInput(viewportCamera: Camera3D?, event: InputEvent?
) -> Int32 Called when there is a root node in the current edited scene,
_handles(object:)
is implemented, and anInputEvent
happens in the 3D viewport. The return value decides whether theInputEvent
is consumed or forwarded to otherEditorPlugin
s. SeeAfterGUIInput
for options.func _forwardCanvasDrawOverViewport(viewportControl: Control?
) Called by the engine when the 2D editor’s viewport is updated. Use the
overlay
Control
for drawing. You can update the viewport manually by callingupdateOverlays
.func _forwardCanvasForceDrawOverViewport(viewportControl: Control?
) This method is the same as
_forwardCanvasDrawOverViewport(viewportControl:)
, except it draws on top of everything. Useful when you need an extra layer that shows over anything else.func _forwardCanvasGuiInput(event: InputEvent?
) -> Bool Called when there is a root node in the current edited scene,
_handles(object:)
is implemented and anInputEvent
happens in the 2D viewport. Intercepts theInputEvent
, ifreturn true
EditorPlugin
consumes theevent
, otherwise forwardsevent
to other Editor classes.func _getBreakpoints(
) -> PackedStringArray This is for editors that edit script-based objects. You can return a list of breakpoints in the format (
script:line
), for example:res://path_to_script.gd:25
.func _getPluginIcon(
) -> Texture2D? Override this method in your plugin to return a
Texture2D
in order to give it an icon.func _getPluginName(
) -> String Override this method in your plugin to provide the name of the plugin when displayed in the Godot editor.
func _getState(
) -> GDictionary Override this method to provide a state data you want to be saved, like view position, grid settings, folding, etc. This is used when saving the scene (so state is kept when opening it again) and for switching tabs (so state can be restored when the tab returns). This data is automatically saved for each scene in an
editstate
file in the editor metadata folder. If you want to store global (scene-independent) editor data for your plugin, you can use_getWindowLayout(configuration:)
instead.func _getUnsavedStatus(forScene: String
) -> String Override this method to provide a custom message that lists unsaved changes. The editor will call this method when exiting or when closing a scene, and display the returned string in a confirmation dialog. Return empty string if the plugin has no unsaved changes.
func _getWindowLayout(configuration: ConfigFile?
) Override this method to provide the GUI layout of the plugin or any other data you want to be stored. This is used to save the project’s editor layout when
queueSaveLayout
is called or the editor layout was changed (for example changing the position of a dock). The data is stored in theeditor_layout.cfg
file in the editor metadata directory.func _handles(object: Object?
) -> Bool Implement this function if your plugin edits a specific type of object (Resource or Node). If you return
true
, then you will get the functions_edit(object:)
and_makeVisible(_:)
called when the editor requests them. If you have declared the methods_forwardCanvasGuiInput(event:)
and_forward3dGuiInput(viewportCamera:event:)
these will be called too.func _hasMainScreen(
) -> Bool Returns
true
if this is a main screen editor plugin (it goes in the workspace selector together with 2D, 3D, Script and AssetLib).func _makeVisible(Bool
) This function will be called when the editor is requested to become visible. It is used for plugins that edit a specific object type.
func _saveExternalData(
) This method is called after the editor saves the project or when it’s closed. It asks the plugin to save edited external scenes/resources.
func _setState(GDictionary
) Restore the state saved by
_getState
. This method is called when the current scene tab is changed in the editor.func _setWindowLayout(configuration: ConfigFile?
) Restore the plugin GUI layout and data saved by
_getWindowLayout(configuration:)
. This method is called for every plugin on editor startup. Use the providedconfiguration
file to read your saved data.
Citizens in SwiftGodot
Instance members
var emitted: Void
You can await this property to wait for the signal to be emitted once
func connect(flags: Object.ConnectFlags, @escaping (_ resource: Resource) -> ()
) -> Object Connects the signal to the specified callback
func disconnect(Object
) Disconnects a signal that was previously connected, the return value from calling
connect(flags:_:)