Signal9
Signal support.
GraphEdit.swift:2832class Signal9
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 (83) members.
Types
enum GridPattern
enum PanningScheme
class Signal1
Signal support.
class Signal10
Signal support.
class Signal11
Signal support.
class Signal12
Signal support.
class Signal2
Signal support.
class Signal3
Signal support.
class Signal4
Signal support.
class Signal5
Signal support.
class Signal6
Signal support.
class Signal7
Signal support.
class Signal8
Signal support.
Type members
Instance members
var beginNodeMove: SimpleSignal
Emitted at the beginning of a
GraphElement
’s 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 this
GraphEdit
captures aui_copy
action ([kbd]Ctrl + C[/kbd] by default). In general, this signal indicates that the selectedGraphElement
s should be copied.var deleteNodesRequest: Signal6
Emitted when this
GraphEdit
captures aui_graph_delete
action ([kbd]Delete[/kbd] by default).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 this
GraphEdit
captures aui_graph_duplicate
action ([kbd]Ctrl + D[/kbd] by default). In general, this signal indicates that the selectedGraphElement
s should be duplicated.var endNodeMove: SimpleSignal
Emitted at the end of a
GraphElement
’s movement.var frameRectChanged: Signal9
Emitted when the
GraphFrame
frame
is resized tonewRect
.var graphElementsLinkedToFrameRequest: Signal11
Emitted when one or more
GraphElement
s are dropped onto theGraphFrame
namedframe
, when they were not previously attached to any other one.var gridPattern: GraphEdit.GridPattern
The pattern used for drawing the grid.
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
Emitted when the given
GraphElement
node is deselected.var nodeSelected: Signal7
Emitted when the given
GraphElement
node is selected.var panningScheme: GraphEdit.PanningScheme
Defines the control scheme for panning with mouse wheel.
var pasteNodesRequest: SimpleSignal
Emitted when this
GraphEdit
captures aui_paste
action ([kbd]Ctrl + V[/kbd] by default). In general, this signal indicates that previously copiedGraphElement
s should be pasted.var popupRequest: Signal10
Emitted when a popup is requested. Happens on right-clicking in the GraphEdit.
atPosition
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: Signal12
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 attachGraphElementToFrame(element: StringName, frame: StringName
) Attaches the
element
GraphElement
to theframe
GraphFrame
.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 detachGraphElementFromFrame(element: StringName
) Detaches the
element
GraphElement
from theGraphFrame
it is currently attached to.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 getAttachedNodesOfFrame(StringName
) -> VariantCollection<StringName> Returns an array of node names that are attached to the
GraphFrame
with the given name.func getClosestConnectionAtPoint(Vector2, maxDistance: Double
) -> GDictionary Returns the closest connection to the given point in screen space. If no connection is found within
maxDistance
pixels, an emptyGDictionary
is returned.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
GArray
containing the list of connections. A connection consists in a structure of the form{ from_port: 0, from_node: "GraphNode name 0", to_port: 1, to_node: "GraphNode name 1" }
.func getConnectionsIntersectingWithRect(Rect2
) -> VariantCollection<GDictionary> Returns an
GArray
containing the list of connections that intersect with the givenRect2
. A connection consists in a structure of the form{ from_port: 0, from_node: "GraphNode name 0", to_port: 1, to_node: "GraphNode name 1" }
.func getElementFrame(element: StringName
) -> GraphFrame? Returns the
GraphFrame
that contains theGraphElement
with the given name.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 (_ frame: GraphFrame, _ newRect: Vector2) -> ()
) -> 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:_:)