Signal6
Signal support.
GraphEdit.swift:2559class Signal6
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 (71) members.
Types
enum PanningScheme
class Signal1
Signal support.
class Signal10
Signal support.
class Signal2
Signal support.
class Signal3
Signal support.
class Signal4
Signal support.
class Signal5
Signal support.
class Signal7
Signal support.
class Signal8
Signal support.
class Signal9
Signal support.
Type members
Instance members
var beginNodeMove: SimpleSignal
Emitted at the beginning of a GraphNode movement.
var connectionDragEnded: SimpleSignal
Emitted at the end of a connection drag.
var connectionDragStarted: Signal5
Emitted at the beginning of a connection drag.
var connectionFromEmpty: Signal4
Emitted when user drags a connection from an input port into the empty space of the graph.
var connectionLinesAntialiased: Bool
If
true
, the lines between nodes will use antialiasing.var connectionLinesCurvature: Double
The curvature of the lines between the nodes. 0 results in straight lines.
var connectionLinesThickness: Double
The thickness of the lines between the nodes.
var connectionRequest: Signal1
Emitted to the GraphEdit when the connection between the
fromPort
of thefromNode
GraphNode
and thetoPort
of thetoNode
GraphNode
is attempted to be created.var connectionToEmpty: Signal3
Emitted when user drags a connection from an output port into the empty space of the graph.
var copyNodesRequest: SimpleSignal
Emitted when the user presses [kbd]Ctrl + C[/kbd].
var deleteNodesRequest: Signal6
Emitted when attempting to remove a GraphNode from the GraphEdit. Provides a list of node names to be removed (all selected nodes, excluding nodes without closing button).
var disconnectionRequest: Signal2
Emitted to the GraphEdit when the connection between
fromPort
offromNode
GraphNode
andtoPort
oftoNode
GraphNode
is attempted to be removed.var duplicateNodesRequest: SimpleSignal
Emitted when a GraphNode is attempted to be duplicated in the GraphEdit.
var endNodeMove: SimpleSignal
Emitted at the end of a GraphNode movement.
var minimapEnabled: Bool
If
true
, the minimap is visible.var minimapOpacity: Double
The opacity of the minimap rectangle.
var minimapSize: Vector2
The size of the minimap rectangle. The map itself is based on the size of the grid area and is scaled to fit this rectangle.
var nodeDeselected: Signal8
To connect to this signal, reference this property and call the
var nodeSelected: Signal7
Emitted when a GraphNode is selected.
var panningScheme: GraphEdit.PanningScheme
Defines the control scheme for panning with mouse wheel.
var pasteNodesRequest: SimpleSignal
Emitted when the user presses [kbd]Ctrl + V[/kbd].
var popupRequest: Signal9
Emitted when a popup is requested. Happens on right-clicking in the GraphEdit.
position
is the position of the mouse pointer when the signal is sent.var rightDisconnects: Bool
If
true
, enables disconnection of existing connections in the GraphEdit by dragging the right end.var scrollOffset: Vector2
The scroll offset.
var scrollOffsetChanged: Signal10
Emitted when the scroll offset is changed by the user. It will not be emitted when changed in code.
var showArrangeButton: Bool
If
true
, the button to automatically arrange graph nodes is visible.var showGrid: Bool
If
true
, the grid is visible.var showGridButtons: Bool
If
true
, buttons that allow to configure grid and snapping options are visible.var showMenu: Bool
If
true
, the menu toolbar is visible.var showMinimapButton: Bool
If
true
, the button to toggle the minimap is visible.var showZoomButtons: Bool
If
true
, buttons that allow to change and reset the zoom level are visible.var showZoomLabel: Bool
If
true
, the label with the current zoom level is visible. The zoom level is displayed in percents.var snappingDistance: Int32
The snapping distance in pixels, also determines the grid line distance.
var snappingEnabled: Bool
If
true
, enables snapping.var zoom: Double
The current zoom value.
var zoomMax: Double
The upper zoom limit.
var zoomMin: Double
The lower zoom limit.
var zoomStep: Double
The step of each zoom level.
func addValidConnectionType(fromType: Int32, toType: Int32
) Allows the connection between two different port types. The port type is defined individually for the left and the right port of each slot with the
setSlot(slotIndex:enableLeftPort:typeLeft:colorLeft:enableRightPort:typeRight:colorRight:customIconLeft:customIconRight:drawStylebox:)
method.func addValidLeftDisconnectType(Int32
) Allows to disconnect nodes when dragging from the left port of the
GraphNode
’s slot if it has the specified type. See alsoremoveValidLeftDisconnectType(_:)
.func addValidRightDisconnectType(Int32
) Allows to disconnect nodes when dragging from the right port of the
GraphNode
’s slot if it has the specified type. See alsoremoveValidRightDisconnectType(_:)
.func arrangeNodes(
) Rearranges selected nodes in a layout with minimum crossings between connections and uniform horizontal and vertical gap between nodes.
func clearConnections(
) Removes all connections between nodes.
func connectNode(fromNode: StringName, fromPort: Int32, toNode: StringName, toPort: Int32
) -> GodotError Create a connection between the
fromPort
of thefromNode
GraphNode
and thetoPort
of thetoNode
GraphNode
. If the connection already exists, no connection is created.func disconnectNode(fromNode: StringName, fromPort: Int32, toNode: StringName, toPort: Int32
) Removes the connection between the
fromPort
of thefromNode
GraphNode
and thetoPort
of thetoNode
GraphNode
. If the connection does not exist, no connection is removed.func forceConnectionDragEnd(
) Ends the creation of the current connection. In other words, if you are dragging a connection you can use this method to abort the process and remove the line that followed your cursor.
func getConnectionLine(fromNode: Vector2, toNode: Vector2
) -> PackedVector2Array Returns the points which would make up a connection between
fromNode
andtoNode
.func getConnectionList(
) -> VariantCollection<GDictionary> Returns an Array containing the list of connections. A connection consists in a structure of the form
{ from_port: 0, from: "GraphNode name 0", to_port: 1, to: "GraphNode name 1" }
.func getMenuHbox(
) -> HBoxContainer? Gets the
HBoxContainer
that contains the zooming and grid snap controls in the top left of the graph. You can use this method to reposition the toolbar or to add your own custom controls to it.func isNodeConnected(fromNode: StringName, fromPort: Int32, toNode: StringName, toPort: Int32
) -> Bool Returns
true
if thefromPort
of thefromNode
GraphNode
is connected to thetoPort
of thetoNode
GraphNode
.func isValidConnectionType(fromType: Int32, toType: Int32
) -> Bool Returns whether it’s possible to make a connection between two different port types. The port type is defined individually for the left and the right port of each slot with the
setSlot(slotIndex:enableLeftPort:typeLeft:colorLeft:enableRightPort:typeRight:colorRight:customIconLeft:customIconRight:drawStylebox:)
method.func removeValidConnectionType(fromType: Int32, toType: Int32
) Disallows the connection between two different port types previously allowed by
addValidConnectionType(fromType:toType:)
. The port type is defined individually for the left and the right port of each slot with thesetSlot(slotIndex:enableLeftPort:typeLeft:colorLeft:enableRightPort:typeRight:colorRight:customIconLeft:customIconRight:drawStylebox:)
method.func removeValidLeftDisconnectType(Int32
) Disallows to disconnect nodes when dragging from the left port of the
GraphNode
’s slot if it has the specified type. Use this to disable disconnection previously allowed withaddValidLeftDisconnectType(_:)
.func removeValidRightDisconnectType(Int32
) Disallows to disconnect nodes when dragging from the right port of the
GraphNode
’s slot if it has the specified type. Use this to disable disconnection previously allowed withaddValidRightDisconnectType(_:)
.func setConnectionActivity(fromNode: StringName, fromPort: Int32, toNode: StringName, toPort: Int32, amount: Double
) Sets the coloration of the connection between
fromNode
’sfromPort
andtoNode
’stoPort
with the color provided in the [theme_item activity] theme property. The color is linearly interpolated between the connection color and the activity color usingamount
as weight.func setSelected(node: Node?
) Sets the specified
node
as the one selected.
Show implementation details (4)
Hide implementation details
func _getConnectionLine(fromPosition: Vector2, toPosition: Vector2
) -> PackedVector2Array Virtual method which can be overridden to customize how connections are drawn.
func _isInInputHotzone(inNode: Object?, inPort: Int32, mousePosition: Vector2
) -> Bool Returns whether the
mousePosition
is in the input hot zone.func _isInOutputHotzone(inNode: Object?, inPort: Int32, mousePosition: Vector2
) -> Bool Returns whether the
mousePosition
is in the output hot zone. For more information on hot zones, see_isInInputHotzone(inNode:inPort:mousePosition:)
.func _isNodeHoverValid(fromNode: StringName, fromPort: Int32, toNode: StringName, toPort: Int32
) -> Bool This virtual method can be used to insert additional error detection while the user is dragging a connection over a valid port.
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 (_ nodes: VariantCollection<StringName>) -> ()
) -> 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:_:)